[MOBY-l] help with MobyXMLObject...

Michael Jensen michael at acutrans.net
Tue Dec 30 20:13:11 UTC 2003


I am trying to put a few services together into one script, so taking 
the output of one to another. I can get a few working together, but the 
getGOTerm service output has me stuck. Here is the output from the 
simple script just running this service and trying to get some of 
return values by themselves:

<?xml version='1.0' encoding='UTF-8'?>
       <moby:MOBY xmlns:moby='http://www.biomoby.org/moby' 
xmlns='http://www.biomoby.org/moby'>
         <moby:Response moby:authority='illuminae.com'>

         <moby:queryResponse moby:queryID=''>
             <moby:Simple articleName='GO_Term_From_ID'>
                                         <moby:GO_Term namespace='GO' 
id='GO:0004623'>
                                                 <moby:String 
namespace='' id='' articleName='Term'>phospholipase A2 
activity</moby:String>
                                                 <moby:String 
namespace='' id='' articleName='Definition'>Catalysis of the reaction: 
phosphatidylcholine + H2O = 1-acylglycerophosphocholine + a 
carboxylate.</moby:String>
                                         </moby:GO_Term></moby:Simple>
         </moby:queryResponse>

     </moby:Response>
       </moby:MOBY>


Found an input Simple object:
   Class     'moby:GO_Term'
   xml_tag   'GO_Term'
   Namespace 'GO'
   ID        'GO:0004623'
   Name      ''
   Value     ''


So I can get the articleName and even the GO:00004623 out of the 
various elements, but I can't figure out how to get the values of the 
Term and Definition from within the tags (phospholipase A2 activity). 
My code is as follows:

#!/usr/bin/perl
##### put in 0004623 from the command line for it to run on 
something#######

use MOBY::Client::Central;
use MOBY::Client::Service;
use MobyXmlObject;

################## getGOTerm ##################

my $Central = MOBY::Client::Central->new();

my ($Services, $REG) = $Central->findService(
   authURI => 'www.illuminae.com',
   serviceName => 'getGoTerm',
);
unless ($Services) { print "Discovery failed: ", $REG->message; 
exit(1); }

my $svc = $Services->[0];
print "Executing service ", $svc->name, "\n", $svc->description, "\n\n";
my $wsdl = $Central->retrieveService($svc);
my $S = MOBY::Client::Service->new(service => $wsdl);

my $result;
foreach my $goterm(@ARGV) {
     $result = $S->execute(
       XMLinputlist => [ ['', qq{<Object namespace="go" id="$goterm"/>}] 
]
     ) || 'No result';
     print $result, "\n";
}

my @simples = MobyXmlObject->getMobySimples($result);
my @go_list;

foreach my $s (@simples) {
   my $class     = $s->class();
   my $namespace = $s->namespace();
   my $id        = $s->id();
   my $name      = $s->articleName();
   my $value     = $s->valueTrimmed();
   my $xml_tag   = $s->xml_tag();
   print qq{
Found an input Simple object:
   Class     '$class'
   xml_tag   '$xml_tag'
   Namespace '$namespace'
   ID        '$id'
   Name      '$name'
   Value     '$value'
};
}

Note to run it you should pass in 0004623 or another go id.

Any help would be greatly appreciated!

THANKS!

-Michael Jensen
mdjgf8 at mizzou.edu





More information about the moby-l mailing list