[MOBY] [MOBY-l] Interpreting results from Service->execute()

Frank Gibbons fgibbons at hms.harvard.edu
Wed Mar 17 20:27:13 UTC 2004


Mark,

At 10:54 AM 3/17/2004, Mark Wilkinson wrote:
>The WSDL could (in principle) tell you the service signature in terms of
>its structure (XSD) but not its semantics.  For MOBY, the structure is
>~irrelevant to us, since the ontology precisely defines the structure
>for both input and output.  As such, we haven't even found the need to
>implement the creation of an XSD for our objects, hence the somewhat
>peculiar WSDL that you get from MOBY Central.

Thanks for the code to show what the input/output is for each service. 
Since it didn't quite work with outputs that are collections, I'm appending 
my modified version here. In fact, it queries MOBY for all services, then 
prints an alphabetized (case-insensitive) list of services, handling both 
simple and collection outputs.

I hope it's useful to someone else. Thanks again for answering my questions.

-Frank

-----------------------------------------  appended perl 
code  ------------------------------------------------------------


use MOBY::Client::Central;

$m = MOBY::Client::Central->new;
#my ($auth, $name) = ('pdg.cnb.uam.es', 'getInteractions');
($ss, $r) = $m->findService(); #authURI => $auth, serviceName => $name);
my $i = 0;
foreach my $service (sort { lc $a->name cmp lc $b->name } @{$ss} ) {
   $i++;
   print "$i: Service ", $service->name, " from ",
     $service->authority, " is of type ", $service->type, "\n";
   print "It consumes: \n";
   $inputs = $service->input;
   foreach $in ( @{$inputs} ) {
     print "\t", $in->objectType, "\n";
     print "\t\tin namespace(s)\n";
     my $namespaces = $in->namespaces;
     foreach $ns ( @{$namespaces} ) {
       print "\t\t\t\t$ns\n";
     }
   }

   print "It generates ";
   $outputs = $service->output;
   foreach $out ( @{$outputs} ) {
     # Check for isCollection, each element of the collection should have 
an objectType
     if ($out->isCollection) {
       print "a collection of outputs:\n";
       foreach my $simple (@{$out->Simples}) {
         print "\t", $simple->objectType, "\n";
         print "\t\tin namespace(s)\n";
         foreach $ns ( @{$simple->namespaces} ) { print "\t\t\t\t$ns\n"; }
       }
     }
     else {
       print "a single output:\n";
       print "\t", $out->objectType, "\n";
       print "\t\tin namespace(s)\n";
       foreach $ns ( @{$out->namespaces} ) { print "\t\t\t\t$ns\n"; }
     }
   }
print "\n", '-'x80, "\n";
}


PhD, Computational Biologist,
Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
Tel: 617-432-3555       Fax: 
617-432-3557       http://llama.med.harvard.edu/~fgibbons 




More information about the moby-l mailing list