From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon Dec 1 19:23:46 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNax021442@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl Removed Files: MOBY.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl MOBY.pm,1.2,NONE rcsdiff: /home/repository/moby/moby-live/Perl/RCS/MOBY.pm,v: No such file or directory From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon Dec 1 19:23:47 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNC9021529@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/scripts In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/scripts Modified Files: testMOBYClientCentral_v05.pl Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/scripts testMOBYClientCentral_v05.pl,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl 2003/07/04 16:12:37 1.11 +++ /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl 2003/12/02 00:23:23 1.12 @@ -23,7 +23,12 @@ } -my $C = MOBY::Client::Central->new(); +my $C = MOBY::Client::Central->new( +#Registries => { +# mobycentral => {URL => 'http://localhost/cgi-bin/MOBY-Central.pl', +# URI => 'http://localhost/MOBY/Central'} +# } +); #reg first object class From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon Dec 1 19:23:47 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNoQ021508@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/MOBY/Client Modified Files: Central.html Central.pm CollectionArticle.pm SimpleArticle.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/MOBY/Client Central.html,1.11,1.12 Central.pm,1.62,1.63 CollectionArticle.pm,1.5,1.6 SimpleArticle.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/10/22 14:29:09 1.11 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/02 00:23:23 1.12 @@ -409,7 +409,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) - expandRelationships (NOT YET IMPLEMENTED) + expandRelationships => [1/0] (optional)

ISA

=================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/11/22 00:08:10 1.62 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/02 00:23:23 1.63 @@ -1294,7 +1294,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) - expandRelationships (NOT YET IMPLEMENTED) + expandRelationships => [1/0] (optional) =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/09/12 18:34:21 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/12/02 00:23:23 1.6 @@ -9,16 +9,24 @@ =head1 NAME -MOBY::Client::CollectionArticle - a small object describing a MOBY Collection input or output +MOBY::Client::CollectionArticle - a small object describing the Collection articles from the findService Response message of MOBY Central =head1 SYNOPSIS +experimental - please do not use in your code + =cut =head1 DESCRIPTION +This describes the Collection articles from the findService Response of MOBY Central +(i.e. the description of the service), it DOES NOT create collection articles +as provided by a service provider (i.e. simple articles containing data) + =head1 AUTHORS +Mark Wilkinson (markw at illuminae dot com) + =cut =head1 METHODS =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm 2003/07/01 16:01:01 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm 2003/12/02 00:23:23 1.3 @@ -8,16 +8,24 @@ =head1 NAME -MOBY::Client::SimpleArticle - a small object describing a MOBY Simple input/output article +MOBY::Client::SimpleArticle - a small object describing the Simple articles from the findService Response message of MOBY Central =head1 SYNOPSIS +experimental - please do not use in your code + =cut =head1 DESCRIPTION +This describes the Simple articles from the findService Response of MOBY Central +(i.e. the description of the service), it DOES NOT create simple articles +as provided by a service provider (i.e. simple articles containing data) + =head1 AUTHORS +Mark Wilkinson (markw at illuminae dot com) + =cut =head1 METHODS From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon Dec 1 19:23:48 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNTw021474@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/MOBY Modified Files: Central.html Central.pm OntologyServer.pm service_instance.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/MOBY Central.html,1.9,1.10 Central.pm,1.113,1.114 OntologyServer.pm,1.29,1.30 service_instance.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/11/01 16:42:13 1.9 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/12/02 00:23:23 1.10 @@ -333,12 +333,54 @@
  • only Input Secondary articles are defined during registration; Output Secondary objects are entirely optional and may or may not be interpreted Client-side using their articleName tags.
  • +
  • Service Categories:
    +
  • +
      Input XML :
           <registerService>
    -         <Category>moby</Category> <!-- one of 'moby', 'cgi', 'soap' ; currently only 'moby' services are fully supported -->
    +         <Category>moby</Category> <!-- one of 'moby', 'cgi', 'wsdl' ; currently only 'moby' and 'wsdl' services are fully supported -->
              <serviceName>YourServiceNameHere</serviceName>
              <serviceType>TypeOntologyTerm</serviceType>
              <authURI>your.URI.here</authURI>
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.113
    retrieving revision 1.114
    diff -u -r1.113 -r1.114
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/11/24 18:06:45	1.113
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 00:23:23	1.114
    @@ -873,25 +873,27 @@
     
     =over 2
     
    -=item *  in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class.  For "soap" services, there is additional flexibility:
    +=item *  in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class.
    +
    +=item *  For "soap" services, there is additional flexibility:
     
     =over 2
     
    -=item *  Similar to a "moby" service, your "soap" service must consume/produce ontologically valid named data-types in order to be discovered by registry searches.  As such, you _must_ register a single unique name for any non-MOBY input or output data Classes, regardless of the actual complexity of the input/output message.
    +=item *  Similar to a "moby" service, your "soap" service must consume/produce named data types.  These are represented as LSID's
     
    -=item *  Do this using the registerObjectClass call of MOBY Central; To ensure uniqueness and LSID compatibilty of data class names, you must name your data using the following format:  your.authURI:dataClassName
    +=item *  YOU DO NOT NEED TO REGISTER THESE DATA TYPES in MOBY Central; it is up to you what your LSID's represent, and MOBY Central WILL NOT try to resolve them!
     
    -=item *  remember, you may use any MOBY Object as your input/output (i.e. any Class Ontology term that inherits from Object) so long as you follow the MOBY message structure for that input or output.
    +=item *  You may mix ontologies when describing your service - i.e. you may freely use any MOBY Object as your input or (XOR) your output and use a non-MOBY object (LSID) for the alternate so long as you follow the MOBY message structure for the parameter that uses the MOBY Object
     
    -=item *  You may register, for example, a service that consumes a non-MOBY data Class and outputs a MOBY data class, so long as you follow the MOBY Messaging format for the output data
    +=over 2
     
    -=item *  You may register, for example, a service that consumes a MOBY data Class and outputs a non-MOBY data class, so long as you follow the MOBY Messaging format for the ihput data
    +=item *  You may register, for example, a service that consumes a non-MOBY data Class and outputs a MOBY data class, so long as you follow the MOBY Messaging format for the output data
     
    -=item *  NOTE: Nether of the cases above are considred MOBY services, and are therefore described in the category of "soap" service
    +=item *  You may register, for example, a service that consumes a MOBY data Class and outputs a non-MOBY data class, so long as you follow the MOBY Messaging format for the input data
     
    -=item *  When registering a non-MOBY data Class name, it DOES NOT have any "Relationship" component (see registerObjectClass API)
    +=item *  NOTE: Nether of the cases above are considered MOBY services, and are therefore described in the category of "soap" service
     
    -=item *  non-MOBY inputs or outputs are described as a single Primary, Simple article of your new named type.
    +=back
     
     =back
     
    @@ -903,6 +905,7 @@
     
     =back
     
    +=back
     
      Input XML :
     
    @@ -1079,17 +1082,18 @@
     	
     	foreach (keys %objects_to_be_validated){
     		my ($valid, $message, $URI) = $OS->objectExists(term => $_);
    -		return &_error("$message","$URI") unless ($valid);
    +		return &_error("$message","$URI") unless ($valid || (($_ =~ /urn:lsid/i) && !($_ =~ /urn:lsid:biomoby.org/i))); # either valid, or a non-moby LSID
     	}
    -	$debug && &_LOG("\n\n\aall objects okay\n");
    +
    +	$debug && &_LOG("\n\n\aall objects okay - either valid MOBY objects, or LSID's\n");
     
     	$OS = MOBY::OntologyServer->new(ontology => 'service');
     	my ($valid, $message, $URI) = $OS->serviceExists(term => $serviceType);
    -	return &_error("$message","$URI") unless ($valid);
    +	print STDERR "\n\nChecking $URI\n\n";
    +	return &_error("$message","$URI") unless ($valid || (($serviceType =~ /urn:lsid/i) && !($serviceType =~ /urn:lsid:biomoby.org/i)));  # either valid, or a non-MOBY LSID
    +	print STDERR "\n\nChecking $URI OK!!\n\n";
     	# right, registration should be successful now!
     	
    -	# "soap" services may only have one input and one output
    -
     	my $SVC = MOBY::service_instance->new(
     		category => $Category,
     		servicename => $serviceName,
    @@ -1158,8 +1162,8 @@
     			($_->getNodeType == TEXT_NODE) && ($object_type = $_->toString);
     		}
     		my ($success, $message, $typeURI) = $OE->objectExists(term => $object_type);
    -		unless ($success) {
    -			$SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist");
    +		if ((!($success) && ($object_type =~ /urn:lsid:biomoby.org/i)) || (!($success) && !($object_type =~ /urn:lsid/i))) {  # if the object doesn't exist, and it isn't an LSID
    +			$SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist, and is not an LSID");
     		}				# kill it all unless this was successful!
     
     		my $namespace_string;
    @@ -1169,10 +1173,11 @@
     		for (my $n = 0; $n<$num_ns;++$n) {
     			foreach my $name ($namespaces->item($n)->getChildNodes) {
     				if ($name->getNodeType == TEXT_NODE) {
    -					my ($success, $message, $URI) = $OE->namespaceExists(term => $name->toString);
    -					unless ($success) {
    +					my $term = $name->toString;
    +					my ($success, $message, $URI) = $OE->namespaceExists(term => $term);
    +					if ((!($success) && ($term =~ /urn:lsid:biomoby.org/i)) || (!($success) && !($term =~ /urn:lsid/i))) {  # if the object doesn't exist, and it isn't an LSID
     						$SVC->DELETE_THYSELF;
    -						return (-1,"namespace: " . $name->toString . " doesn't exist");
    +						return (-1,"namespace: $term doesn't exist and is not an LSID");
     					}
     					$namespace_string .=$URI.",";
     				}
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
    retrieving revision 1.29
    retrieving revision 1.30
    diff -u -r1.29 -r1.30
    --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/11/24 17:25:49	1.29
    +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/12/02 00:23:23	1.30
    @@ -171,9 +171,13 @@
         my ($self, %args) = @_;
         my $term = $args{term};
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
    -
    -    return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'object');
         my $sth;
    +    return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'object');
    +    
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objecttype/)){
    +        return (1, "external ontology", $term);
    +    }
    +
         if ($term =~ /^urn\:lsid/){
             $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_lsid = ?");
         } else {
    @@ -204,6 +208,10 @@
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objectclass/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -265,11 +273,15 @@
         return (0, "WRONG ONTOLOGY",'') unless ($self->ontology eq 'object');
     
         my $term = $args{term};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objectclass/)){
    +        return (0, "can't delete from external ontology", $term);
    +    }
    +
         my $LSID;
         unless ($term =~ /urn\:lsid/){$LSID = $self->getObjectURI($term)} else {$LSID=$term}
         return (0, q{Object type $term cannot be resolved to an LSID},"") unless $LSID;
     
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select object_id, object_lsid from object where object_type = ?},undef,$term);
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select object_id, object_lsid from object where object_lsid = ?},undef,$LSID);
         # object1_id ISA object2_id?
         my (@isa) = $self->dbh->selectrow_array(q{select * from object_term2term where object2_id = ?},undef, $id);
         if (scalar @isa){
    @@ -415,6 +427,10 @@
         my $term = $args{term};
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
     
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){
    +        return (1, "external ontology", $term);
    +    }
    +
         my $sth;
         if ($term =~ /^urn\:lsid/){
             $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_lsid = ?");
    @@ -446,6 +462,10 @@
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -475,11 +495,17 @@
         my ($self, %args) = @_;
         return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'service');
         my $term = $args{term};
    -    my $LSID;
    -    unless ($term =~ /urn\:lsid/){$LSID = $self->getServiceURI($term)} else {$LSID=$term}
    -    return (0, q{Service type $term cannot be resolved to an LSID},"") unless $LSID;
     
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select service_id, service_lsid from service where service_type = ?},undef,$term);
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){
    +        return (0, "can't delete from external ontology", $term);
    +    }
    +
    +    my $LSID;    
    +    unless ($term =~ /^urn:lsid:biomoby.org:servicetype/){$LSID = $self->getServiceURI($term)} else {$LSID=$term}
    +    return (0, q{Service type $term cannot be resolved to an LSID in the MOBY ontologies},"") unless $LSID;
    +
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select service_id, service_lsid from service where service_lsid = ?}, undef, $LSID);
    +
         if (!defined $id){
             return (0, q{Service type $term does not exist in the ontology},$lsid);
         }
    @@ -514,7 +540,11 @@
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
     
         my $sth;
    -    if ($term =~ /^urn\:lsid/){
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){
    +        return (1, "external ontology", $term);
    +    }
    +        
    +    if ($term =~ /^urn:lsid:biomoby.org:namespacetype/){
             $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_lsid = ?");
         } else {
             $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_type = ?");
    @@ -540,10 +570,14 @@
     			#authority => $auth,
     			#contact_email => $email);
         return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'namespace');
    -    return (0, "requires a object type node",'') unless ($args{node});
    +    return (0, "requires a namespace type node",'') unless ($args{node});
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -575,8 +609,12 @@
         my $LSID;
         unless ($term =~ /urn\:lsid/){$LSID = $self->getNamespaceURI($term)} else {$LSID=$term}
         return (0, q{Namespace type $term cannot be resolved to an LSID},"") unless $LSID;
    +
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){
    +        return (0, "cannot delete a term from an external ontology", $term);
    +    }
         
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select namespace_id, namespace_lsid from namespace where namespace_type = ?},undef,$term);
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select namespace_id, namespace_lsid from namespace where namespace_lsid = ?},undef,$LSID);
         unless ($id){return (0, q{Namespace type $term does not exist in the ontology},$lsid)}
     
         # service1_id ISA service2_id?
    @@ -839,7 +877,7 @@
     sub setURI {
         my ($self, $id) = @_;
         my $URI;
    -    $id = lc($id);
    +    # $id = lc($id);
         if ($self->ontology eq 'object'){
             $URI = "urn:lsid:biomoby.org:objectclass:$id"
         } elsif ($self->ontology eq 'namespace'){
    @@ -847,7 +885,7 @@
         } elsif ($self->ontology eq 'service'){
             $URI = "urn:lsid:biomoby.org:servicetype:$id"
         } elsif ($self->ontology eq 'relationship'){
    -        $URI = "urn:lsid:biomoby.org:servicetype:$id"
    +        $URI = "urn:lsid:biomoby.org:relationshiptype:$id"
         } else {
             $URI = 0
         }
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v
    retrieving revision 1.2
    retrieving revision 1.3
    diff -u -r1.2 -r1.3
    --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2003/05/08 15:08:03	1.2
    +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2003/12/02 00:23:23	1.3
    @@ -197,8 +197,8 @@
         if ($self->service_type){
             my $OE = MOBY::OntologyServer->new(ontology => 'service');
             my ($success, $message, $servicetypeURI) = $OE->serviceExists(term => $self->service_type);
    -        unless ($success){return undef}
    -        $self->service_type_uri($servicetypeURI);
    +        unless (($success || (($self->service_type =~ /urn:lsid/i) && !($self->service_type =~ /urn:lsid:biomoby.org/i)))){return undef}
    +        ($self->service_type =~ /urn:lsid/)?$self->service_type_uri($self->service_type):$self->service_type_uri($servicetypeURI);
         }
         
         my ($serviceid, $category, $name, $typeURI, $authid,$url,$email,$authoritative,$desc) = $dbh->selectrow_array( # does this service already exist?
    
    From mwilkinson at pub.open-bio.org  Mon Dec  1 19:57:15 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon Dec  1 19:57:39 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312020057.hB20vFsF021742@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec  1 19:57:15 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv21719/MOBY
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    I just remembered that Martin objected to me calling the non-MOBY services 'soap' services, so I now call them 'wsdl' services.  Also fixed some more documentation errors, and fixed an error in the test suite.
    
    moby-live/Perl/MOBY Central.html,1.10,1.11 Central.pm,1.114,1.115
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v
    retrieving revision 1.10
    retrieving revision 1.11
    diff -u -r1.10 -r1.11
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:23:23	1.10
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:57:15	1.11
    @@ -27,7 +27,6 @@
     		
  • deregisterServiceType
  • registerNamespace
  • deregisterNamespace
  • -
  • retrieveRelationshipTypes
  • registerService
  • registerServiceWSDL
  • deregisterService
  • @@ -301,24 +300,6 @@

    ...Registration Object...

    -

    retrieveRelationshipTypes

    - -

    Input XML :

    -
    -        <deregisterNamespace>
    -           <namespaceType>MyNamespace</namespaceType>
    -        </deregisterNamespace>
    -

    Ouptut XML :

    -

    ...Registration Object...

    -

    -

    registerService

    + category => "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported) + URL => $URL_TO_SERVICE (or URL to WSDL document for wsdl-type services)
         input:      listref; (articleName may be undef) 
                 input =>[
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.63
    retrieving revision 1.64
    diff -u -r1.63 -r1.64
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:23:23	1.63
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:57:15	1.64
    @@ -621,8 +621,8 @@
          authURI      => $authURI,      
          contactEmail => "your@mail.address",      
          description => $human_readable_description, 
    -     category  =>  "moby" | "cgi" | "soap" (currently only moby supported)
    -     URL    =>  $URL_TO_SERVICE
    +     category  =>  "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported)
    +     URL    =>  $URL_TO_SERVICE  (or URL to WSDL document for wsdl-type services)
     
         input:	listref; (articleName may be undef) 
                 input =>[
    @@ -670,8 +670,8 @@
     	my $email = $a{contactEmail}; $email ||="";
     	my $URL = $a{URL}; $URL ||="";
     	my $desc = $a{description}; $desc ||="";
    -	my $Category = lc($a{Category}); $Category ||="moby";
    -	return $self->errorRegXML("Only MOBY Service Categories are currently allowed") unless ($Category eq 'moby');
    +	my $Category = lc($a{category}); chomp $Category; $Category ||="";
    +	return $self->errorRegXML("Only 'moby' and 'wsdl' Service Categories are currently allowed - you gave me $Category") unless (($Category eq 'moby') || ($Category eq 'wsdl'));
     	return $self->errorRegXML("All Fields Required:  serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary") unless (
     		$name && $type && $authURI && $email && $URL && $desc && $Category);
     
    @@ -685,7 +685,7 @@
     			$authURI
     			$email";
     
    -	if ($Category eq "moby") {
    +	if ($Category eq "moby" || $Category eq 'soap') {
     		my %SEC;
     		if ($a{'secondary'} && ref($a{'secondary'} =~ /hash/i)){
     			%SEC = %{$a{secondary}}
    @@ -778,7 +778,7 @@
     		}
     		$message .= "\n";
     		$message .= "";
    -	} else {	return $self->errorRegXML("cannot register services with a client initialized with multiple registries")}
    +	} else {	return $self->errorRegXML("only 'moby' and 'wsdl' service types are allowed to be registered at this time.")}
     
     	#elsif ($Category eq "cgi") {
     	#		my $IN = $a{input}; 
    
    From mwilkinson at pub.open-bio.org  Mon Dec  1 20:08:24 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon Dec  1 20:08:47 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312020108.hB218O1t021842@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec  1 20:08:24 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv21819/Perl/MOBY
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    still calling Collection articles 'Complex' articles.  This is confusing.  It is now consistent thorughout the documentation
    
    moby-live/Perl/MOBY Central.html,1.11,1.12 Central.pm,1.115,1.116
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v
    retrieving revision 1.11
    retrieving revision 1.12
    diff -u -r1.11 -r1.12
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:57:15	1.11
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 01:08:24	1.12
    @@ -304,12 +304,10 @@
     
     
      Input XML :
    @@ -372,13 +378,13 @@
                    human readable COMPREHENSIVE description of your service]]>
              </Description>
              <Input>
    -              <!-- zero or more Primary (Simple and/or Complex) articles -->
    +              <!-- zero or more Primary (Simple and/or Collection) articles -->
              </Input>
              <secondaryArticles>
                   <!-- zero or more INPUT Secondary articles -->
              </secondaryArticles>
              <Output>
    -              <!-- zero or more Primary (Simple and/or Complex) articles --> 
    +              <!-- zero or more Primary (Simple and/or Collection) articles --> 
              </Output>
           </registerService>
    @@ -553,10 +559,10 @@
             <contactEmail>your@email.address</contactEmail>
             <URL>http://endpoint.of.service</URL>;
             <Input>
    -                 <!-- one or more Simple and/or Complex Primary articles -->
    +                 <!-- one or more Simple and/or Collection Primary articles -->
             </Input>
             <Output>
    -                 <!-- one or more Simple and/or Complex Primary articles --> 
    +                 <!-- one or more Simple and/or Collection Primary articles --> 
             </Output>
             <secondaryArticles>
                      <!-- one or more Secondary articles -->
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.115
    retrieving revision 1.116
    diff -u -r1.115 -r1.116
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 00:57:15	1.115
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 01:08:24	1.116
    @@ -905,13 +905,13 @@
                    human readable COMPREHENSIVE description of your service]]>
              
              
    -              
    +              
              
              
                   
              
              
    -               
    +               
              
           
     
    @@ -1019,13 +1019,12 @@
     #  http://URL.to.your/CGI.pl
     #  your.URI.here
     #  
    -#     
    +#     
     #  
     #  
    -#     
    +#     
     #  
     #  
    -#     
     #  
     #  
    @@ -1119,7 +1118,7 @@
         my $dbh = $SVC->dbh;
         return  (-1,'Bad node') unless $node->getNodeType == ELEMENT_NODE;
     
    -    # this is a Simple or a Complex object
    +    # this is a Simple or a Collection object
         my $simp_coll = $node->getTagName;
     	$debug && &_LOG("TAGNAME in $inout _registerArticle is $simp_coll");
     	
    @@ -1431,10 +1430,10 @@
     	your@email.address
     	http://endpoint.of.service
     	
    -		 
    +		 
     	
     	
    -		  
    +		  
     	
     	
     		 
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:06:51 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 16:06:25 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092106.hB9L6pJU028188@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:06:51 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28169/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    added a generic server-side parser to CommonSubs that should basically do all of the work for you and be compatible with the 0.6 API.  Not yet documented; just testing on my own services first.
    
    moby-live/Perl/MOBY CommonSubs.pm,1.28,1.29
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.28
    retrieving revision 1.29
    diff -u -r1.28 -r1.29
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/11/12 16:47:16	1.28
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:06:51	1.29
    @@ -143,9 +143,17 @@
     use XML::DOM;
     use MOBY::CrossReference;
     use MOBY::Client::OntologyServer;
    +use strict;
    +use warnings;
     
    -@ISA = qw(Exporter);
    -@EXPORT_OK = qw(
    +use constant COLLECTION => 1;
    +use constant SIMPLE => 2;
    +use constant BE_NICE => 1;
    +use constant BE_STRICT => 0;
    +
    +our @ISA = qw(Exporter);
    +our @EXPORT = qw(COLLECTION SIMPLE BE_NICE BE_STRICT);
    +our @EXPORT_OK = qw(
         getSimpleArticleIDs
         getSimpleArticleNamespaceURI
         simpleResponse
    @@ -165,8 +173,13 @@
         extractResponseArticles
         getResponseArticles
         getCrossReferences
    +    genericServiceInputParser
    +    COLLECTION
    +    SIMPLE
    +    BE_NICE
    +    BE_STRICT
         );
    -%EXPORT_TAGS =(all => [qw(
    +our %EXPORT_TAGS =(all => [qw(
         getSimpleArticleIDs
         getSimpleArticleNamespaceURI
         simpleResponse
    @@ -186,9 +199,39 @@
         extractResponseArticles
         getResponseArticles
         getCrossReferences
    +    genericServiceInputParser
    +    COLLECTION
    +    SIMPLE
    +    BE_NICE
    +    BE_STRICT
         )]);
     
     
    +
    +sub genericServiceInputParser {
    +    my ($message, $namespaces) = @_;  # get the incoming MOBY query XML
    +    my @inputs;           # set empty response
    +    my @queries = getInputs($message);  # returns XML::DOM nodes
    +    
    +    foreach my $query(@queries){
    +        my $queryID = getInputID($query);  # get the queryID attribute of the queryInput
    +        my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query
    +        foreach my $input(@input_articles){       # input is a listref
    +           my ($articleName, $article) = @{$input}; # get the named article
    +           my $simple = isSimpleArticle($article);  # articles may be simple or collection
    +           my $collection = isCollectionArticle($article);
    +            if ($collection){
    +                my @simples = getCollectedSimples($article);
    +                push @inputs, [COLLECTION,$queryID, \@simples];
    +
    +            } elsif ($simple){
    +                push @inputs, [SIMPLE,$queryID,$simple];
    +            }
    +        }
    +    }
    +    return @inputs;
    +}
    +
     #################################################
     					 ##################################
     					 ##################################
    @@ -482,7 +525,7 @@
     sub getInputs {
     
     	my ($XML) = @_;
    -
    +    my $moby;
         unless (ref($XML) =~ /XML\:\:DOM/){
             my $parser = new XML::DOM::Parser;
             my $doc = $parser->parse($XML);
    @@ -573,7 +616,7 @@
         return undef unless $moby->getNodeType == ELEMENT_NODE;
         return undef unless ($moby->getTagName =~ /queryInput/ || $moby->getTagName =~ /queryResponse/);
         my @articles;
    -    foreach $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +    foreach my $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
             next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
             next unless ($child->getTagName =~ /Simple/ || $child->getTagName =~ /Collection/);
             my $articleName = $child->getAttribute('articleName');
    @@ -608,7 +651,7 @@
         return undef unless ($moby->getTagName =~ /Collection/);
         
         my @articles;
    -    foreach $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +    foreach my $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
             next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
             next unless ($child->getTagName =~ /Simple/);
             push @articles, $child;   # take the child elements, which are  or 
    @@ -667,7 +710,7 @@
         my @queries;
         for (0..$x->getLength-1){ # there may be more than one queryInput per message
     		my @this_query;
    -        foreach $child($x->item($_)->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +        foreach my $child($x->item($_)->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
                 next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
                     push @this_query, $child;   # take the child elements, which are  or 
             }
    @@ -814,7 +857,7 @@
             $nodes = $node->getElementsByTagName("moby:$element");
         }
     	for (0..$nodes->getLength-1){
    -        $child = $nodes->item($_);
    +        my $child = $nodes->item($_);
     		if (
                 (($child->getAttribute("articleName")) && (($child->getAttribute("articleName") eq $articleName)))
                 || (($child->getAttribute("moby:articleName")) && (($child->getAttribute("moby:articleName") eq $articleName)))){
    @@ -859,6 +902,29 @@
     }
     
     
    +
    +
    +=head2 validateThisNamespace
    +
    + name     : validateThisNamespace
    + function : checks a given namespace against a list of valid namespaces
    + usage    : $valid = validateThisNamespace($ns, @validNS);
    + args     : ordered list of the namespace of interest and the list of valid NS's
    + returns  : boolean
    +
    +
    +=cut
    +
    +
    +sub validateThisNamespace {
    +    my ($ns, @namespaces) = @_;
    +    foreach (@namespaces){
    +        return 1 if $ns eq $_;
    +    }
    +    return 0;
    +}
    +
    +
     =head2 getResponseArticles (a.k.a. extractResponseArticles)
     
      name     : getResponseArticles
    @@ -976,7 +1042,7 @@
             }
         }
         foreach (@xrefs){
    -        $x = &_makeXrefType($_) if $_->getTagName =~/Xref/;
    +        my $x = &_makeXrefType($_) if $_->getTagName =~/Xref/;
             $x = &_makeObjectType($_) if $_->getTagName =~ /Object/;
             push @XREFS, $x if $x;
         }
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:06:51 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 16:06:25 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092106.hB9L6phR028208@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:06:51 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28169/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    added a generic server-side parser to CommonSubs that should basically do all of the work for you and be compatible with the 0.6 API.  Not yet documented; just testing on my own services first.
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.36,1.37
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.36
    retrieving revision 1.37
    diff -u -r1.36 -r1.37
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/10/21 14:09:21	1.36
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 21:06:51	1.37
    @@ -8,6 +8,8 @@
     
     use strict;
     use SOAP::Lite;
    +use DBI;
    +use DBD::mysql;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -26,37 +28,27 @@
                                            # last parameter passed to the subroutine
     
     sub getGoTerm {
    +    my ($caller, $message) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($message, []); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my $SOM = pop;  # NOTA BENE!!  You only do this if you have set @ISAQ = qw(SOAP::Server::Parameters) above!!!!!
    -    my ($self, $data) = @_;
    -    my $response = "";
    -	my @accessions;
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'GO');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace GO does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +    my @validNS = validateNamespaces();  # ONLY do this if you are intending to be namespace aware!
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data);
    -	foreach (@input_nodes){
    -		my ($input) = @{$_}; # this service only allows one input per query, so take the first
    -		my $ns = getSimpleArticleNamespaceURI($input);
    -		push @accessions, undef unless $ns eq $VALID_NAMESPACE; # if we have been sent an invalid namespace, then stack an undef as a response
    -		my ($id) = getSimpleArticleIDs($ns, [$input]);
    -		if (defined $id){
    -			push @accessions, $id;
    -		} else {
    -			push @accessions, undef;
    -		}
    +	my @accessions;
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			((push @accessions, undef) && (next)) unless validateThisNamespace($ns, @validNS);
    +			push @accessions, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):1;
    +        }
         }
    -
    -    use DBI;
    -    use DBD::mysql;
         my $dbh = _dbAccess('go');
    -    die "can't connecvt to database\n" unless $dbh;
    +    die "can't connect to GO database\n" unless $dbh;
         my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
         
         foreach my $acc(@accessions){
    @@ -66,20 +58,16 @@
             $sth->execute($acc);        
             my ($term, $def) = $sth->fetchrow_array;
             if ($term){
    -            $response .= simpleResponse("
    +            $MOBY_RESPONSE .= simpleResponse("
                     
                         $term
                         $def
                     ")
             } else {
    -            $response .= simpleResponse("")
    +            $MOBY_RESPONSE .= simpleResponse("")
             }
         }
    -
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    -    
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
     
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:23:24 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 16:22:57 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092123.hB9LNOTl028369@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:23:24 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28350/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    dumb dumb dumb dumb
    
    moby-live/Perl/MOBY CommonSubs.pm,1.29,1.30
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.29
    retrieving revision 1.30
    diff -u -r1.29 -r1.30
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:06:51	1.29
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:23:24	1.30
    @@ -209,7 +209,7 @@
     
     
     sub genericServiceInputParser {
    -    my ($message, $namespaces) = @_;  # get the incoming MOBY query XML
    +    my ($message) = @_;  # get the incoming MOBY query XML
         my @inputs;           # set empty response
         my @queries = getInputs($message);  # returns XML::DOM nodes
         
    @@ -225,7 +225,7 @@
                     push @inputs, [COLLECTION,$queryID, \@simples];
     
                 } elsif ($simple){
    -                push @inputs, [SIMPLE,$queryID,$simple];
    +                push @inputs, [SIMPLE,$queryID,$article];
                 }
             }
         }
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:30:33 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 16:30:05 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092130.hB9LUXWW028465@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:30:33 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28446/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    dumb dumb dumb dumb
    
    moby-live/Perl/MOBY CommonSubs.pm,1.30,1.31
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.30
    retrieving revision 1.31
    diff -u -r1.30 -r1.31
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:23:24	1.30
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:30:33	1.31
    @@ -168,6 +168,7 @@
         extractRawContent
         collectionResponse
         validateNamespaces
    +    validateThisNamespace
         isSimpleArticle
         isCollectionArticle
         extractResponseArticles
    @@ -194,6 +195,7 @@
         extractRawContent
         collectionResponse
         validateNamespaces
    +    validateThisNamespace
         isSimpleArticle
         isCollectionArticle
         extractResponseArticles
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:38:39 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 16:38:11 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092138.hB9LcdU5028578@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:38:39 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28559/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    initialize possibly undef values
    
    moby-live/Perl/MOBY CommonSubs.pm,1.31,1.32
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.31
    retrieving revision 1.32
    diff -u -r1.31 -r1.32
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:30:33	1.31
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:38:39	1.32
    @@ -370,8 +370,12 @@
     
     sub simpleResponse {
         my ($data, $articleName, $qID) = @_;  # articleName optional
    -    $data ||='';
         $qID = &_getQueryID($qID) if ref($qID) =~ /XML::DOM/; # in case they send the DOM instead of the ID
    +
    +    $data ||='';  # initialize to avoid uninit value errors
    +    $qID ||="";
    +    $articleName ||="";
    +    
         if ($articleName) {
             return "
             
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:24:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 17:23:35 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092224.hB9MO3AB028801@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:24:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28763/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    updating my GO services to be 0.6 compliant and a bit more readable
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.37,1.38
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.37
    retrieving revision 1.38
    diff -u -r1.37 -r1.38
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 21:06:51	1.37
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:24:03	1.38
    @@ -10,6 +10,7 @@
     use SOAP::Lite;
     use DBI;
     use DBD::mysql;
    +use GO::AppHandle;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -24,85 +25,60 @@
     #getNodeContentWithArticle
     
     use vars qw(@ISA);
    -@ISA = qw(SOAP::Server::Parameters);   # uncomment this line if you want access to the SOM as the
    -                                       # last parameter passed to the subroutine
     
     sub getGoTerm {
         my ($caller, $message) = @_;
         my $MOBY_RESPONSE;
    -    my (@inputs)= genericServiceInputParser($message, []); # ([SIMPLE, $queryID, $simple],...)
    +    my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...)
         return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my @validNS = validateNamespaces();  # ONLY do this if you are intending to be namespace aware!
    +    my @validNS = validateNamespaces("GO");  # ONLY do this if you are intending to be namespace aware!
    +
    +    my $dbh = _dbAccess('go');
    +    die "can't connect to GO database\n" unless $dbh;
    +    my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
     
    -	my @accessions;
         foreach (@inputs){
             my ($articleType, $ID, $input) = @{$_};
             unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $ID) ;
    +            $MOBY_RESPONSE .= simpleResponse("", "Collection_Article_Not_allowed_as_input", $ID);
                 next;
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
    -			((push @accessions, undef) && (next)) unless validateThisNamespace($ns, @validNS);
    -			push @accessions, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):1;
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $accession = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			unless (defined($accession)){
    +				$MOBY_RESPONSE .= simpleResponse("", "Invalid_Accession", $ID);
    +				next;
    +			}
    +			unless ($accession =~/^GO:/){
    +				$accession = "GO:$accession";  # we still haven't decided on whether id's should include the prefix...
    +			}
    +			$sth->execute($accession);        
    +			my ($term, $def) = $sth->fetchrow_array;
    +			if ($term){
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						$term
    +						$def
    +					", "GO_Term_From_ID", $ID)
    +			} else {
    +				$MOBY_RESPONSE .= simpleResponse("", "NO_Term_Found", $ID)
    +			}
             }
         }
    -    my $dbh = _dbAccess('go');
    -    die "can't connect to GO database\n" unless $dbh;
    -    my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
         
    -    foreach my $acc(@accessions){
    -		unless ($acc =~/^GO:/){
    -			$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    -		}
    -        $sth->execute($acc);        
    -        my ($term, $def) = $sth->fetchrow_array;
    -        if ($term){
    -            $MOBY_RESPONSE .= simpleResponse("
    -                
    -                    $term
    -                    $def
    -                ")
    -        } else {
    -            $MOBY_RESPONSE .= simpleResponse("")
    -        }
    -    }
         return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
    -
     sub getGoTermAssociations {
    +    my ($caller, $message) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my $SOM = pop;  
    -    my ($self, $data) = @_;
    -    my $response = "";
    -	my @accessions;
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'GO');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace GO does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data);
    -	foreach (@input_nodes){
    -		my ($input) = @{$_}; # this service only allows one input per query, so take the first
    -		my $ns = getSimpleArticleNamespaceURI($input);
    -		push @accessions, undef unless $ns eq $VALID_NAMESPACE; # if we have been sent an invalid namespace, then stack an undef as a response
    -		my ($id) = getSimpleArticleIDs($ns, [$input]);
    -		if (defined $id){
    -			push @accessions, $id;
    -		} else {
    -			push @accessions, undef;
    -		}
    -    }
    -
    -    use DBI;
    -    use DBD::mysql;
         my $dbh = _dbAccess('go');
    -    die "can't connecvt to database\n" unless $dbh;
    +    die "can't connect to database\n" unless $dbh;
         my $sth = $dbh->prepare("
     		select
     			gp.symbol,
    @@ -125,27 +101,39 @@
     		and a.is_not = 0
     		and t.id = d.term_id 
     		order by species_id");
    -							
    -    foreach my $acc(@accessions){
    -		unless ($acc =~/^GO:/){
    -			$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    -		}
    -		my @simples;
    -        $sth->execute($acc);
    -        while (my ($symb, $sp, $namsp, $type, $name, $def) = $sth->fetchrow_array){
    -            my $response_data .= "\n";
    -			$response_data .= "	\n";
    -			$response_data .= "		\n";
    -			$response_data .= "		\n";
    -            $response_data .= "	\n";
    -            $response_data .= "\n";
    -			push @simples, $response_data;
    +
    +    my @validNS = validateNamespaces("GO");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= collectionResponse([], "Collection_Article_Input_Invalid", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= $MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $acc, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			unless (defined($acc)){
    +				$MOBY_RESPONSE .= collectionResponse([], "Invalid_Accession", $ID);
    +				next;
    +			}
    +			unless ($acc =~/^GO:/){
    +				$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    +			}
    +			my @simples;
    +			$sth->execute($acc);
    +			while (my ($symb, $sp, $namsp, $type, $name, $def) = $sth->fetchrow_array){
    +				my $response_data .= "\n";
    +				$response_data .= "	\n";
    +				$response_data .= "		\n";
    +				$response_data .= "	\n";
    +				$response_data .= "\n";
    +				push @simples, $response_data;
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples,"Known_GO_Term_Associations",$ID); # after all images have been collected, create the collection
             }
    -		$response .= collectionResponse(\@simples); # after all images have been collected, create the collection
         }
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
         
     }
     
    @@ -153,67 +141,51 @@
     sub RetrieveGOFromKeywords {
     	my $SOM = pop; 	
     	my ($self, $query) = @_;
    -	use GO::AppHandle;
    -
    -	my $ua = new LWP::UserAgent;
    -	my $req = new HTTP::Request GET => 'http://www.godatabase.org/dev/database/server.cfg';
    -	my $res = $ua->request($req);
    +	# INITIALIZE CONNECTION TO GO DB
     	my $host; my $dbname;
     	$host = "sin.lbl.gov";
     	$dbname = "go";
    -#	if ($res->is_success) {
    -	#	my $resp =  $res->content;
    -	#	if ($resp =~ /(\w+)\@(\S+)/){
    -	#		$host = $2;
    -	#		$dbname= $1;
    -	#	} else {
    -	#		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	#	}
    -	#}
     	my %connect_hash;
     	$connect_hash{-dbname}=$dbname;
     	$connect_hash{-dbhost}=$host;
    -	
     	my $GO_API = GO::AppHandle->connect(%connect_hash);
     	unless ($GO_API){
     		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
     	}
    +	# DB is now initialized
     	
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'Global_Keyword');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace Global_Keyword does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($query); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($query); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my $response;
    -	foreach (@input_nodes){
    -		my $input =  $_->[0];  # we only allow one input object per query
    -		my ($kw) = getSimpleArticleIDs($VALID_NAMESPACE, [$input]);
    -		($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
    -		my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    -		next unless($terms[0]);
    -		my @simples;
    -		foreach my $term(@terms){
    -			my $acc = $term->public_acc;
    -			my $def = $term->definition;
    -			my $name = $term->name;
    -            push @simples, "
    -                    
    -						
    -					
    -                    $name
    -                    $def
    -                ";
    +    my @validNS = validateNamespaces("Global_Keyword");  # ONLY do this if you are intending to be namespace aware!
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= collectionResponse([], "Collection_Input_Invalid", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $kw = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +            ($MOBY_RESPONSE .= collectionResponse([], "No_Keyword", $ID) && (next)) unless defined $kw;
    +			($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
    +			my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    +			next unless($terms[0]);
    +			my @simples;
    +			foreach my $term(@terms){
    +				my $acc = $term->public_acc;
    +				my $def = $term->definition;
    +				my $name = $term->name;
    +				push @simples, "
    +						$name
    +						$def
    +					";
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples, "GO_terms_from_keywords", $ID);
     		}
    -		$response .= collectionResponse(\@simples);
    -	}
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse	
    +    }
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
     
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:24:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 17:23:36 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092224.hB9MO30d028782@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:24:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28763/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    updating my GO services to be 0.6 compliant and a bit more readable
    
    moby-live/Perl/MOBY CommonSubs.pm,1.32,1.33
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.32
    retrieving revision 1.33
    diff -u -r1.32 -r1.33
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:38:39	1.32
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 22:24:03	1.33
    @@ -248,16 +248,16 @@
      function : to get the IDs of simple articles that are in the given namespace
      usage    : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles);
      args     : (in order)
    -            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology
    +            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
                 \@Simples   - (required) a listref of Simple XML::DOM nodes
                               i.e. the XML::DOM representing an XML structure like this:
                                   
                                       
                                   
    - note     : it will return *only* the ids that are in the given namespace
    + note     : it will return *only* the ids that are in the given namespace, if you provide one
                 but since you are required to return an output for every input
                 (even if it is invalid) this routine will return undef for
    -            those articles that are not in that namespace
    +            those articles in the list that are not in that namespace so you can keep track
     
     =cut
     
    @@ -271,45 +271,52 @@
     	my @input_nodes = @{$input_nodes};
     	my $OS = MOBY::Client::OntologyServer->new;
     	my ($s, $m);
    -	($s, $m, $desired_namespace) = $OS->namespaceExists(term => $desired_namespace); # returns (success, message, lsid)
    -	return undef unless $s;  # bail if not successful
    +    if ($desired_namespace){
    +        ($s, $m, $desired_namespace) = $OS->namespaceExists(term => $desired_namespace); # returns (success, message, lsid)
    +    	unless ($s){  # bail if not successful
    +            print STDERR "MOBY::CommonSubs WARNING ** the namespace $desired_namespace does not exist in the MOBY ontology, and is not a valid LSID\n";
    +            return undef;
    +    	}
    +    }
     
    -	my @accessions;	
    +	my @ids;	
     	foreach my $in(@input_nodes){
     		#$in = ""
             next unless $in->getNodeName =~ /simple/i;  # only allow simples
     		my @simples = $in->getChildNodes;
     		foreach (@simples){ # $_ = 
     			next unless $_->getNodeType == ELEMENT_NODE;
    -			my $ns = $_->getAttributeNode('namespace');  # get the namespace DOM node
    -			$ns = $_->getAttributeNode('moby:namespace') unless ($ns);  # perhaps it is namespaced...
    -			unless ($ns){   # if we don't get it at all, then move on to the next input
    -				push @accessions, undef;  # but push an undef onto teh stack in order
    -				next;
    -			}
    -			$ns = $ns->getValue;   # if we have a namespace, then get its value
    -			($s, $m, $ns) = $OS->namespaceExists(term => $ns);
    -			
    -			unless ($ns eq $desired_namespace){  # we are registering as working in a particular namespace, so check this
    -				push @accessions, undef;  # and push undef onto the stack if it isn't 
    -				next;
    +			if ($desired_namespace){
    +                my $ns = $_->getAttributeNode('namespace');  # get the namespace DOM node
    +                $ns = $_->getAttributeNode('moby:namespace') unless ($ns);  # perhaps it is namespaced...
    +                unless ($ns){   # if we don't get it at all, then move on to the next input
    +                    push @ids, undef;  # but push an undef onto teh stack in order
    +                    next;
    +                }
    +                $ns = $ns->getValue;   # if we have a namespace, then get its value
    +                ($s, $m, $ns) = $OS->namespaceExists(term => $ns);
    +                
    +                unless ($ns eq $desired_namespace){  # we are registering as working in a particular namespace, so check this
    +                    push @ids, undef;  # and push undef onto the stack if it isn't 
    +                    next;
    +                }
     			}
     			# Now do the same thing for ID's
     			my $id = $_->getAttributeNode('id');
     			$id = $_->getAttributeNode('moby:id') unless ($id);
     			unless ($id){
    -				push @accessions, undef;
    +				push @ids, undef;
     				next;
     			}
     			$id = $id->getValue;
     			unless (defined $id){  # it has to have a hope in hell of retrieving something...
    -				push @accessions, undef;  # otherwise push undef onto the stack if it isn't 
    +				push @ids, undef;  # otherwise push undef onto the stack if it isn't 
     				next;
     			}
    -			push @accessions, $id;
    +			push @ids, $id;
     		}
     	}
    -	return @accessions;
    +	return @ids;
     }
     
     
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:47:16 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 17:46:49 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092247.hB9MlGoI028900@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:47:16 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28881/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    dumb.  I was picking up the results of the XML parse as a scalar instead of a list
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.38,1.39
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.38
    retrieving revision 1.39
    diff -u -r1.38 -r1.39
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:24:03	1.38
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:47:16	1.39
    @@ -46,7 +46,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $accession = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
     			unless (defined($accession)){
     				$MOBY_RESPONSE .= simpleResponse("", "Invalid_Accession", $ID);
     				next;
    @@ -112,7 +112,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= $MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $acc, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
     			unless (defined($acc)){
     				$MOBY_RESPONSE .= collectionResponse([], "Invalid_Accession", $ID);
     				next;
    @@ -167,7 +167,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $kw = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($kw) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
                 ($MOBY_RESPONSE .= collectionResponse([], "No_Keyword", $ID) && (next)) unless defined $kw;
     			($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
     			my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:56:19 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec  9 17:55:50 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092256.hB9MuJrE028986@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:56:19 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28967/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    eek, I broke all my services.  I am no longer poping the SOM off the end of the argument list, since I never use it.  They should all kick back into life now
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.39,1.40
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.39
    retrieving revision 1.40
    diff -u -r1.39 -r1.40
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:47:16	1.39
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:56:19	1.40
    @@ -202,7 +202,6 @@
     #  =        namespace                            =
     #  ===============================================
     sub GenbankAccVirtualSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -246,7 +245,6 @@
         return $SOAPResponse
     }
     sub GenbankAccSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -291,7 +289,6 @@
         return $SOAPResponse   
     }
     sub GenbankGIVirtualSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -336,7 +333,6 @@
     }
     
     sub GenbankGISequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -389,7 +385,7 @@
     # and producing GenericSequence objects.  However, it will
     # actually produce DNA, RNA or PRotein objects, as appropriate
     # and will produce a cross-reference block as well
    -    my $SOM = pop;  
    +
         my ($self, $data) = @_;
         my $response; my @gis;
     
    @@ -476,7 +472,6 @@
     sub GenbankRecordRetrieve {
     	use Bio::SeqIO;
     	use IO::String;
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; # prepare a variable to hold the responses
     
    @@ -548,7 +543,7 @@
     #################################################
     
     sub getDragonMutantImages {
    -	my $SOM = pop;  
    +
         my ($self, $data) = @_;
     	use Ace;
     	use LWP::UserAgent;
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:22:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed Dec 10 17:21:28 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102222.hBAMM3QV032633@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:22:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv32614/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    minor changes to make some CommonSubs more friendly.  Also added a new service which is the beginning of me weaning myself off of GenBank because genbank is broken almost every time I need to use it.  The new service uses SeqHound to make the data lookups, so it is always 24 hours behind the real genbank, but thats not bad.  The new service consumes NCBI_Acc, NCBI_gi, PIR, Swissprot, EMBL, or PDB identifiers and returns the genbank record as a flatfile
    
    moby-live/Perl/MOBY CommonSubs.pm,1.33,1.34
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.33
    retrieving revision 1.34
    diff -u -r1.33 -r1.34
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 22:24:03	1.33
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/10 22:22:03	1.34
    @@ -247,24 +247,29 @@
      name     : getSimpleArticleIDs
      function : to get the IDs of simple articles that are in the given namespace
      usage    : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles);
    - args     : (in order)
    -            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
    +            my @ids = getSimpleArticleIDs(\@SimpleArticles);
    + args     : $Namespace  - (optional) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
                 \@Simples   - (required) a listref of Simple XML::DOM nodes
                               i.e. the XML::DOM representing an XML structure like this:
                                   
                                       
                                   
    - note     : it will return *only* the ids that are in the given namespace, if you provide one
    -            but since you are required to return an output for every input
    -            (even if it is invalid) this routine will return undef for
    -            those articles in the list that are not in that namespace so you can keep track
    + note     : If you provide a namespace, it will return *only* the ids that are in the given namespace,
    +            but will return 'undef' for any articles in the WRONG namespace so that you get an
    +            equivalent number of outputs to inputs.
    +            
    +            Note that if you call this with a single argument, this is assumed to
    +            be \@Articles, so you will get ALL id's regardless of namespace!
     
     =cut
     
     
     sub getSimpleArticleIDs {
     	my ($desired_namespace, $input_nodes) = @_;
    -	return undef unless $input_nodes;
    +	if ($desired_namespace && !($input_nodes)){  # if called with ONE argument, then these are the input nodes!
    +        $input_nodes = $desired_namespace;
    +        $desired_namespace = undef;   
    +	}
         $input_nodes = [$input_nodes] unless ref($input_nodes) =~ /ARRAY/; # be flexible!
     	return undef unless scalar @{$input_nodes};
     
    @@ -281,6 +286,7 @@
     
     	my @ids;	
     	foreach my $in(@input_nodes){
    +        next unless $in;
     		#$in = ""
             next unless $in->getNodeName =~ /simple/i;  # only allow simples
     		my @simples = $in->getChildNodes;
    @@ -932,6 +938,7 @@
     sub validateThisNamespace {
         my ($ns, @namespaces) = @_;
         foreach (@namespaces){
    +        next unless $_;
             return 1 if $ns eq $_;
         }
         return 0;
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:22:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed Dec 10 17:21:31 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102222.hBAMM3Ul032652@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:22:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv32614/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    minor changes to make some CommonSubs more friendly.  Also added a new service which is the beginning of me weaning myself off of GenBank because genbank is broken almost every time I need to use it.  The new service uses SeqHound to make the data lookups, so it is always 24 hours behind the real genbank, but thats not bad.  The new service consumes NCBI_Acc, NCBI_gi, PIR, Swissprot, EMBL, or PDB identifiers and returns the genbank record as a flatfile
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.40,1.41
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.40
    retrieving revision 1.41
    diff -u -r1.40 -r1.41
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:56:19	1.40
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:22:03	1.41
    @@ -7,6 +7,7 @@
     use lib "/export/home/root/BIOPERL/perl-api";
     
     use strict;
    +use SeqHound;
     use SOAP::Lite;
     use DBI;
     use DBD::mysql;
    @@ -23,6 +24,7 @@
     #responseFooter
     #getInputArticles
     #getNodeContentWithArticle
    +my $debug = 1;
     
     use vars qw(@ISA);
     
    @@ -201,49 +203,126 @@
     #  =        having a single service for each     =
     #  =        namespace                            =
     #  ===============================================
    -sub GenbankAccVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
     
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_Acc');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +sub _generic_service_template {
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +			# do your thing here!
    +        }
    +    }
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +}
    +
    +sub MOBYSHoundGetGenBankff {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
     	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc (@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetGenBankff($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "";
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "
    +					
    +						
    +					
    +					";
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "
    +					
    +						
    +					
    +					";
    +			}
     		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_acc($acc);
    -		my $length;
    -		if ($seq){$length = $seq->length;}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +}
    +
    +sub GenbankAccVirtualSequenceRetrieve {
    +    my ($self, $data) = @_;
    +
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +			(($MOBY_RESPONSE .= simpleResponse("", "no_input_object", $qID)) && (next)) unless (defined $input);
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse([], "Invalid_Namespace", $qID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +            ($MOBY_RESPONSE .= collectionResponse([], "No_Accession_provided", $qID) && (next)) unless defined $acc;
    +			use Bio::DB::GenBank;
    +			my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    +			my $seq = $gb->get_Seq_by_acc($acc);
    +			my $length;
    +			if ($seq){$length = $seq->length;}
    +			if ($length){
    +				$MOBY_RESPONSE .= simpleResponse("
    +			
    +				$length
    +			", "", $qID);
    +			} else {
    +				$MOBY_RESPONSE .= simpleResponse("", "sequence_has_no_length", $qID);
    +			}
     		}
     	}
    -		
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
    +
     sub GenbankAccSequenceRetrieve {
         my ($self, $data) = @_;
         my $response; my @accessions;
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:34:36 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed Dec 10 17:34:02 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102234.hBAMYaZc032738@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:34:36 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv32719/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    small changes to service output
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.41,1.42
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.41
    retrieving revision 1.42
    diff -u -r1.41 -r1.42
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:22:03	1.41
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:34:36	1.42
    @@ -70,7 +70,7 @@
             }
         }
         
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub getGoTermAssociations {
    @@ -135,7 +135,7 @@
     			$MOBY_RESPONSE .= collectionResponse(\@simples,"Known_GO_Term_Associations",$ID); # after all images have been collected, create the collection
             }
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
         
     }
     
    @@ -187,7 +187,7 @@
     			$MOBY_RESPONSE .= collectionResponse(\@simples, "GO_terms_from_keywords", $ID);
     		}
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     
    @@ -223,7 +223,7 @@
     			# do your thing here!
             }
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub MOBYSHoundGetGenBankff {
    @@ -281,8 +281,8 @@
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +	#print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub GenbankAccVirtualSequenceRetrieve {
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:40:57 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed Dec 10 17:40:23 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102240.hBAMevNm000374@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:40:56 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv355/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    Doh.  Use the output format you dummy
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.42,1.43
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.42
    retrieving revision 1.43
    diff -u -r1.42 -r1.43
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:34:36	1.42
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:40:56	1.43
    @@ -262,21 +262,23 @@
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					";
    +					",
    +					"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					";
    +					",
    +					"", $qID);
     			}
     		}
         }
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:45:12 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed Dec 10 17:44:36 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102245.hBAMjCKF000512@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:45:12 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv493/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    missed one
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.43,1.44
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.43
    retrieving revision 1.44
    diff -u -r1.43 -r1.44
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:40:56	1.43
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:45:11	1.44
    @@ -256,7 +256,7 @@
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my $gb = SHoundGetGenBankff($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "";
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 10:36:38 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu Dec 11 10:36:03 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111536.hBBFac9j003421@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 10:36:38 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv3402/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    the last of the Sequence services complete.  We now return genbank flatfiles, fasta, Virtual, DNA, RNA, AA sequence objects for gi's, gb accessions, PDB, embl (embl doesn't work at the moment for unknown reasons), SP, and PIR.  These services should be sufficient for me to de-register the services that are currently depending on genbank via bioperl.  Unfortunately, genbank is sufficiently unreliable that I am embarrassed to build services that use their interfaces because as often as not they don't work...
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.44,1.45
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.44
    retrieving revision 1.45
    diff -u -r1.44 -r1.45
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:45:11	1.44
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 15:36:38	1.45
    @@ -12,6 +12,7 @@
     use DBI;
     use DBD::mysql;
     use GO::AppHandle;
    +use IO::String;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -28,6 +29,46 @@
     
     use vars qw(@ISA);
     
    +##################################################
    +##################################################
    +#  ALL BROWSERS PLEASE NOTE!!
    +#  Most of the subroutines in this module use the
    +#  following basic template for service
    +#  provision.  They add a few more lines to do
    +#  error_checking and validations, but generally
    +#  speaking the few lines below are all
    +#  that a service requires :-)
    +##################################################
    +##################################################
    +
    +sub _generic_service_template {
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +			# do your thing here!
    +        }
    +    }
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +##################################################
    +##################################################
    +##################################################
    +##################################################
    +
    +
     sub getGoTerm {
         my ($caller, $message) = @_;
         my $MOBY_RESPONSE;
    @@ -204,29 +245,79 @@
     #  =        namespace                            =
     #  ===============================================
     
    -sub _generic_service_template {
    +
    +sub MOBYSHoundGetGenBankff {
         my ($caller, $data) = @_;
    -    my $MOBY_RESPONSE;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
         return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
     
         foreach (@inputs){
             my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
                 next;
             } else {
    -            my $namespace = getSimpleArticleNamespaceURI($input);
    -			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    -			# do your thing here!
    -        }
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetGenBankff($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					",
    +					"", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					",
    +					"", $qID);
    +			}
    +		}
         }
    +	$aa = SHoundFini();
    +	#print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    -sub MOBYSHoundGetGenBankff {
    +sub _makeSeqObj {
    +	my ($id) = @_;
    +	my $gb = SHoundGetGenBankff($id);
    +	return undef unless $gb;
    +	my $gbio = IO::String->new($gb);
    +	my $sio = Bio::SeqIO->new(-fh => \*$gbio, '-format' => 'genbank');
    +	my $seq = $sio->next_seq;
    +	return ($seq, $seq->length, $seq->seq);	
    +}
    +
    +sub MOBYSHoundGetGenBankVirtSequence {
         my ($caller, $data) = @_;
     	my $MOBY_RESPONSE;
     	
    @@ -254,30 +345,167 @@
     			my ($identifier) = getSimpleArticleIDs($input);
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    -				my $gb = SHoundGetGenBankff($identifier);
    +				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +												 ".($SEQ->length)."
    +												 ", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					".($SEQ->length)."
    +					",
    +					"", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					".($SEQ->length)."
    +					",
    +					"", $qID);
    +			}
    +		}
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub MOBYSHoundGetGenBankWhateverSequence {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my %objtype = ('dna', "DNASequence", 'rna', "RNASequence", 'protein', "AminoAcidSequence");
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +				my $objType = $objtype{$SEQ->alphabet};
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$identifier'>
    +												 ".($SEQ->length)."
    +												 ".($SEQ->seq)."
    +												 ", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my $objType = $objtype{$SEQ->alphabet};
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    +					
    +						
    +					
    +					 ".($SEQ->length)."
    +					 ".($SEQ->seq)."
    +					 ", "", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my $objType = $objtype{$SEQ->alphabet};
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    +					
    +						
    +					
    +					 ".($SEQ->length)."
    +					 ".($SEQ->seq)."
    +					 ", "", $qID);
    +			}
    +		}
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub MOBYSHoundGetGenBankFasta {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetFasta($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    -				my $gb = SHoundGetGenBankff($gi);
    +				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					",
    +					",
     					"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    -				my $gb = SHoundGetGenBankff($gi);
    +				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					",
    +					",
     					"", $qID);
     			}
     		}
    @@ -287,6 +515,7 @@
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    +
     sub GenbankAccVirtualSequenceRetrieve {
         my ($self, $data) = @_;
     
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 13:08:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu Dec 11 13:07:35 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111808.hBBI8EdB004309@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:08:14 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts
    In directory pub.open-bio.org:/tmp/cvs-serv4290
    
    Modified Files:
    	MOBY-Client05.cgi 
    Log Message:
    added Xrefs to my new services.  Small change in the client program to improve readability
    
    moby-live/Perl/scripts MOBY-Client05.cgi,1.25,1.26
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi,v
    retrieving revision 1.25
    retrieving revision 1.26
    diff -u -r1.25 -r1.26
    --- /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/11/06 16:42:41	1.25
    +++ /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/12/11 18:08:14	1.26
    @@ -1,6 +1,6 @@
     #!/usr/bin/perl -w
     use strict;
    -use lib '/usr/local/apache/cgi-bin/MOBY05';
    +use lib '/usr/local/apache/cgi-bin/BIO/moby-live/Perl';
     
     use MOBY::Client::Central;
     use MOBY::Client::Service;
    @@ -466,11 +466,15 @@
                 my $output = "(";
                 foreach my $param(@{$objs}){
                     if ($param->isSimple){
    -                    $output .= "Simple:".($param->objectType)." ,";
    +                    my $type = (($param->objectType =~ /\:(\S+)$/) && $1);
    +                    $type = $param->objectType unless $type;
    +                    $output .= "Simple: $type ,";
                     } else {
                         $output .= "Collection:[";
                         foreach my $simp(@{$param->Simples}){
    -                        $output .= ($simp->objectType).",";
    +                        my $type = (($simp->objectType =~ /\:(\S+)$/) && $1);
    +                        $type = $simp->objectType unless $type;
    +                        $output .= "$type,";
                         }
                         chop $output;
                         $output .="],";
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 13:08:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu Dec 11 13:07:39 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111808.hBBI8EFh004328@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:08:14 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv4290/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    added Xrefs to my new services.  Small change in the client program to improve readability
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.45,1.46
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.45
    retrieving revision 1.46
    diff -u -r1.45 -r1.46
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 15:36:38	1.45
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:08:14	1.46
    @@ -9,6 +9,7 @@
     use strict;
     use SeqHound;
     use SOAP::Lite;
    +use Bio::SeqIO;
     use DBI;
     use DBD::mysql;
     use GO::AppHandle;
    @@ -317,6 +318,16 @@
     	return ($seq, $seq->length, $seq->seq);	
     }
     
    +sub _getXrefs {
    +	my ($seq) = @_;  # bioperl seq object
    +	#my $gi = $seq->primary_id;		  # e.g. 163483
    +	#print STDERR "\n\n*********************$ gi\n\n";
    +	my $acc = $seq->accession;        # e.g. A123434
    +	my $kw = $seq->species->binomial; # e.g. mus musculus
    +	my $taxon = $seq->species->ncbi_taxid;  # e.g. 1234
    +	return ($acc, $kw, $taxon);
    +}		
    +
     sub MOBYSHoundGetGenBankVirtSequence {
         my ($caller, $data) = @_;
     	my $MOBY_RESPONSE;
    @@ -346,39 +357,53 @@
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    -	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -												 ".($SEQ->length)."
    -												 ", "", $qID);
    +
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="\n".($SEQ->length)."
    +												 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -					
    -						
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
    -					".($SEQ->length)."
    -					",
    -					"", $qID);
    +					 ".($SEQ->length)."
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -					
    -						
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
    -					".($SEQ->length)."
    -					",
    -					"", $qID);
    +					 ".($SEQ->length)."
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			}
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +#	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    @@ -413,43 +438,59 @@
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$identifier'>
    -												 ".($SEQ->length)."
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="\n".($SEQ->length)."
     												 ".($SEQ->seq)."
    -												 ", "", $qID);
    +												 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    -					
    -						
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
    -					 ", "", $qID);
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    -					
    -						
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
    -					 ", "", $qID);
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			}
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +#	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    @@ -516,335 +557,6 @@
     }
     
     
    -sub GenbankAccVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -
    -    my $MOBY_RESPONSE;
    -    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    -    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    -
    -    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    -
    -    foreach (@inputs){
    -        my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    -            next;
    -        } else {
    -			(($MOBY_RESPONSE .= simpleResponse("", "no_input_object", $qID)) && (next)) unless (defined $input);
    -			my $ns = getSimpleArticleNamespaceURI($input);
    -			(($MOBY_RESPONSE .= simpleResponse([], "Invalid_Namespace", $qID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    -            ($MOBY_RESPONSE .= collectionResponse([], "No_Accession_provided", $qID) && (next)) unless defined $acc;
    -			use Bio::DB::GenBank;
    -			my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -			my $seq = $gb->get_Seq_by_acc($acc);
    -			my $length;
    -			if ($seq){$length = $seq->length;}
    -			if ($length){
    -				$MOBY_RESPONSE .= simpleResponse("
    -			
    -				$length
    -			", "", $qID);
    -			} else {
    -				$MOBY_RESPONSE .= simpleResponse("", "sequence_has_no_length", $qID);
    -			}
    -		}
    -	}
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    -}
    -
    -sub GenbankAccSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_Acc');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_acc($acc);
    -		my $length;my $sequence;
    -		if ($seq){$length = $seq->length;$sequence = $seq->seq}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -			$sequence
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -	
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse   
    -}
    -sub GenbankGIVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_gi');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_gi($acc);
    -		my $length;
    -		if ($seq){$length = $seq->length;}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -	
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse   
    -}
    -
    -sub GenbankGISequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_gi');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_gi($acc);  # get the sequence object for each gi
    -		my $length;my $sequence;
    -		if ($seq){$length = $seq->length;$sequence = $seq->seq}  # if it exists, get the length and sequence
    -		if ($length){  # and construct the response
    -			$response .= simpleResponse("
    -		
    -			$length
    -			$sequence
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse;
    -}
    -#=================================================
    -#=================================================
    -#=================================================
    -
    -sub GenbankCompleteSequenceRetrieve {
    -
    -# this service is registered as consuming NCBI_Acc OR NCBI_gi
    -# and producing GenericSequence objects.  However, it will
    -# actually produce DNA, RNA or PRotein objects, as appropriate
    -# and will produce a cross-reference block as well
    -
    -    my ($self, $data) = @_;
    -    my $response; my @gis;
    -
    -	my ($GB_Acc_LSID, $GB_gi_LSID) = validateNamespaces('NCBI_Acc', 'NCBI_gi');
    -	unless ($GB_Acc_LSID && $GB_gi_LSID){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc or NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -	
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	foreach my $node(@inputs){
    - 
    -		my $namespace_LSID = getSimpleArticleNamespaceURI($node);  # get the LSID of the namespace for this input object
    -		unless (($namespace_LSID eq $GB_Acc_LSID) || ($namespace_LSID eq $GB_gi_LSID)){ # validate the namespace
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if bad namespace
    -			next;
    -		}
    -			
    -		my ($ID)= getSimpleArticleIDs($namespace_LSID, [$node]);  # get the ID within this namespace
    -		unless (defined $ID){  # send a blank if we failed to get an id, 
    -			$response .= simpleResponse("");  # because we have to send one response per input
    -			next;
    -		}
    -
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');  # now that we have a namespace and ID, we are ready to retrieve
    -		my $seq;
    -		if ($namespace_LSID eq $GB_Acc_LSID){  # if the namespace is a genbank Accession thebn
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the accession
    -		} elsif ($namespace_LSID  eq $GB_gi_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_gi($ID);  # get the sequence object for the gi
    -		} else {
    -			$response .= simpleResponse("");  # if it is neither,then send a blank as required by the API
    -			next;
    -		}
    -			
    -		my $length;my $sequence;
    -		if ($seq){
    -			$length = $seq->length;$sequence = $seq->seq;  # if it exists, get the length and sequence
    -		} else {
    -			$response .= simpleResponse("");  # if we got nada, then send a blank as required
    -			next;
    -		}
    -
    -		my $gi = $seq->primary_id;		  # e.g. 163483
    -		my $acc = $seq->accession;        # e.g. A123434
    -		my $kw = $seq->species->binomial; # e.g. mus musculus
    -		my $moltype = $seq->alphabet;     #  'dna', 'rna', 'protein'
    -		my $taxon = $seq->species->ncbi_taxid;  # e.g. 1234
    -		
    -		my $ObjectType="GenericSequence";           # set it as the generic as default
    -		if ($moltype eq 'dna'){$ObjectType = "DNASequence"}  # set to DNA
    -		elsif ($moltype eq 'rna'){$ObjectType = "RNASequence"} # set to RNA
    -		elsif ($moltype eq 'protein'){$ObjectType = "AminoAcidSequence"}  # set to Protein
    -		
    -		if ($length){  # and construct the response; luckily, all of these objects have exactly the same structure :-)
    -			my $tempresponse .= "
    -		
    -			";
    -			if ($taxon){ $tempresponse .=""}
    -			if ($kw){$tempresponse .=""}
    -			if ($acc && !($namespace_LSID eq $GB_Acc_LSID)){$tempresponse .=""}
    -			if ($gi && !($namespace_LSID eq $GB_gi_LSID)){$tempresponse .=""}
    -			$tempresponse .="
    -			$length
    -			$sequence
    -		";
    -			$response .= simpleResponse($tempresponse);
    -		} else {
    -			$response .= simpleResponse("");  # if we failed to get a sequence length, then something weird happened, so just ignore it
    -		}
    -	}
    -    my $fullresponse =  responseHeader() . $response . responseFooter();  # add the headers and footers
    -    my $SOAPResponse = SOAP::Data->type('base64' => $fullresponse);  # base 64 encode it (optional)
    -    return $SOAPResponse;	
    -}
    -
    -
    -sub GenbankRecordRetrieve {
    -	use Bio::SeqIO;
    -	use IO::String;
    -    my ($self, $data) = @_;
    -    my $response; # prepare a variable to hold the responses
    -
    -	# Step 1 - validate the namespaces you plan to accept as input
    -	my ($GB_Acc_LSID, $GB_gi_LSID, $EMBL_LSID) = validateNamespaces('NCBI_Acc', 'NCBI_gi', 'EMBL');
    -	unless ($GB_Acc_LSID && $GB_gi_LSID && $EMBL_LSID){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc, NCBI_gi, or EMBL_LSID that we are expecting does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# Step 2 - get your input objects
    -	# in this case, we have registered as accepting
    -	# only simple inputs (not collections), therefore
    -	# we can insist on that constraint.
    -	my @inputs = getInputArticles($data); # returns ([SimpleDOM], [SimpleDOM],...), each represents a unique query input
    -	foreach my $node(@inputs){
    -		# do a bit of simple validation
    -		# the next 12 lines or so are ~cut-n-paste for every service
    -		unless (isSimpleArticle($node)){ 		# we only allow Simple inputs to this service, ignore anything else
    -			$response .= simpleResponse("");	# because we have to send one response per input, send a blank if it fails
    -			next;
    -		}
    -		my $namespace_LSID = getSimpleArticleNamespaceURI($node);  # get the LSID of the namespace for this input object
    -		unless (($namespace_LSID eq $GB_Acc_LSID) || ($namespace_LSID eq $GB_gi_LSID) || $namespace_LSID eq $EMBL_LSID){ # validate the namespace
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if bad namespace
    -			next;
    -		}
    -		my ($ID)= getSimpleArticleIDs($namespace_LSID, [$node]);  # get the ID within this namespace
    -		unless (defined $ID){  # send a blank if we failed to get an id, 
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if there is no id (?!?)
    -			next;
    -		}
    -
    -		# Now, do the analysis
    -		use Bio::DB::GenBank;
    -		use Bio::DB::EMBL;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');  # now that we have a namespace and ID, we are ready to retrieve
    -		my $emb = new Bio::DB::EMBL(-retrievaltype => 'io_string');
    -		my $seq;
    -		if ($namespace_LSID eq $GB_Acc_LSID){  # if the namespace is a genbank Accession thebn
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the accession
    -		} elsif ($namespace_LSID  eq $GB_gi_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_gi($ID);  # get the sequence object for the gi
    -		} elsif ($namespace_LSID  eq $EMBL_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the gi
    -		} else {
    -			$response .= simpleResponse("");  # if it is neither,then send a blank as required by the API
    -			next;
    -		}
    -
    -		my $string;
    -		my $stringio = IO::String->new($string);
    -		my $out = Bio::SeqIO->new('-fh' => $stringio,
    -							   '-format' => 'genbank');
    -		# output goes into $string
    -		$out->write_seq($seq);
    -		$response .= simpleResponse(""); # append this queryResponse to the list
    -	}
    -    my $fullresponse =  responseHeader() . $response . responseFooter();  # add the headers and footers around all queryResponses
    -    my $SOAPResponse = SOAP::Data->type('base64' => $fullresponse);  # base 64 encode it (optional)
    -    return $SOAPResponse;	# and yer done!
    -}
    -
     
     #################################################
     #################################################
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 13:22:02 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu Dec 11 13:21:22 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111822.hBBIM2nY004412@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:22:02 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv4393/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    fixed the CRIB XML tag - it is CrossReference not CrossReferences.  This also pointed me to an error in the API documentation which is also now fixed and consistent throughout
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.46,1.47
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.46
    retrieving revision 1.47
    diff -u -r1.46 -r1.47
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:08:14	1.46
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:22:02	1.47
    @@ -284,9 +284,9 @@
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			} else {
    @@ -295,9 +295,9 @@
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			}
    @@ -359,12 +359,12 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
     
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n";
    +				my $tempresponse = "\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
    -				$tempresponse .="\n".($SEQ->length)."
    +				$tempresponse .="\n".($SEQ->length)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    @@ -373,13 +373,13 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n\n";
    +				my $tempresponse = "\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
    @@ -389,13 +389,13 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n\n";
    +				my $tempresponse = "\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
    @@ -441,12 +441,12 @@
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
    -				$tempresponse .="\n".($SEQ->length)."
    +				$tempresponse .="\n".($SEQ->length)."
     												 ".($SEQ->seq)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    @@ -457,13 +457,13 @@
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
     					 ";
    @@ -475,13 +475,13 @@
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
     					 ";
    @@ -532,9 +532,9 @@
     				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			} else {
    @@ -543,9 +543,9 @@
     				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			}
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 17:30:53 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu Dec 11 17:30:13 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312112230.hBBMUrFG005178@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 17:30:53 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv5159/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    two more services dealing with taxon data
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.47,1.48
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.47
    retrieving revision 1.48
    diff -u -r1.47 -r1.48
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:22:02	1.47
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 22:30:53	1.48
    @@ -46,13 +46,13 @@
         my ($caller, $data) = @_;
         my $MOBY_RESPONSE;
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    -    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (scalar(@inputs));
     
         my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
     
         foreach (@inputs){
             my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    +        unless (($articleType == SIMPLE) && ($input)){
                 $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
                 next;
             } else {
    @@ -69,6 +69,97 @@
     ##################################################
     ##################################################
     
    +sub getTaxChildNodes {  # WORKS
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= collectionResponse([], "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= collectionResponse([], "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $children = SHoundGetTaxChildNodes($identifier);
    +            $MOBY_RESPONSE .= collectionResponse([], "nothing_found", $qID) unless ($children);
    +			my @children = split ",", $children;
    +			my @simples;
    +			foreach my $taxon (@children){
    +				next unless $taxon;
    +				$taxon =~ s/\s//g;
    +	            push @simples, "";
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples, "", $qID);
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub getTaxParent { # DOES NOT WORK - SHound call doesn't exist
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= simpleResponse("", "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $parent = SHoundGetTaxParent($identifier);
    +            $MOBY_RESPONSE .= simpleResponse("", "nothing_found", $qID) unless ($parent);
    +			$parent && ($MOBY_RESPONSE .= simpleResponse("", "", $qID));
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +
    +sub getTaxNameFromTaxID{  # WORKS
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= simpleResponse("", "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $name = SHoundGetTaxNameFromTaxID($identifier);
    +            $MOBY_RESPONSE .= simpleResponse("", "nothing_found", $qID) unless ($name);
    +			$name && ($MOBY_RESPONSE .= simpleResponse("
    +													   
    +													   
    +													   $name", "", $qID));
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
     
     sub getGoTerm {
         my ($caller, $message) = @_;
    
    From mwilkinson at pub.open-bio.org  Fri Dec 12 14:22:45 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri Dec 12 14:21:59 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312121922.hBCJMikJ009022@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 12 14:22:44 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv9003/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    making GMOD moby server revealed a commonsubs error.  removed the deprecated services from my CGI client
    
    moby-live/Perl/MOBY CommonSubs.pm,1.34,1.35
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.34
    retrieving revision 1.35
    diff -u -r1.34 -r1.35
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/10 22:22:03	1.34
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/12 19:22:44	1.35
    @@ -397,7 +397,7 @@
             ";
         } elsif($data) {
             return "
    -        
    +        
                 $data
             
             ";
    
    From mwilkinson at pub.open-bio.org  Fri Dec 12 14:22:45 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri Dec 12 14:21:59 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312121922.hBCJMjo6009041@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 12 14:22:44 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts
    In directory pub.open-bio.org:/tmp/cvs-serv9003/Perl/scripts
    
    Modified Files:
    	Services.cgi 
    Log Message:
    making GMOD moby server revealed a commonsubs error.  removed the deprecated services from my CGI client
    
    moby-live/Perl/scripts Services.cgi,1.4,1.5
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services.cgi,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -r1.4 -r1.5
    --- /home/repository/moby/moby-live/Perl/scripts/Services.cgi	2003/10/17 21:29:52	1.4
    +++ /home/repository/moby/moby-live/Perl/scripts/Services.cgi	2003/12/12 19:22:44	1.5
    @@ -2,8 +2,13 @@
     # _________________________________________________________________
     use SOAP::Transport::HTTP;
     use lib "/usr/local/apache/cgi-bin";
    +use lib "/usr/local/apache/cgi-bin/MOBY05";
    +use lib "/usr/local/apache/cgi-bin/BIO/go-dev/perl-api";
     use lib "/usr/local/apache/cgi-bin/BIO/moby-live/Perl";
    -use lib "/usr/local/apache/cgi-bin/BIO/core/Perl";
    +use lib '/usr/local/apache/cgi-bin/bioperl/core';
    +use lib '/usr/local/apache/cgi-bin/Services/';
    +use Bio::SeqIO::genbank;
    +use GO::AppHandle;
     use Services::LocalServices;
     use strict;
     
    @@ -12,13 +17,13 @@
     $x->dispatch_with({
     'http://biomoby.org/#getGoTerm' => 'Services::LocalServices',
     'http://biomoby.org/#getGoTermAssociations' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankAccVirtualSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankAccSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankGIVirtualSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankGISequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankCompleteSequenceRetrieve' => 'Services::LocalServices',
     'http://biomoby.org/#RetrieveGOFromKeywords' => 'Services::LocalServices',
     'http://biomoby.org/#getDragonMutantImages' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankff' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankFasta' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankWhateverSequence' => 'Services::LocalServices',
    +'http://biomoby.org/#getTaxNameFromTaxID' => 'Services::LocalServices',
    +'http://biomoby.org/#getTaxChildNodes' => 'Services::LocalServices',
     
     });
     $x->handle;
    
    From mwilkinson at pub.open-bio.org  Tue Dec 16 15:46:40 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue Dec 16 15:45:28 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312162046.hBGKke7h000685@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec 16 15:46:40 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv665/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    corrected the SeqHound call for EMBL accession numbers  Added a new service that wraps the SeqHound SHoundGetTaxParent function to retrieve the taxonomic parents of a given taxon id.
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.48,1.49
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.48
    retrieving revision 1.49
    diff -u -r1.48 -r1.49
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 22:30:53	1.48
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/16 20:46:40	1.49
    @@ -17,15 +17,31 @@
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    -use MOBY::CommonSubs qw(:all);  # this provides the
    -# subroutines:
    -#getSimpleArticleIDs
    -#getSimpleArticleNamespaceURI
    -#simpleResponse
    -#responseHeader
    -#responseFooter
    -#getInputArticles
    -#getNodeContentWithArticle
    +use MOBY::CommonSubs qw(:all);  # this provides the following vars and functions
    +    #getSimpleArticleIDs
    +    #getSimpleArticleNamespaceURI
    +    #simpleResponse
    +    #responseHeader
    +    #responseFooter
    +    #getInputArticles
    +    #getInputs
    +    #getInputID
    +    #getArticles
    +    #getCollectedSimples
    +    #getNodeContentWithArticle
    +    #extractRawContent
    +    #collectionResponse
    +    #validateNamespaces
    +    #validateThisNamespace
    +    #isSimpleArticle
    +    #isCollectionArticle
    +    #extractResponseArticles
    +    #getResponseArticles
    +    #getCrossReferences
    +    #genericServiceInputParser
    +    #COLLECTION
    +    #SIMPLE
    +
     my $debug = 1;
     
     use vars qw(@ISA);
    @@ -103,7 +119,7 @@
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    -sub getTaxParent { # DOES NOT WORK - SHound call doesn't exist
    +sub getTaxParent { # now it works.
         my ($caller, $data) = @_;
         my $MOBY_RESPONSE;
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    @@ -327,14 +343,6 @@
     #  ===============================================
     #  =    Genbank Retrieval Scripts                =
     #  =                                             =
    -#  = Note:  The two VirtualSequenceRetrieve's    =
    -#  =        and two SequenceRetrieves below could=
    -#  =        have been registered as two services =
    -#  =        instead of four, by simply           =
    -#  =        registering each under two different =
    -#  =        namespaces (Acc and gi) instead of   =
    -#  =        having a single service for each     =
    -#  =        namespace                            =
     #  ===============================================
     
     
    @@ -369,7 +377,7 @@
     				my $gb = SHoundGetGenBankff($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
    @@ -458,7 +466,7 @@
     				$tempresponse .="\n".($SEQ->length)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    @@ -541,7 +549,7 @@
     												 ".($SEQ->seq)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    @@ -617,7 +625,7 @@
     				my $gb = SHoundGetFasta($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetFasta($gi);
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 12:05:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon Dec 22 12:07:57 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221705.hBMH53k3013451@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 12:05:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv13432/Perl/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    added some sanity checking to the authURI attribute of all register* calls.  Its still allows some insanity through, but not the most obviously sick ones
    
    moby-live/Perl/MOBY Central.pm,1.116,1.117
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.116
    retrieving revision 1.117
    diff -u -r1.116 -r1.117
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 01:08:24	1.116
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:05:03	1.117
    @@ -234,6 +234,8 @@
     		if ($term =~ /FAILED/){return &_error("Malformed XML;","");}
     		return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +
     	# validate that the final ontology will be valid by testing against existing relationships and such
     	while (my ($reltype, $obj) = each %{$relationships}){
     		my ($success, $message, $URI) = $RelOntologyServer->relationshipExists(term => $reltype, ontology => 'object'); # success = 1 if it does
    @@ -466,6 +468,8 @@
     		if ($term =~ /FAILED/){		return &_error("Malformed XML\n $term","");}
     		return &_error("Malformed XML\n may be missing required parameters serviceType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +
     	# validate that the final ontology will be valid
     
     	my ($exists, $exists_message, $existingURI) = $OntologyServer->serviceExists(term => $term); # success = 1 if it does
    @@ -678,6 +682,7 @@
     	unless (defined $term && defined $desc && defined $auth && defined $email){
     		return &_error("Malformed XML; may be missing required parameters namespaceType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
     
     	my ($exists, $exists_message, $URI) = $OntologyServer->namespaceExists(term => $term); # success = 1 if it does
     	(($exists==1) && return &_error("Namespace $term already exists", $URI));
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 12:21:16 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon Dec 22 12:24:07 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221721.hBMHLGvN013584@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 12:21:16 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv13565/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    Doh!  I broke it.  Should be fixed now
    
    moby-live/Perl/MOBY Central.pm,1.117,1.118
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.117
    retrieving revision 1.118
    diff -u -r1.117 -r1.118
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:05:03	1.117
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:21:16	1.118
    @@ -234,7 +234,7 @@
     		if ($term =~ /FAILED/){return &_error("Malformed XML;","");}
     		return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	# validate that the final ontology will be valid by testing against existing relationships and such
     	while (my ($reltype, $obj) = each %{$relationships}){
    @@ -468,7 +468,7 @@
     		if ($term =~ /FAILED/){		return &_error("Malformed XML\n $term","");}
     		return &_error("Malformed XML\n may be missing required parameters serviceType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	# validate that the final ontology will be valid
     
    @@ -682,7 +682,7 @@
     	unless (defined $term && defined $desc && defined $auth && defined $email){
     		return &_error("Malformed XML; may be missing required parameters namespaceType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	my ($exists, $exists_message, $URI) = $OntologyServer->namespaceExists(term => $term); # success = 1 if it does
     	(($exists==1) && return &_error("Namespace $term already exists", $URI));
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 14:57:04 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon Dec 22 14:59:53 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221957.hBMJv4gk014200@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 14:57:04 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv14181/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    be kind, allow them to send a listref to validateThisNamespace if they do so by accident.
    
    moby-live/Perl/MOBY CommonSubs.pm,1.35,1.36
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.35
    retrieving revision 1.36
    diff -u -r1.35 -r1.36
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/12 19:22:44	1.35
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/22 19:57:04	1.36
    @@ -937,6 +937,8 @@
     
     sub validateThisNamespace {
         my ($ns, @namespaces) = @_;
    +    return 1 unless scalar @namespaces; # if you don't give me a list, I assume everything is valid...
    +    if (ref($namespaces[1]) =~ /ARRAY/){@namespaces = @{$namespaces[1]}}  # if you send me an arrayref I should be kind... DWIM!
         foreach (@namespaces){
             next unless $_;
             return 1 if $ns eq $_;
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 14:59:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon Dec 22 15:02:03 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221959.hBMJxEO6014268@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 14:59:13 EST 2003
    Update of /home/repository/moby/moby-live/Perl
    In directory pub.open-bio.org:/tmp/cvs-serv14249
    
    Added Files:
    	README 
    Log Message:
    putting README back into the Perl folder
    
    moby-live/Perl README,1.2,1.3
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/README,v
    retrieving revision 1.2
    retrieving revision 1.3
    diff -u -r1.2 -r1.3
    
    From tyotirkjwegi at vilcrfnh.beautytipmakeup.info  Mon Dec 22 17:26:09 2003
    From: tyotirkjwegi at vilcrfnh.beautytipmakeup.info (Wgec Sd)
    Date: Mon Dec 22 15:18:30 2003
    Subject: [MOBY-guts] Headline NEWS - Face Looks 20 years Younger
    In-Reply-To: <09X6.VxKH-PDCB$KRxVxKH.xAP.X00YW5>
    References: <09X6.VxKH-PDCB$KRxVxKH.xAP.X00YW5>
    Message-ID: 
    
    An HTML attachment was scrubbed...
    URL: http://portal.open-bio.org/pipermail/moby-guts/attachments/20031222/3a20bb44/attachment.htm
    From mwilkinson at pub.open-bio.org  Fri Dec 26 17:01:31 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri Dec 26 17:03:54 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312262201.hBQM1VtN026461@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 26 17:01:31 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv26442/Perl/MOBY/Client
    
    Modified Files:
    	Central.pm 
    Log Message:
    duh!  If you pass identical objects to the ISA routine, CLEARLY it should return TRUE!!
    
    moby-live/Perl/MOBY/Client Central.pm,1.64,1.65
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.64
    retrieving revision 1.65
    diff -u -r1.64 -r1.65
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:57:15	1.64
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/26 22:01:31	1.65
    @@ -1383,6 +1383,7 @@
     
     sub ISA {
     	my ($self, $class1, $class2) = @_;
    +	return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2"));
     	my $OS = MOBY::Client::OntologyServer->new;
     	my ($s, $d, $lsid1) = $OS->objectExists(term => $class1);
     	return 0 unless $s;
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 08:55:20 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat Dec 27 08:57:39 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271355.hBRDtKVf028530@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 08:55:20 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv28511/Perl/MOBY/Client
    
    Modified Files:
    	Central.pm 
    Log Message:
    serious performance issues revealed by the new Gbrowse moby client program.  The ISA call of MOB::Clien:Central requires two CGI calls, a SOAP call, which itself results in two CGI calls, and a myriad of independent database calls to traverse the ontology.  It ended up being >1 second per call,which was unacceptable for many situations where you just need a quick answer to a 'what the heck is this' question.  Started client-side caching of the ontology and LSID terms in Client::Central to speed things up.  It is now only slow the first time, and <.05 seconds per call thereafter.  It does show how critical the need is to start storing the ontology in memory on the server side, though.
    
    moby-live/Perl/MOBY/Client Central.pm,1.65,1.66
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.65
    retrieving revision 1.66
    diff -u -r1.65 -r1.66
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/26 22:01:31	1.65
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/27 13:55:20	1.66
    @@ -1385,13 +1385,27 @@
     	my ($self, $class1, $class2) = @_;
     	return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2"));
     	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $d, $lsid1) = $OS->objectExists(term => $class1);
    -	return 0 unless $s;
    -	my ($s2, $d2, $lsid2) = $OS->objectExists(term => $class2);
    -	return 0 unless $s2;
    -	my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1);
    -	my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
    -	foreach (@$lsids){
    +	my ($lsid1, $lsid2);
    +	unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){
    +		my ($s, $d, $lsid) = $OS->objectExists(term => $class1);
    +		$self->{LSID_CACHE}->{$class1} = $lsid;
    +		$lsid1 = $lsid;
    +		return 0 unless $s;
    +	}
    +	unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){
    +		my ($s, $d, $lsid) = $OS->objectExists(term => $class2);
    +		$self->{LSID_CACHE}->{$class2} = $lsid;
    +		$lsid2 = $lsid;
    +		return 0 unless $s;
    +	}
    +	my @lsids;
    +	unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){
    +		my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']);
    +		my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
    +		@lsids = @$lsids;
    +	}
    +	$self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids];
    +	foreach (@lsids){
     		return 1 if $_ eq $lsid2;
     	}
     	return 0;
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 10:12:32 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat Dec 27 10:14:50 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271512.hBRFCWeV028733@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 10:12:31 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28714/Perl/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    Gbrowse client reveals another MOBY Central bug.  Searching for services where you provide an invalid namespace as a parameter should NOT find ALL services, it should find NO services.
    
    moby-live/Perl/MOBY Central.pm,1.118,1.119
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.118
    retrieving revision 1.119
    diff -u -r1.118 -r1.119
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:21:16	1.118
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/27 15:12:31	1.119
    @@ -1849,7 +1849,7 @@
     			next unless ($_->getNodeType == TEXT_NODE);
     			my $name = $_->toString; chomp $name;
     			my ($success, $message, $URI) = $OS->namespaceExists(term => $name);
    -			($URI) && push @namespaces, $URI;
    +			$URI?(push @namespaces, $URI):(push @namespaces, "__MOBY__INVALID__NAMESPACE__");
     		}
     	}
     	return ($objectURI, \@namespaces);
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 12:41:32 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat Dec 27 12:43:51 2003
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271741.hBRHfWiQ029662@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 12:41:32 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv29639/Perl/MOBY/Client
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    more tweaks for the Gbrowse project.  Create getter/setter methods for the LSID and ISA caches in MOBY::Client::Central so that they can be called from outside of the module itself.  This will allow us to build external tools that play with these caches.  This may not seem useful at the moment since we only have CGI based clients, so the cache is erased every time we make a call, but once we have a standalone client it will be very useful
    
    moby-live/Perl/MOBY/Client Central.html,1.13,1.14 Central.pm,1.66,1.67
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v
    retrieving revision 1.13
    retrieving revision 1.14
    diff -u -r1.13 -r1.14
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/02 00:57:15	1.13
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/27 17:41:32	1.14
    @@ -2,7 +2,7 @@
     
     
     MOBY::Client::Central - a client side wrapper for MOBY Central
    -
    +
     
     
     
    @@ -20,8 +20,8 @@
     	
     
     
    @@ -135,7 +137,7 @@
                     at all, and everything should work
     

    -

    registerObject a.k.a registerObjectClass

    +

    registerObject a.k.a registerObjectClass

      Title     :    registerObject ; registerObjectClass
      Usage     :    $REG = $MOBY->registerObject(%args)
    @@ -154,7 +156,7 @@
                             [Object1, articleName]]}

    -

    deregisterObject a.k.a. deregisterObjectClass

    +

    deregisterObject a.k.a. deregisterObjectClass

      Title     :    deregisterObject ; deregisterObjectClass
      Usage     :    $REG = $MOBY->deregisterObject(%args)
    @@ -430,6 +432,27 @@
      Function  :    DUMP the mysql for the current MOBY Central database
      Returns   :    text
      Args      :    $reg - name of MOBY Central you want to use if not default
    +

    +

    +

    LSID_CACHE

    +
    + Title     :    LSID_CACHE
    + Usage     :    $lsid = $MOBY->LSID_CACHE($term, $lsid)
    + Function  :    get/set LSID from the cache
    + Returns   :    lsid as a scalar
    + Args      :    the term for which you have/want an lsid,
    +                and optionally the lsid to set.
    +

    +

    +

    ISA_CACHE

    +
    + Title     :    ISA_CACHE
    + Usage     :    $lsid = $MOBY->ISA_CACHE($term, \@isas)
    + Function  :    get/set the ISA relationships in the cache
    + Returns   :    listref of ISA relationships.  The resulting
    +                list is IN ORDER from term to root.
    + Args      :    the term for which you have/want the ISA parentage,
    +                and optionally the parentage listref to set.
    =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 13:55:20 1.66 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 17:41:32 1.67 @@ -213,6 +213,7 @@ } } + sub new { my ($caller, %args) = @_; @@ -1342,6 +1343,7 @@ } + sub _relationshipsPayload{ my ($payload) = @_; return undef unless $payload; @@ -1388,23 +1390,23 @@ my ($lsid1, $lsid2); unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){ my ($s, $d, $lsid) = $OS->objectExists(term => $class1); - $self->{LSID_CACHE}->{$class1} = $lsid; + $self->LSID_CACHE($class1, $lsid); $lsid1 = $lsid; return 0 unless $s; } unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){ my ($s, $d, $lsid) = $OS->objectExists(term => $class2); - $self->{LSID_CACHE}->{$class2} = $lsid; + $self->LSID_CACHE($class2, $lsid); $lsid2 = $lsid; return 0 unless $s; } my @lsids; - unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ + unless ($self->ISA_CACHE($lsid1) && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']); my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'}; @lsids = @$lsids; } - $self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids]; + $self->ISA_CACHE($lsid1, [@lsids]); foreach (@lsids){ return 1 if $_ eq $lsid2; } @@ -1507,6 +1509,61 @@ return \@Services; } + +=head2 LSID_CACHE + + Title : LSID_CACHE + Usage : $lsid = $MOBY->LSID_CACHE($term, $lsid) + Function : get/set LSID from the cache + Returns : lsid as a scalar + Args : the term for which you have/want an lsid, + and optionally the lsid to set. + +=cut + + +sub LSID_CACHE { + my ($self, $term, $lsid) = @_; + if ($term && $lsid){ + $self->{LSID_CACHE}->{$term} = $lsid; + return $self->{LSID_CACHE}->{$term}; + } elsif ($term){ + return $self->{LSID_CACHE}->{$term}; + } else { + return undef + } +} + + +=head2 ISA_CACHE + + Title : ISA_CACHE + Usage : $lsid = $MOBY->ISA_CACHE($term, \@isas) + Function : get/set the ISA relationships in the cache + Returns : listref of ISA relationships. The resulting + list is IN ORDER from term to root. + Args : the term for which you have/want the ISA parentage, + and optionally the parentage listref to set. + +=cut + +sub ISA_CACHE { + my ($self, $term, $isas) = @_; + return [] if $isas && !(ref($isas)=~/ARRAY/); + if ($term && $isas){ + while (scalar(@$isas)){ + $self->{ISA_CACHE}->{$term} = [@$isas]; + $term = shift(@$isas); + } + return $self->{ISA_CACHE}->{$term}; + } elsif ($term){ + return $self->{ISA_CACHE}->{$term}; + } else { + return [] + } +} + + sub parseRegXML { # # $id From mwilkinson at pub.open-bio.org Sat Dec 27 15:11:49 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat Dec 27 15:14:06 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272011.hBRKBnPp029986@pub.open-bio.org> mwilkinson Sat Dec 27 15:11:49 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv29963/Perl/MOBY/Client Modified Files: Central.pm Central.html Log Message: Gbrowse client modifications and additions. Caching is clearly an issue for speed purposes so there are some nice caching routines now in MOBY::Client::Central, as well as accessor methods to play with the cache. moby-live/Perl/MOBY/Client Central.pm,1.67,1.68 Central.html,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 17:41:32 1.67 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 20:11:48 1.68 @@ -1377,8 +1377,8 @@ Function : a pre-canned use of the Relationships function to quickly get an answer to whether class1 ISA class2 Returns : Boolean - Args : $class1 - an Object ontology term - $class2 - an Object ontology term + Args : $class1 - an Object ontology term or LSID + $class2 - an Object ontology term or LSID =cut @@ -1386,27 +1386,17 @@ sub ISA { my ($self, $class1, $class2) = @_; return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2")); - my $OS = MOBY::Client::OntologyServer->new; - my ($lsid1, $lsid2); - unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){ - my ($s, $d, $lsid) = $OS->objectExists(term => $class1); - $self->LSID_CACHE($class1, $lsid); - $lsid1 = $lsid; - return 0 unless $s; - } - unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){ - my ($s, $d, $lsid) = $OS->objectExists(term => $class2); - $self->LSID_CACHE($class2, $lsid); - $lsid2 = $lsid; - return 0 unless $s; - } + my $lsid1 = $self->ObjLSID($class1); + my $lsid2 = $self->ObjLSID($class2); + return 0 unless $lsid1 && $lsid2; my @lsids; - unless ($self->ISA_CACHE($lsid1) && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ + unless (@lsids = $self->ISA_CACHE($lsid1)){ my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']); my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'}; @lsids = @$lsids; + $self->ISA_CACHE($lsid1, [@lsids]); + $self->ISA_CACHE($class1, [@lsids]); } - $self->ISA_CACHE($lsid1, [@lsids]); foreach (@lsids){ return 1 if $_ eq $lsid2; } @@ -1509,6 +1499,29 @@ return \@Services; } +# my ($e, $m, $lsid) = $OS->objectExists(term => $_); + +=head2 ObjLSID + +=cut + +sub ObjLSID { + my ($self, $term) = @_; + return undef unless $term; + if (my $lsid = $self->LSID_CACHE($term)){ + return $lsid; + } else { + my $os = MOBY::Client::OntologyServer->new; + my ($s, $m, $lsid) = $os->objectExists(term => $term); + if ($lsid){ + $self->LSID_CACHE($term, $lsid); # link both the term + $self->LSID_CACHE($lsid, $lsid); # and the lsid to itself + return $lsid + } else { + return undef + } + } +} =head2 LSID_CACHE @@ -1537,29 +1550,32 @@ =head2 ISA_CACHE - Title : ISA_CACHE - Usage : $lsid = $MOBY->ISA_CACHE($term, \@isas) - Function : get/set the ISA relationships in the cache - Returns : listref of ISA relationships. The resulting - list is IN ORDER from term to root. - Args : the term for which you have/want the ISA parentage, - and optionally the parentage listref to set. + Title : ISA_CACHE + Usage : @lsids = $MOBY->ISA_CACHE($lsid, \@isas) + Function : get/set the ISA relationships in the cache + Returns : list of ISA relationships. The ISA list + is IN ORDER from, excluding the term itself, to + root Object. Base Object returns an empty list. + Args : The LSID for which you have/want the ISA parentage, + and optionally the parentage listref to set. + Note : WHAT COMES BACK ARE LSIDs!!! =cut sub ISA_CACHE { - my ($self, $term, $isas) = @_; - return [] if $isas && !(ref($isas)=~/ARRAY/); + my ($self, $desiredterm, $isas) = @_; + my $term = $desiredterm; + return (undef) if $isas && !(ref($isas)=~/ARRAY/); if ($term && $isas){ - while (scalar(@$isas)){ + $self->{ISA_CACHE}->{$desiredterm} = [@$isas]; + while (my $term = shift(@$isas)){ $self->{ISA_CACHE}->{$term} = [@$isas]; - $term = shift(@$isas); } - return $self->{ISA_CACHE}->{$term}; - } elsif ($term){ - return $self->{ISA_CACHE}->{$term}; + return @{$self->{ISA_CACHE}->{$desiredterm}}; + } elsif ($term && $self->{ISA_CACHE}->{$desiredterm}){ + return @{$self->{ISA_CACHE}->{$desiredterm}}; } else { - return [] + return (); } } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/27 17:41:32 1.14 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/27 20:11:49 1.15 @@ -41,6 +41,7 @@
  • Relationships
  • ISA
  • DUMP
  • +
  • ObjLSID
  • LSID_CACHE
  • ISA_CACHE
  • @@ -421,8 +422,8 @@ Function : a pre-canned use of the Relationships function to quickly get an answer to whether class1 ISA class2 Returns : Boolean - Args : $class1 - an Object ontology term - $class2 - an Object ontology term + Args : $class1 - an Object ontology term or LSID + $class2 - an Object ontology term or LSID

    DUMP

    @@ -434,6 +435,9 @@ Args : $reg - name of MOBY Central you want to use if not default

    +

    ObjLSID

    +

    +

    LSID_CACHE

      Title     :    LSID_CACHE
    @@ -446,13 +450,15 @@
     

    ISA_CACHE

    - Title     :    ISA_CACHE
    - Usage     :    $lsid = $MOBY->ISA_CACHE($term, \@isas)
    - Function  :    get/set the ISA relationships in the cache
    - Returns   :    listref of ISA relationships.  The resulting
    -                list is IN ORDER from term to root.
    - Args      :    the term for which you have/want the ISA parentage,
    -                and optionally the parentage listref to set.
    + Title : ISA_CACHE + Usage : @lsids = $MOBY->ISA_CACHE($lsid, \@isas) + Function : get/set the ISA relationships in the cache + Returns : list of ISA relationships. The ISA list + is IN ORDER from, excluding the term itself, to + root Object. Base Object returns an empty list. + Args : The LSID for which you have/want the ISA parentage, + and optionally the parentage listref to set. + Note : WHAT COMES BACK ARE LSIDs!!!
    From mwilkinson at pub.open-bio.org Sat Dec 27 15:15:45 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat Dec 27 15:18:02 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272015.hBRKFjpJ030037@pub.open-bio.org> mwilkinson Sat Dec 27 15:15:45 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv30014/Perl/MOBY Modified Files: CommonSubs.pm CommonSubs.html Log Message: Gbrowse client needed a new utility routine in CommonSubs. This will take a list of 'known' Object ontology nodes and check it against the parentage of an in-hand object type, returning to you the term from your list that is DEEPEST in the ontology in the ISA parentage of your in-hand object. Why? (you might ask) Well, because when you want to assign renderers to objects you want the most complex renderer possible to deal with your in-hand object, so if you have rendrers for a variety of base object types, you want to chose the one that is best able to deal with whatever you have in-hand, thus you want the node closest to your object type moby-live/Perl/MOBY CommonSubs.pm,1.36,1.37 CommonSubs.html,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/22 19:57:04 1.36 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:15:45 1.37 @@ -175,6 +175,7 @@ getResponseArticles getCrossReferences genericServiceInputParser + whichDeepestParentObject COLLECTION SIMPLE BE_NICE @@ -202,6 +203,7 @@ getResponseArticles getCrossReferences genericServiceInputParser + whichDeepestParentObject COLLECTION SIMPLE BE_NICE @@ -1071,6 +1073,43 @@ return @XREFS; } + + +=head2 whichDeepestParentObject + + name : whichDeepestParentObject + function : select the parent node from nodeList that is + closest to the querynode + usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + args : $CENTRAL - your MOBY::Client::Central object + $queryNode - the node I am interested in + \@nodelist - the list of nodes that I know about + returns : an ontology term as a scalar, or undef if there + is no parent of this node in the nodelist + +=cut + + +sub whichDeepestParentObject { + use MOBY::Client::OntologyServer; + my ($CENTRAL, $queryTerm, $termlist) = @_; + return undef unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); + my %nodeLSIDs; + foreach (@$termlist){ # get list of known LSIDs + my $lsid = $CENTRAL->ObjLSID($_); + $nodeLSIDs{$lsid}=1; + } + my $queryLSID = $CENTRAL->ObjLSID($queryTerm); + return undef unless keys(%nodeLSIDs); + my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already + return undef unless $isa; # this should return true or we are in BIIIG trouble! + my @lsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root + while (my $thisnode = shift @lsids){ # @isas are lsid's + return $thisnode if $nodeLSIDs{$thisnode}; + } + return undef +} + sub _makeXrefType { my ($xref) = @_; my $ns = $xref->getAttributeNode('namespace'); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/11/08 17:21:31 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:15:45 1.7 @@ -4,7 +4,7 @@ MOBY::CommonSubs.pm - a set of exportable subroutines that are useful in clients and services to deal with the input/output from MOBY Services - + @@ -41,9 +41,12 @@
  • isSimpleArticle
  • isCollectionArticle
  • getNodeContentWithArticle
  • +
  • extractRawContent
  • validateNamespaces
  • -
  • getResponseArticles (a.k.a. extractResponseArticles)
  • +
  • validateThisNamespace
  • +
  • getResponseArticles (a.k.a. extractResponseArticles)
  • getCrossReferences
  • +
  • whichDeepestParentObject
  • @@ -181,17 +184,19 @@ name : getSimpleArticleIDs function : to get the IDs of simple articles that are in the given namespace usage : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles); - args : (in order) - $Namespace - (required) a namespace stringfrom the MOBY namespace ontology + my @ids = getSimpleArticleIDs(\@SimpleArticles); + args : $Namespace - (optional) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care \@Simples - (required) a listref of Simple XML::DOM nodes i.e. the XML::DOM representing an XML structure like this: <Simple> <Object namespace="NCBI_gi" id="163483"/> </Simple> - note : it will return *only* the ids that are in the given namespace - but since you are required to return an output for every input - (even if it is invalid) this routine will return undef for - those articles that are not in that namespace + note : If you provide a namespace, it will return *only* the ids that are in the given namespace, + but will return 'undef' for any articles in the WRONG namespace so that you get an + equivalent number of outputs to inputs. + + Note that if you call this with a single argument, this is assumed to + be \@Articles, so you will get ALL id's regardless of namespace!

    getSimpleArticleNamespaceURI

    @@ -417,6 +422,16 @@ }

    +

    extractRawContent

    +
    + name     : extractRawContent
    + function : pass me an article (Simple, or Collection) and I'll give you the
    +            content AS A STRING - i.e. the raw XML of the contained MOBY Object(s)
    + usage    : extractRawContent($simple)
    + input    : the one element of the output from getArticles
    + returns  : string
    +

    +

    validateNamespaces

      name     : validateNamespaces
    @@ -427,7 +442,16 @@
                 presumptive namespaces; undef for each namespace that was invalid

    -

    getResponseArticles (a.k.a. extractResponseArticles)

    +

    validateThisNamespace

    +
    + name     : validateThisNamespace
    + function : checks a given namespace against a list of valid namespaces
    + usage    : $valid = validateThisNamespace($ns, @validNS);
    + args     : ordered list of the namespace of interest and the list of valid NS's
    + returns  : boolean
    +

    +

    +

    getResponseArticles (a.k.a. extractResponseArticles)

      name     : getResponseArticles
      function : get the DOM nodes corresponding to individual
    @@ -461,6 +485,19 @@
               }
           }
        }
    +

    +

    +

    whichDeepestParentObject

    +
    + name     : whichDeepestParentObject
    + function : select the parent node from nodeList that is
    +            closest to the querynode
    + usage    : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList)
    + args     : $CENTRAL - your MOBY::Client::Central object
    +            $queryNode - the node I am interested in
    +            \@nodelist - the list of nodes that I know about
    + returns  : an ontology term as a scalar, or undef if there
    +            is no parent of this node in the nodelist
    From mwilkinson at pub.open-bio.org Sat Dec 27 15:24:52 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat Dec 27 15:27:09 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272024.hBRKOqJS030126@pub.open-bio.org> mwilkinson Sat Dec 27 15:24:52 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv30103/Perl/MOBY Modified Files: CommonSubs.html CommonSubs.pm Log Message: changed my mind and decided to return both the object name as well as its LSID, since the latter is a bit arcane sometimes. moby-live/Perl/MOBY CommonSubs.html,1.7,1.8 CommonSubs.pm,1.37,1.38 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:15:45 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:24:52 1.8 @@ -492,10 +492,10 @@ name : whichDeepestParentObject function : select the parent node from nodeList that is closest to the querynode - usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList) args : $CENTRAL - your MOBY::Client::Central object - $queryNode - the node I am interested in - \@nodelist - the list of nodes that I know about + $queryTerm - the object type I am interested in + \@termlist - the list of object types that I know about returns : an ontology term as a scalar, or undef if there is no parent of this node in the nodelist =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:15:45 1.37 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:24:52 1.38 @@ -1080,10 +1080,10 @@ name : whichDeepestParentObject function : select the parent node from nodeList that is closest to the querynode - usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList) args : $CENTRAL - your MOBY::Client::Central object - $queryNode - the node I am interested in - \@nodelist - the list of nodes that I know about + $queryTerm - the object type I am interested in + \@termlist - the list of object types that I know about returns : an ontology term as a scalar, or undef if there is no parent of this node in the nodelist @@ -1093,21 +1093,21 @@ sub whichDeepestParentObject { use MOBY::Client::OntologyServer; my ($CENTRAL, $queryTerm, $termlist) = @_; - return undef unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); + return (undef,undef) unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); my %nodeLSIDs; foreach (@$termlist){ # get list of known LSIDs my $lsid = $CENTRAL->ObjLSID($_); - $nodeLSIDs{$lsid}=1; + $nodeLSIDs{$lsid}=$_; } my $queryLSID = $CENTRAL->ObjLSID($queryTerm); - return undef unless keys(%nodeLSIDs); + return (undef, undef) unless keys(%nodeLSIDs); my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already - return undef unless $isa; # this should return true or we are in BIIIG trouble! - my @lsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root - while (my $thisnode = shift @lsids){ # @isas are lsid's - return $thisnode if $nodeLSIDs{$thisnode}; + return (undef, undef) unless $isa; # this should return true or we are in BIIIG trouble! + my @ISAlsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root + while (my $thislsid = shift @ISAlsids){ # @isas are lsid's + return ($nodeLSIDs{$thislsid},$thislsid) if $nodeLSIDs{$thislsid}; } - return undef + return (undef, undef); } sub _makeXrefType { From mwilkinson at pub.open-bio.org Sun Dec 28 15:41:59 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sun Dec 28 15:44:10 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312282041.hBSKfx4X009349@pub.open-bio.org> mwilkinson Sun Dec 28 15:41:59 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv9318/MOBY Modified Files: Central.pm CommonSubs.pm OntologyServer.pm simple_input.pm Log Message: making MOBY Central case-sensitive for LSIDs. I might have missed a few places. please let me know if you find any. moby-live/Perl/MOBY Central.pm,1.119,1.120 CommonSubs.pm,1.38,1.39 OntologyServer.pm,1.30,1.31 simple_input.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/27 15:12:31 1.119 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/28 20:41:59 1.120 @@ -758,7 +758,7 @@ my $dbh = MOBY::central_db_connection->new->dbh; - my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where namespace_type_uris like '%$existingURI%'"); + my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where INSTR(namespace_type_uris,'$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -768,7 +768,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where INSTR(namespace_type_uris,'$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -778,7 +778,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where INSTR(namespace_type_uris, '$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -788,7 +788,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where INSTR(namespace_type_uris, '$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -1699,7 +1699,7 @@ my $nsquery; foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's - $nsquery .=" OR namespace_type_uris like '%$ns%' "; + $nsquery .=" OR INSTR(namespace_type_uris, '$ns') "; } if ($nsquery){ $nsquery =~ s/OR//; # just the first @@ -1754,7 +1754,7 @@ my $nsquery; foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's - $nsquery .=" OR namespace_type_uris like '%$ns%' "; + $nsquery .=" OR INSTR(namespace_type_uris, '$ns') "; } if ($nsquery){ $nsquery =~ s/^\sOR//; # just the first =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:24:52 1.38 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/28 20:41:59 1.39 @@ -1074,7 +1074,6 @@ } - =head2 whichDeepestParentObject name : whichDeepestParentObject @@ -1084,8 +1083,12 @@ args : $CENTRAL - your MOBY::Client::Central object $queryTerm - the object type I am interested in \@termlist - the list of object types that I know about - returns : an ontology term as a scalar, or undef if there - is no parent of this node in the nodelist + returns : an ontology term and LSID as a scalar, or undef if there + is no parent of this node in the nodelist. + (note that it will only return the term if you give it + term names in the @termList. If you give it + LSID's in the termList, then both the parameters + returned will be LSID's - it doesn't back-translate...) =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/02 00:23:23 1.30 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/28 20:41:59 1.31 @@ -179,7 +179,7 @@ } if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_lsid = ?"); + $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where INSTR(object_lsid, ?)"); } else { $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_type = ?"); } @@ -326,7 +326,7 @@ return (0, "requires both term and ontology arguments\n",'') unless (defined($term) && defined($ont)); my $sth; if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_lsid = ? and ontology=?"); + $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where INSTR(relationship_lsid,?) and ontology=?"); } else { $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_type = ? and ontology=?"); } @@ -433,7 +433,7 @@ my $sth; if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_lsid = ?"); + $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where INSTR(service_lsid, ?)"); } else { $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_type = ?"); } @@ -545,7 +545,7 @@ } if ($term =~ /^urn:lsid:biomoby.org:namespacetype/){ - $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_lsid = ?"); + $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where INSTR(namespace_lsid, ?)"); } else { $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_type = ?"); } @@ -691,7 +691,7 @@ sub getObjectCommonName { my ($self, $URI) = @_; return undef unless $URI =~ /urn\:lsid/; - my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_id = ?}, undef, $URI); + my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_lsid = ?}, undef, $URI); return $name?$name:$URI; } @@ -702,7 +702,7 @@ sub getNamespaceCommonName { my ($self, $URI) = @_; return undef unless $URI =~ /urn\:lsid/; - my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_id = ?}, undef, $URI); + my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_lsid = ?}, undef, $URI); return $name?$name:$URI; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm 2003/05/07 19:20:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm 2003/12/28 20:41:59 1.2 @@ -14,7 +14,7 @@ =head1 SYNOPSIS - use MOBY::authority; + use MOBY::simple_input; my $Instance = MOBY::simple_input->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], From mwilkinson at pub.open-bio.org Sun Dec 28 21:43:43 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sun Dec 28 21:45:52 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312290243.hBT2hhlC010292@pub.open-bio.org> mwilkinson Sun Dec 28 21:43:43 EST 2003 Update of /home/repository/moby/moby-live In directory pub.open-bio.org:/tmp/cvs-serv10273 Modified Files: README Log Message: just testing the new cron on biomoby.org moby-live README,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/README,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/README 2003/02/19 21:12:16 1.3 +++ /home/repository/moby/moby-live/README 2003/12/29 02:43:43 1.4 @@ -1,3 +1,4 @@ +test README # # Revision History From mwilkinson at pub.open-bio.org Tue Dec 30 15:03:54 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Dec 30 15:05:52 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312302003.hBUK3sN1016258@pub.open-bio.org> mwilkinson Tue Dec 30 15:03:54 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16239/Perl/MOBY Modified Files: OntologyServer.pm Log Message: changing the case of the LSID's buggered up the Relationships call of the OntologyServer. I noticed this when the Gbrowse MOBY browser stopped working. moby-live/Perl/MOBY OntologyServer.pm,1.31,1.32 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/28 20:41:59 1.31 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/30 20:03:54 1.32 @@ -801,13 +801,13 @@ $term = $self->getObjectURI($term); } my %results; - while (($term ne 'urn:lsid:biomoby.org:objectclass:object') && ($term ne 'urn:lsid:biomoby.org:servicetype:service')){ + while (($term ne 'urn:lsid:biomoby.org:objectclass:Object') && ($term ne 'urn:lsid:biomoby.org:servicetype:Service')){ my $defs = $self->_doRelationshipsQuery($ontology, $term, $relationship, $direction); my $lsid; my $rel; foreach (@{$defs}){ $lsid = $_->[0]; $rel = $_->[1]; - $debug && _LOG("\t\tADDING RELATIONSHIP $_ : $lsid to $rel\n"); + $debug && _LOG("\t\tADDING RELATIONSHIP $_ : $lsid to $rel\n"); push @{$results{$rel}}, $lsid; } last unless ($expand); From mwilkinson at pub.open-bio.org Tue Dec 30 15:21:31 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue Dec 30 15:23:29 2003 Subject: [MOBY-guts] biomoby commit Message-ID: <200312302021.hBUKLVww016376@pub.open-bio.org> mwilkinson Tue Dec 30 15:21:31 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16357/Perl/MOBY Modified Files: CommonSubs.pm Log Message: whichDeepestParentObject should return right away if it finds an object in the list you provided it. Before this would actualy return Object if you gave it the exact object type as part of the search moby-live/Perl/MOBY CommonSubs.pm,1.39,1.40 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/28 20:41:59 1.39 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/30 20:21:30 1.40 @@ -1098,11 +1098,12 @@ my ($CENTRAL, $queryTerm, $termlist) = @_; return (undef,undef) unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); my %nodeLSIDs; + my $queryLSID = $CENTRAL->ObjLSID($queryTerm); foreach (@$termlist){ # get list of known LSIDs my $lsid = $CENTRAL->ObjLSID($_); - $nodeLSIDs{$lsid}=$_; + return ($_, $lsid) if ($lsid eq $queryLSID); # of course, if we find it in the list, then return it right away! + $nodeLSIDs{$lsid}=$_; } - my $queryLSID = $CENTRAL->ObjLSID($queryTerm); return (undef, undef) unless keys(%nodeLSIDs); my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already return (undef, undef) unless $isa; # this should return true or we are in BIIIG trouble! From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNax021442@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl Removed Files: MOBY.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl MOBY.pm,1.2,NONE rcsdiff: /home/repository/moby/moby-live/Perl/RCS/MOBY.pm,v: No such file or directory From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNC9021529@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/scripts In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/scripts Modified Files: testMOBYClientCentral_v05.pl Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/scripts testMOBYClientCentral_v05.pl,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl 2003/07/04 16:12:37 1.11 +++ /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl 2003/12/02 00:23:23 1.12 @@ -23,7 +23,12 @@ } -my $C = MOBY::Client::Central->new(); +my $C = MOBY::Client::Central->new( +#Registries => { +# mobycentral => {URL => 'http://localhost/cgi-bin/MOBY-Central.pl', +# URI => 'http://localhost/MOBY/Central'} +# } +); #reg first object class From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNoQ021508@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/MOBY/Client Modified Files: Central.html Central.pm CollectionArticle.pm SimpleArticle.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/MOBY/Client Central.html,1.11,1.12 Central.pm,1.62,1.63 CollectionArticle.pm,1.5,1.6 SimpleArticle.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/10/22 14:29:09 1.11 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/02 00:23:23 1.12 @@ -409,7 +409,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) - expandRelationships (NOT YET IMPLEMENTED) + expandRelationships => [1/0] (optional)

    ISA

    =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/11/22 00:08:10 1.62 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/02 00:23:23 1.63 @@ -1294,7 +1294,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) - expandRelationships (NOT YET IMPLEMENTED) + expandRelationships => [1/0] (optional) =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/09/12 18:34:21 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/12/02 00:23:23 1.6 @@ -9,16 +9,24 @@ =head1 NAME -MOBY::Client::CollectionArticle - a small object describing a MOBY Collection input or output +MOBY::Client::CollectionArticle - a small object describing the Collection articles from the findService Response message of MOBY Central =head1 SYNOPSIS +experimental - please do not use in your code + =cut =head1 DESCRIPTION +This describes the Collection articles from the findService Response of MOBY Central +(i.e. the description of the service), it DOES NOT create collection articles +as provided by a service provider (i.e. simple articles containing data) + =head1 AUTHORS +Mark Wilkinson (markw at illuminae dot com) + =cut =head1 METHODS =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm 2003/07/01 16:01:01 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm 2003/12/02 00:23:23 1.3 @@ -8,16 +8,24 @@ =head1 NAME -MOBY::Client::SimpleArticle - a small object describing a MOBY Simple input/output article +MOBY::Client::SimpleArticle - a small object describing the Simple articles from the findService Response message of MOBY Central =head1 SYNOPSIS +experimental - please do not use in your code + =cut =head1 DESCRIPTION +This describes the Simple articles from the findService Response of MOBY Central +(i.e. the description of the service), it DOES NOT create simple articles +as provided by a service provider (i.e. simple articles containing data) + =head1 AUTHORS +Mark Wilkinson (markw at illuminae dot com) + =cut =head1 METHODS From mwilkinson at pub.open-bio.org Mon Dec 1 19:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNTw021474@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/MOBY Modified Files: Central.html Central.pm OntologyServer.pm service_instance.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/MOBY Central.html,1.9,1.10 Central.pm,1.113,1.114 OntologyServer.pm,1.29,1.30 service_instance.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/11/01 16:42:13 1.9 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/12/02 00:23:23 1.10 @@ -333,12 +333,54 @@
  • only Input Secondary articles are defined during registration; Output Secondary objects are entirely optional and may or may not be interpreted Client-side using their articleName tags.
  • +
  • Service Categories:
    +
  • +
      Input XML :
           <registerService>
    -         <Category>moby</Category> <!-- one of 'moby', 'cgi', 'soap' ; currently only 'moby' services are fully supported -->
    +         <Category>moby</Category> <!-- one of 'moby', 'cgi', 'wsdl' ; currently only 'moby' and 'wsdl' services are fully supported -->
              <serviceName>YourServiceNameHere</serviceName>
              <serviceType>TypeOntologyTerm</serviceType>
              <authURI>your.URI.here</authURI>
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.113
    retrieving revision 1.114
    diff -u -r1.113 -r1.114
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/11/24 18:06:45	1.113
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 00:23:23	1.114
    @@ -873,25 +873,27 @@
     
     =over 2
     
    -=item *  in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class.  For "soap" services, there is additional flexibility:
    +=item *  in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class.
    +
    +=item *  For "soap" services, there is additional flexibility:
     
     =over 2
     
    -=item *  Similar to a "moby" service, your "soap" service must consume/produce ontologically valid named data-types in order to be discovered by registry searches.  As such, you _must_ register a single unique name for any non-MOBY input or output data Classes, regardless of the actual complexity of the input/output message.
    +=item *  Similar to a "moby" service, your "soap" service must consume/produce named data types.  These are represented as LSID's
     
    -=item *  Do this using the registerObjectClass call of MOBY Central; To ensure uniqueness and LSID compatibilty of data class names, you must name your data using the following format:  your.authURI:dataClassName
    +=item *  YOU DO NOT NEED TO REGISTER THESE DATA TYPES in MOBY Central; it is up to you what your LSID's represent, and MOBY Central WILL NOT try to resolve them!
     
    -=item *  remember, you may use any MOBY Object as your input/output (i.e. any Class Ontology term that inherits from Object) so long as you follow the MOBY message structure for that input or output.
    +=item *  You may mix ontologies when describing your service - i.e. you may freely use any MOBY Object as your input or (XOR) your output and use a non-MOBY object (LSID) for the alternate so long as you follow the MOBY message structure for the parameter that uses the MOBY Object
     
    -=item *  You may register, for example, a service that consumes a non-MOBY data Class and outputs a MOBY data class, so long as you follow the MOBY Messaging format for the output data
    +=over 2
     
    -=item *  You may register, for example, a service that consumes a MOBY data Class and outputs a non-MOBY data class, so long as you follow the MOBY Messaging format for the ihput data
    +=item *  You may register, for example, a service that consumes a non-MOBY data Class and outputs a MOBY data class, so long as you follow the MOBY Messaging format for the output data
     
    -=item *  NOTE: Nether of the cases above are considred MOBY services, and are therefore described in the category of "soap" service
    +=item *  You may register, for example, a service that consumes a MOBY data Class and outputs a non-MOBY data class, so long as you follow the MOBY Messaging format for the input data
     
    -=item *  When registering a non-MOBY data Class name, it DOES NOT have any "Relationship" component (see registerObjectClass API)
    +=item *  NOTE: Nether of the cases above are considered MOBY services, and are therefore described in the category of "soap" service
     
    -=item *  non-MOBY inputs or outputs are described as a single Primary, Simple article of your new named type.
    +=back
     
     =back
     
    @@ -903,6 +905,7 @@
     
     =back
     
    +=back
     
      Input XML :
     
    @@ -1079,17 +1082,18 @@
     	
     	foreach (keys %objects_to_be_validated){
     		my ($valid, $message, $URI) = $OS->objectExists(term => $_);
    -		return &_error("$message","$URI") unless ($valid);
    +		return &_error("$message","$URI") unless ($valid || (($_ =~ /urn:lsid/i) && !($_ =~ /urn:lsid:biomoby.org/i))); # either valid, or a non-moby LSID
     	}
    -	$debug && &_LOG("\n\n\aall objects okay\n");
    +
    +	$debug && &_LOG("\n\n\aall objects okay - either valid MOBY objects, or LSID's\n");
     
     	$OS = MOBY::OntologyServer->new(ontology => 'service');
     	my ($valid, $message, $URI) = $OS->serviceExists(term => $serviceType);
    -	return &_error("$message","$URI") unless ($valid);
    +	print STDERR "\n\nChecking $URI\n\n";
    +	return &_error("$message","$URI") unless ($valid || (($serviceType =~ /urn:lsid/i) && !($serviceType =~ /urn:lsid:biomoby.org/i)));  # either valid, or a non-MOBY LSID
    +	print STDERR "\n\nChecking $URI OK!!\n\n";
     	# right, registration should be successful now!
     	
    -	# "soap" services may only have one input and one output
    -
     	my $SVC = MOBY::service_instance->new(
     		category => $Category,
     		servicename => $serviceName,
    @@ -1158,8 +1162,8 @@
     			($_->getNodeType == TEXT_NODE) && ($object_type = $_->toString);
     		}
     		my ($success, $message, $typeURI) = $OE->objectExists(term => $object_type);
    -		unless ($success) {
    -			$SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist");
    +		if ((!($success) && ($object_type =~ /urn:lsid:biomoby.org/i)) || (!($success) && !($object_type =~ /urn:lsid/i))) {  # if the object doesn't exist, and it isn't an LSID
    +			$SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist, and is not an LSID");
     		}				# kill it all unless this was successful!
     
     		my $namespace_string;
    @@ -1169,10 +1173,11 @@
     		for (my $n = 0; $n<$num_ns;++$n) {
     			foreach my $name ($namespaces->item($n)->getChildNodes) {
     				if ($name->getNodeType == TEXT_NODE) {
    -					my ($success, $message, $URI) = $OE->namespaceExists(term => $name->toString);
    -					unless ($success) {
    +					my $term = $name->toString;
    +					my ($success, $message, $URI) = $OE->namespaceExists(term => $term);
    +					if ((!($success) && ($term =~ /urn:lsid:biomoby.org/i)) || (!($success) && !($term =~ /urn:lsid/i))) {  # if the object doesn't exist, and it isn't an LSID
     						$SVC->DELETE_THYSELF;
    -						return (-1,"namespace: " . $name->toString . " doesn't exist");
    +						return (-1,"namespace: $term doesn't exist and is not an LSID");
     					}
     					$namespace_string .=$URI.",";
     				}
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
    retrieving revision 1.29
    retrieving revision 1.30
    diff -u -r1.29 -r1.30
    --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/11/24 17:25:49	1.29
    +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/12/02 00:23:23	1.30
    @@ -171,9 +171,13 @@
         my ($self, %args) = @_;
         my $term = $args{term};
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
    -
    -    return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'object');
         my $sth;
    +    return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'object');
    +    
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objecttype/)){
    +        return (1, "external ontology", $term);
    +    }
    +
         if ($term =~ /^urn\:lsid/){
             $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_lsid = ?");
         } else {
    @@ -204,6 +208,10 @@
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objectclass/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -265,11 +273,15 @@
         return (0, "WRONG ONTOLOGY",'') unless ($self->ontology eq 'object');
     
         my $term = $args{term};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objectclass/)){
    +        return (0, "can't delete from external ontology", $term);
    +    }
    +
         my $LSID;
         unless ($term =~ /urn\:lsid/){$LSID = $self->getObjectURI($term)} else {$LSID=$term}
         return (0, q{Object type $term cannot be resolved to an LSID},"") unless $LSID;
     
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select object_id, object_lsid from object where object_type = ?},undef,$term);
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select object_id, object_lsid from object where object_lsid = ?},undef,$LSID);
         # object1_id ISA object2_id?
         my (@isa) = $self->dbh->selectrow_array(q{select * from object_term2term where object2_id = ?},undef, $id);
         if (scalar @isa){
    @@ -415,6 +427,10 @@
         my $term = $args{term};
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
     
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){
    +        return (1, "external ontology", $term);
    +    }
    +
         my $sth;
         if ($term =~ /^urn\:lsid/){
             $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_lsid = ?");
    @@ -446,6 +462,10 @@
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -475,11 +495,17 @@
         my ($self, %args) = @_;
         return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'service');
         my $term = $args{term};
    -    my $LSID;
    -    unless ($term =~ /urn\:lsid/){$LSID = $self->getServiceURI($term)} else {$LSID=$term}
    -    return (0, q{Service type $term cannot be resolved to an LSID},"") unless $LSID;
     
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select service_id, service_lsid from service where service_type = ?},undef,$term);
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){
    +        return (0, "can't delete from external ontology", $term);
    +    }
    +
    +    my $LSID;    
    +    unless ($term =~ /^urn:lsid:biomoby.org:servicetype/){$LSID = $self->getServiceURI($term)} else {$LSID=$term}
    +    return (0, q{Service type $term cannot be resolved to an LSID in the MOBY ontologies},"") unless $LSID;
    +
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select service_id, service_lsid from service where service_lsid = ?}, undef, $LSID);
    +
         if (!defined $id){
             return (0, q{Service type $term does not exist in the ontology},$lsid);
         }
    @@ -514,7 +540,11 @@
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
     
         my $sth;
    -    if ($term =~ /^urn\:lsid/){
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){
    +        return (1, "external ontology", $term);
    +    }
    +        
    +    if ($term =~ /^urn:lsid:biomoby.org:namespacetype/){
             $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_lsid = ?");
         } else {
             $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_type = ?");
    @@ -540,10 +570,14 @@
     			#authority => $auth,
     			#contact_email => $email);
         return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'namespace');
    -    return (0, "requires a object type node",'') unless ($args{node});
    +    return (0, "requires a namespace type node",'') unless ($args{node});
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -575,8 +609,12 @@
         my $LSID;
         unless ($term =~ /urn\:lsid/){$LSID = $self->getNamespaceURI($term)} else {$LSID=$term}
         return (0, q{Namespace type $term cannot be resolved to an LSID},"") unless $LSID;
    +
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){
    +        return (0, "cannot delete a term from an external ontology", $term);
    +    }
         
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select namespace_id, namespace_lsid from namespace where namespace_type = ?},undef,$term);
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select namespace_id, namespace_lsid from namespace where namespace_lsid = ?},undef,$LSID);
         unless ($id){return (0, q{Namespace type $term does not exist in the ontology},$lsid)}
     
         # service1_id ISA service2_id?
    @@ -839,7 +877,7 @@
     sub setURI {
         my ($self, $id) = @_;
         my $URI;
    -    $id = lc($id);
    +    # $id = lc($id);
         if ($self->ontology eq 'object'){
             $URI = "urn:lsid:biomoby.org:objectclass:$id"
         } elsif ($self->ontology eq 'namespace'){
    @@ -847,7 +885,7 @@
         } elsif ($self->ontology eq 'service'){
             $URI = "urn:lsid:biomoby.org:servicetype:$id"
         } elsif ($self->ontology eq 'relationship'){
    -        $URI = "urn:lsid:biomoby.org:servicetype:$id"
    +        $URI = "urn:lsid:biomoby.org:relationshiptype:$id"
         } else {
             $URI = 0
         }
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v
    retrieving revision 1.2
    retrieving revision 1.3
    diff -u -r1.2 -r1.3
    --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2003/05/08 15:08:03	1.2
    +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2003/12/02 00:23:23	1.3
    @@ -197,8 +197,8 @@
         if ($self->service_type){
             my $OE = MOBY::OntologyServer->new(ontology => 'service');
             my ($success, $message, $servicetypeURI) = $OE->serviceExists(term => $self->service_type);
    -        unless ($success){return undef}
    -        $self->service_type_uri($servicetypeURI);
    +        unless (($success || (($self->service_type =~ /urn:lsid/i) && !($self->service_type =~ /urn:lsid:biomoby.org/i)))){return undef}
    +        ($self->service_type =~ /urn:lsid/)?$self->service_type_uri($self->service_type):$self->service_type_uri($servicetypeURI);
         }
         
         my ($serviceid, $category, $name, $typeURI, $authid,$url,$email,$authoritative,$desc) = $dbh->selectrow_array( # does this service already exist?
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec  1 19:57:15 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 1 Dec 2003 19:57:15 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312020057.hB20vFsF021742@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec  1 19:57:15 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv21719/MOBY
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    I just remembered that Martin objected to me calling the non-MOBY services 'soap' services, so I now call them 'wsdl' services.  Also fixed some more documentation errors, and fixed an error in the test suite.
    
    moby-live/Perl/MOBY Central.html,1.10,1.11 Central.pm,1.114,1.115
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v
    retrieving revision 1.10
    retrieving revision 1.11
    diff -u -r1.10 -r1.11
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:23:23	1.10
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:57:15	1.11
    @@ -27,7 +27,6 @@
     		
  • deregisterServiceType
  • registerNamespace
  • deregisterNamespace
  • -
  • retrieveRelationshipTypes
  • registerService
  • registerServiceWSDL
  • deregisterService
  • @@ -301,24 +300,6 @@

    ...Registration Object...

    -

    retrieveRelationshipTypes

    -
      -
    • used to remove a Namespace from the controlled vocabulary
      -
    • -
    • will fail if that namespace is being used by any services
      -
    • -
    • you will recieve an email for confirmation of the deregistration
      -
    • -
    -

    Input XML :

    -
    -        <deregisterNamespace>
    -           <namespaceType>MyNamespace</namespaceType>
    -        </deregisterNamespace>
    -

    Ouptut XML :

    -

    ...Registration Object...

    -

    -

    registerService

    • all elements are required
      =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.114 retrieving revision 1.115 diff -u -r1.114 -r1.115 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/02 00:23:23 1.114 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/02 00:57:15 1.115 @@ -812,43 +812,16 @@ } - -=head2 retrieveRelationshipTypes - -=over 3 - -=item * used to remove a Namespace from the controlled vocabulary - -=item * will fail if that namespace is being used by any services - -=item * you will recieve an email for confirmation of the deregistration - -=back - - -Input XML : - - - MyNamespace - - -Ouptut XML : - -...Registration Object... - - =head2 registerService =over 3 =item * all elements are required -=item * a service must have at least one Input OR Output Object Class. +=item * a service must have at least one Input OR Output Object Class. Either Input or Output may be blank to represent "PUT" or "GET" services respectively =item * the contactEmail address must be valid, as it is used to authorize deregistrations and changes to the service you registered. -=item * the Object Classes, Namespaces, and Service Types must all exist for the registration to be successful, so make sure you register these first, or ensure that they already exist in their respective ontologies. - =item * the "authoritativeService" tag is used to indicate whether or not the registered service is "authoritative" for that transformation. i.e. if anyone else were to perform the same transformation they would have to have obtained the information to do so from you. This is similar to, but not necessarily identical to, mirroring someone elses data, since the data in question may not exist prior to service invocation. =item * only Input Secondary articles are defined during registration; Output Secondary objects are entirely optional and may or may not be interpreted Client-side using their articleName tags. @@ -859,7 +832,17 @@ =item * moby - for services that use the MOBY SOAP messaging format and object structure (i.e. the objects used in service transaction inherit from the root 'Object' Class in the MOBY Class ontology). -=item * soap - for other SOAP services that do not use the MOBY messaging format. The other elements in the registration should be interpreted as follows: +=over 2 + +=item * authURI - a URI representing your organization (e.g. yourdomain.com); no http-prefix, and no trailing path information is allowed. + +=item * serviceName - an arbitrary, but unique, name for your service within your authURI namespace + +=item * URL - the URL to a SOAP CGI server that can invoke a method as described by your serviceName + +=back + +=item * wsdl - for other SOAP services that do not use the MOBY messaging format. The other elements in the registration should be interpreted as follows: =over 2 @@ -869,17 +852,19 @@ =item * URL - the URL from which a WSDL document describing your service can be retrieved by an HTTP GET call. -=item * Comments about Input and Output: +=back + +=item * Comments about Input and Output for MOBY and non-MOBY services =over 2 =item * in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class. -=item * For "soap" services, there is additional flexibility: +=item * For "wsdl" services, there is additional flexibility: =over 2 -=item * Similar to a "moby" service, your "soap" service must consume/produce named data types. These are represented as LSID's +=item * Similar to a "moby" service, your "wsdl" service must consume/produce named data types. These are represented as LSID's =item * YOU DO NOT NEED TO REGISTER THESE DATA TYPES in MOBY Central; it is up to you what your LSID's represent, and MOBY Central WILL NOT try to resolve them! @@ -905,7 +890,6 @@ =back -=back Input XML : @@ -1063,10 +1047,14 @@ $error .="missing Category \n" unless defined $Category; return &_error("malformed payload $error\n\n","") if ($error); - return &_error("Category may take the (case sensitive) values 'moby', 'cgi', 'soap'\n","") unless (($Category eq "est") || ($Category eq "cgi") || ($Category eq "moby")); + return &_error("Category may take the (case sensitive) values 'moby', 'cgi', 'soap'\n","") unless ( + ($Category eq "wsdl") +# || ($Category eq "cgi") + || ($Category eq "moby") + ); $debug && &_LOG("Entering switch with $Category method\n"); - return &_error("Service categories other than 'moby' and 'soap' are not yet implemented","") unless ($Category eq "moby" || $Category eq "soap"); + return &_error("Service categories other than 'moby' and 'wsdl' are not yet implemented","") unless ($Category eq "moby" || $Category eq "wsdl"); my @IN = @{$INPUTS}; my @OUT = @{$OUTPUTS}; my @SECS = @{$SECONDARY}; From mwilkinson at pub.open-bio.org Mon Dec 1 19:57:16 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:57:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020057.hB20vGuu021766@pub.open-bio.org> mwilkinson Mon Dec 1 19:57:15 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv21719/MOBY/Client Modified Files: Central.html Central.pm Log Message: I just remembered that Martin objected to me calling the non-MOBY services 'soap' services, so I now call them 'wsdl' services. Also fixed some more documentation errors, and fixed an error in the test suite. moby-live/Perl/MOBY/Client Central.html,1.12,1.13 Central.pm,1.63,1.64 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/02 00:23:23 1.12 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/02 00:57:15 1.13 @@ -245,8 +245,8 @@ authURI => $authURI, contactEmail => "your at mail.address", description => $human_readable_description, - category => "moby" | "cgi" | "soap" (currently only moby supported) - URL => $URL_TO_SERVICE
    + category => "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported) + URL => $URL_TO_SERVICE (or URL to WSDL document for wsdl-type services)
         input:      listref; (articleName may be undef) 
                 input =>[
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.63
    retrieving revision 1.64
    diff -u -r1.63 -r1.64
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:23:23	1.63
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:57:15	1.64
    @@ -621,8 +621,8 @@
          authURI      => $authURI,      
          contactEmail => "your at mail.address",      
          description => $human_readable_description, 
    -     category  =>  "moby" | "cgi" | "soap" (currently only moby supported)
    -     URL    =>  $URL_TO_SERVICE
    +     category  =>  "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported)
    +     URL    =>  $URL_TO_SERVICE  (or URL to WSDL document for wsdl-type services)
     
         input:	listref; (articleName may be undef) 
                 input =>[
    @@ -670,8 +670,8 @@
     	my $email = $a{contactEmail}; $email ||="";
     	my $URL = $a{URL}; $URL ||="";
     	my $desc = $a{description}; $desc ||="";
    -	my $Category = lc($a{Category}); $Category ||="moby";
    -	return $self->errorRegXML("Only MOBY Service Categories are currently allowed") unless ($Category eq 'moby');
    +	my $Category = lc($a{category}); chomp $Category; $Category ||="";
    +	return $self->errorRegXML("Only 'moby' and 'wsdl' Service Categories are currently allowed - you gave me $Category") unless (($Category eq 'moby') || ($Category eq 'wsdl'));
     	return $self->errorRegXML("All Fields Required:  serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary") unless (
     		$name && $type && $authURI && $email && $URL && $desc && $Category);
     
    @@ -685,7 +685,7 @@
     			$authURI
     			$email";
     
    -	if ($Category eq "moby") {
    +	if ($Category eq "moby" || $Category eq 'soap') {
     		my %SEC;
     		if ($a{'secondary'} && ref($a{'secondary'} =~ /hash/i)){
     			%SEC = %{$a{secondary}}
    @@ -778,7 +778,7 @@
     		}
     		$message .= "\n";
     		$message .= "";
    -	} else {	return $self->errorRegXML("cannot register services with a client initialized with multiple registries")}
    +	} else {	return $self->errorRegXML("only 'moby' and 'wsdl' service types are allowed to be registered at this time.")}
     
     	#elsif ($Category eq "cgi") {
     	#		my $IN = $a{input}; 
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec  1 20:08:24 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 1 Dec 2003 20:08:24 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312020108.hB218O1t021842@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec  1 20:08:24 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv21819/Perl/MOBY
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    still calling Collection articles 'Complex' articles.  This is confusing.  It is now consistent thorughout the documentation
    
    moby-live/Perl/MOBY Central.html,1.11,1.12 Central.pm,1.115,1.116
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v
    retrieving revision 1.11
    retrieving revision 1.12
    diff -u -r1.11 -r1.12
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:57:15	1.11
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 01:08:24	1.12
    @@ -304,12 +304,10 @@
     
     
      Input XML :
    @@ -372,13 +378,13 @@
                    human readable COMPREHENSIVE description of your service]]>
              </Description>
              <Input>
    -              <!-- zero or more Primary (Simple and/or Complex) articles -->
    +              <!-- zero or more Primary (Simple and/or Collection) articles -->
              </Input>
              <secondaryArticles>
                   <!-- zero or more INPUT Secondary articles -->
              </secondaryArticles>
              <Output>
    -              <!-- zero or more Primary (Simple and/or Complex) articles --> 
    +              <!-- zero or more Primary (Simple and/or Collection) articles --> 
              </Output>
           </registerService>
    @@ -553,10 +559,10 @@
             <contactEmail>your at email.address</contactEmail>
             <URL>http://endpoint.of.service</URL>;
             <Input>
    -                 <!-- one or more Simple and/or Complex Primary articles -->
    +                 <!-- one or more Simple and/or Collection Primary articles -->
             </Input>
             <Output>
    -                 <!-- one or more Simple and/or Complex Primary articles --> 
    +                 <!-- one or more Simple and/or Collection Primary articles --> 
             </Output>
             <secondaryArticles>
                      <!-- one or more Secondary articles -->
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.115
    retrieving revision 1.116
    diff -u -r1.115 -r1.116
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 00:57:15	1.115
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 01:08:24	1.116
    @@ -905,13 +905,13 @@
                    human readable COMPREHENSIVE description of your service]]>
              
              
    -              
    +              
              
              
                   
              
              
    -               
    +               
              
           
     
    @@ -1019,13 +1019,12 @@
     #  http://URL.to.your/CGI.pl
     #  your.URI.here
     #  
    -#     
    +#     
     #  
     #  
    -#     
    +#     
     #  
     #  
    -#     
     #  
     #  
    @@ -1119,7 +1118,7 @@
         my $dbh = $SVC->dbh;
         return  (-1,'Bad node') unless $node->getNodeType == ELEMENT_NODE;
     
    -    # this is a Simple or a Complex object
    +    # this is a Simple or a Collection object
         my $simp_coll = $node->getTagName;
     	$debug && &_LOG("TAGNAME in $inout _registerArticle is $simp_coll");
     	
    @@ -1431,10 +1430,10 @@
     	your at email.address
     	http://endpoint.of.service
     	
    -		 
    +		 
     	
     	
    -		  
    +		  
     	
     	
     		 
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:06:51 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:06:51 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092106.hB9L6pJU028188@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:06:51 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28169/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    added a generic server-side parser to CommonSubs that should basically do all of the work for you and be compatible with the 0.6 API.  Not yet documented; just testing on my own services first.
    
    moby-live/Perl/MOBY CommonSubs.pm,1.28,1.29
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.28
    retrieving revision 1.29
    diff -u -r1.28 -r1.29
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/11/12 16:47:16	1.28
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:06:51	1.29
    @@ -143,9 +143,17 @@
     use XML::DOM;
     use MOBY::CrossReference;
     use MOBY::Client::OntologyServer;
    +use strict;
    +use warnings;
     
    - at ISA = qw(Exporter);
    - at EXPORT_OK = qw(
    +use constant COLLECTION => 1;
    +use constant SIMPLE => 2;
    +use constant BE_NICE => 1;
    +use constant BE_STRICT => 0;
    +
    +our @ISA = qw(Exporter);
    +our @EXPORT = qw(COLLECTION SIMPLE BE_NICE BE_STRICT);
    +our @EXPORT_OK = qw(
         getSimpleArticleIDs
         getSimpleArticleNamespaceURI
         simpleResponse
    @@ -165,8 +173,13 @@
         extractResponseArticles
         getResponseArticles
         getCrossReferences
    +    genericServiceInputParser
    +    COLLECTION
    +    SIMPLE
    +    BE_NICE
    +    BE_STRICT
         );
    -%EXPORT_TAGS =(all => [qw(
    +our %EXPORT_TAGS =(all => [qw(
         getSimpleArticleIDs
         getSimpleArticleNamespaceURI
         simpleResponse
    @@ -186,9 +199,39 @@
         extractResponseArticles
         getResponseArticles
         getCrossReferences
    +    genericServiceInputParser
    +    COLLECTION
    +    SIMPLE
    +    BE_NICE
    +    BE_STRICT
         )]);
     
     
    +
    +sub genericServiceInputParser {
    +    my ($message, $namespaces) = @_;  # get the incoming MOBY query XML
    +    my @inputs;           # set empty response
    +    my @queries = getInputs($message);  # returns XML::DOM nodes
    +    
    +    foreach my $query(@queries){
    +        my $queryID = getInputID($query);  # get the queryID attribute of the queryInput
    +        my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query
    +        foreach my $input(@input_articles){       # input is a listref
    +           my ($articleName, $article) = @{$input}; # get the named article
    +           my $simple = isSimpleArticle($article);  # articles may be simple or collection
    +           my $collection = isCollectionArticle($article);
    +            if ($collection){
    +                my @simples = getCollectedSimples($article);
    +                push @inputs, [COLLECTION,$queryID, \@simples];
    +
    +            } elsif ($simple){
    +                push @inputs, [SIMPLE,$queryID,$simple];
    +            }
    +        }
    +    }
    +    return @inputs;
    +}
    +
     #################################################
     					 ##################################
     					 ##################################
    @@ -482,7 +525,7 @@
     sub getInputs {
     
     	my ($XML) = @_;
    -
    +    my $moby;
         unless (ref($XML) =~ /XML\:\:DOM/){
             my $parser = new XML::DOM::Parser;
             my $doc = $parser->parse($XML);
    @@ -573,7 +616,7 @@
         return undef unless $moby->getNodeType == ELEMENT_NODE;
         return undef unless ($moby->getTagName =~ /queryInput/ || $moby->getTagName =~ /queryResponse/);
         my @articles;
    -    foreach $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +    foreach my $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
             next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
             next unless ($child->getTagName =~ /Simple/ || $child->getTagName =~ /Collection/);
             my $articleName = $child->getAttribute('articleName');
    @@ -608,7 +651,7 @@
         return undef unless ($moby->getTagName =~ /Collection/);
         
         my @articles;
    -    foreach $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +    foreach my $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
             next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
             next unless ($child->getTagName =~ /Simple/);
             push @articles, $child;   # take the child elements, which are  or 
    @@ -667,7 +710,7 @@
         my @queries;
         for (0..$x->getLength-1){ # there may be more than one queryInput per message
     		my @this_query;
    -        foreach $child($x->item($_)->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +        foreach my $child($x->item($_)->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
                 next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
                     push @this_query, $child;   # take the child elements, which are  or 
             }
    @@ -814,7 +857,7 @@
             $nodes = $node->getElementsByTagName("moby:$element");
         }
     	for (0..$nodes->getLength-1){
    -        $child = $nodes->item($_);
    +        my $child = $nodes->item($_);
     		if (
                 (($child->getAttribute("articleName")) && (($child->getAttribute("articleName") eq $articleName)))
                 || (($child->getAttribute("moby:articleName")) && (($child->getAttribute("moby:articleName") eq $articleName)))){
    @@ -859,6 +902,29 @@
     }
     
     
    +
    +
    +=head2 validateThisNamespace
    +
    + name     : validateThisNamespace
    + function : checks a given namespace against a list of valid namespaces
    + usage    : $valid = validateThisNamespace($ns, @validNS);
    + args     : ordered list of the namespace of interest and the list of valid NS's
    + returns  : boolean
    +
    +
    +=cut
    +
    +
    +sub validateThisNamespace {
    +    my ($ns, @namespaces) = @_;
    +    foreach (@namespaces){
    +        return 1 if $ns eq $_;
    +    }
    +    return 0;
    +}
    +
    +
     =head2 getResponseArticles (a.k.a. extractResponseArticles)
     
      name     : getResponseArticles
    @@ -976,7 +1042,7 @@
             }
         }
         foreach (@xrefs){
    -        $x = &_makeXrefType($_) if $_->getTagName =~/Xref/;
    +        my $x = &_makeXrefType($_) if $_->getTagName =~/Xref/;
             $x = &_makeObjectType($_) if $_->getTagName =~ /Object/;
             push @XREFS, $x if $x;
         }
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:06:51 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:06:51 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092106.hB9L6phR028208@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:06:51 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28169/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    added a generic server-side parser to CommonSubs that should basically do all of the work for you and be compatible with the 0.6 API.  Not yet documented; just testing on my own services first.
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.36,1.37
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.36
    retrieving revision 1.37
    diff -u -r1.36 -r1.37
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/10/21 14:09:21	1.36
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 21:06:51	1.37
    @@ -8,6 +8,8 @@
     
     use strict;
     use SOAP::Lite;
    +use DBI;
    +use DBD::mysql;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -26,37 +28,27 @@
                                            # last parameter passed to the subroutine
     
     sub getGoTerm {
    +    my ($caller, $message) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($message, []); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my $SOM = pop;  # NOTA BENE!!  You only do this if you have set @ISAQ = qw(SOAP::Server::Parameters) above!!!!!
    -    my ($self, $data) = @_;
    -    my $response = "";
    -	my @accessions;
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'GO');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace GO does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +    my @validNS = validateNamespaces();  # ONLY do this if you are intending to be namespace aware!
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data);
    -	foreach (@input_nodes){
    -		my ($input) = @{$_}; # this service only allows one input per query, so take the first
    -		my $ns = getSimpleArticleNamespaceURI($input);
    -		push @accessions, undef unless $ns eq $VALID_NAMESPACE; # if we have been sent an invalid namespace, then stack an undef as a response
    -		my ($id) = getSimpleArticleIDs($ns, [$input]);
    -		if (defined $id){
    -			push @accessions, $id;
    -		} else {
    -			push @accessions, undef;
    -		}
    +	my @accessions;
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			((push @accessions, undef) && (next)) unless validateThisNamespace($ns, @validNS);
    +			push @accessions, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):1;
    +        }
         }
    -
    -    use DBI;
    -    use DBD::mysql;
         my $dbh = _dbAccess('go');
    -    die "can't connecvt to database\n" unless $dbh;
    +    die "can't connect to GO database\n" unless $dbh;
         my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
         
         foreach my $acc(@accessions){
    @@ -66,20 +58,16 @@
             $sth->execute($acc);        
             my ($term, $def) = $sth->fetchrow_array;
             if ($term){
    -            $response .= simpleResponse("
    +            $MOBY_RESPONSE .= simpleResponse("
                     
                         $term
                         $def
                     ")
             } else {
    -            $response .= simpleResponse("")
    +            $MOBY_RESPONSE .= simpleResponse("")
             }
         }
    -
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    -    
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
     
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:23:24 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:23:24 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092123.hB9LNOTl028369@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:23:24 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28350/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    dumb dumb dumb dumb
    
    moby-live/Perl/MOBY CommonSubs.pm,1.29,1.30
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.29
    retrieving revision 1.30
    diff -u -r1.29 -r1.30
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:06:51	1.29
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:23:24	1.30
    @@ -209,7 +209,7 @@
     
     
     sub genericServiceInputParser {
    -    my ($message, $namespaces) = @_;  # get the incoming MOBY query XML
    +    my ($message) = @_;  # get the incoming MOBY query XML
         my @inputs;           # set empty response
         my @queries = getInputs($message);  # returns XML::DOM nodes
         
    @@ -225,7 +225,7 @@
                     push @inputs, [COLLECTION,$queryID, \@simples];
     
                 } elsif ($simple){
    -                push @inputs, [SIMPLE,$queryID,$simple];
    +                push @inputs, [SIMPLE,$queryID,$article];
                 }
             }
         }
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:30:33 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:30:33 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092130.hB9LUXWW028465@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:30:33 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28446/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    dumb dumb dumb dumb
    
    moby-live/Perl/MOBY CommonSubs.pm,1.30,1.31
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.30
    retrieving revision 1.31
    diff -u -r1.30 -r1.31
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:23:24	1.30
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:30:33	1.31
    @@ -168,6 +168,7 @@
         extractRawContent
         collectionResponse
         validateNamespaces
    +    validateThisNamespace
         isSimpleArticle
         isCollectionArticle
         extractResponseArticles
    @@ -194,6 +195,7 @@
         extractRawContent
         collectionResponse
         validateNamespaces
    +    validateThisNamespace
         isSimpleArticle
         isCollectionArticle
         extractResponseArticles
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 16:38:39 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:38:39 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092138.hB9LcdU5028578@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:38:39 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28559/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    initialize possibly undef values
    
    moby-live/Perl/MOBY CommonSubs.pm,1.31,1.32
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.31
    retrieving revision 1.32
    diff -u -r1.31 -r1.32
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:30:33	1.31
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:38:39	1.32
    @@ -370,8 +370,12 @@
     
     sub simpleResponse {
         my ($data, $articleName, $qID) = @_;  # articleName optional
    -    $data ||='';
         $qID = &_getQueryID($qID) if ref($qID) =~ /XML::DOM/; # in case they send the DOM instead of the ID
    +
    +    $data ||='';  # initialize to avoid uninit value errors
    +    $qID ||="";
    +    $articleName ||="";
    +    
         if ($articleName) {
             return "
             
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:24:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:24:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092224.hB9MO3AB028801@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:24:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28763/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    updating my GO services to be 0.6 compliant and a bit more readable
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.37,1.38
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.37
    retrieving revision 1.38
    diff -u -r1.37 -r1.38
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 21:06:51	1.37
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:24:03	1.38
    @@ -10,6 +10,7 @@
     use SOAP::Lite;
     use DBI;
     use DBD::mysql;
    +use GO::AppHandle;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -24,85 +25,60 @@
     #getNodeContentWithArticle
     
     use vars qw(@ISA);
    - at ISA = qw(SOAP::Server::Parameters);   # uncomment this line if you want access to the SOM as the
    -                                       # last parameter passed to the subroutine
     
     sub getGoTerm {
         my ($caller, $message) = @_;
         my $MOBY_RESPONSE;
    -    my (@inputs)= genericServiceInputParser($message, []); # ([SIMPLE, $queryID, $simple],...)
    +    my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...)
         return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my @validNS = validateNamespaces();  # ONLY do this if you are intending to be namespace aware!
    +    my @validNS = validateNamespaces("GO");  # ONLY do this if you are intending to be namespace aware!
    +
    +    my $dbh = _dbAccess('go');
    +    die "can't connect to GO database\n" unless $dbh;
    +    my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
     
    -	my @accessions;
         foreach (@inputs){
             my ($articleType, $ID, $input) = @{$_};
             unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $ID) ;
    +            $MOBY_RESPONSE .= simpleResponse("", "Collection_Article_Not_allowed_as_input", $ID);
                 next;
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
    -			((push @accessions, undef) && (next)) unless validateThisNamespace($ns, @validNS);
    -			push @accessions, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):1;
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $accession = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			unless (defined($accession)){
    +				$MOBY_RESPONSE .= simpleResponse("", "Invalid_Accession", $ID);
    +				next;
    +			}
    +			unless ($accession =~/^GO:/){
    +				$accession = "GO:$accession";  # we still haven't decided on whether id's should include the prefix...
    +			}
    +			$sth->execute($accession);        
    +			my ($term, $def) = $sth->fetchrow_array;
    +			if ($term){
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						$term
    +						$def
    +					", "GO_Term_From_ID", $ID)
    +			} else {
    +				$MOBY_RESPONSE .= simpleResponse("", "NO_Term_Found", $ID)
    +			}
             }
         }
    -    my $dbh = _dbAccess('go');
    -    die "can't connect to GO database\n" unless $dbh;
    -    my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
         
    -    foreach my $acc(@accessions){
    -		unless ($acc =~/^GO:/){
    -			$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    -		}
    -        $sth->execute($acc);        
    -        my ($term, $def) = $sth->fetchrow_array;
    -        if ($term){
    -            $MOBY_RESPONSE .= simpleResponse("
    -                
    -                    $term
    -                    $def
    -                ")
    -        } else {
    -            $MOBY_RESPONSE .= simpleResponse("")
    -        }
    -    }
         return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
    -
     sub getGoTermAssociations {
    +    my ($caller, $message) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my $SOM = pop;  
    -    my ($self, $data) = @_;
    -    my $response = "";
    -	my @accessions;
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'GO');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace GO does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data);
    -	foreach (@input_nodes){
    -		my ($input) = @{$_}; # this service only allows one input per query, so take the first
    -		my $ns = getSimpleArticleNamespaceURI($input);
    -		push @accessions, undef unless $ns eq $VALID_NAMESPACE; # if we have been sent an invalid namespace, then stack an undef as a response
    -		my ($id) = getSimpleArticleIDs($ns, [$input]);
    -		if (defined $id){
    -			push @accessions, $id;
    -		} else {
    -			push @accessions, undef;
    -		}
    -    }
    -
    -    use DBI;
    -    use DBD::mysql;
         my $dbh = _dbAccess('go');
    -    die "can't connecvt to database\n" unless $dbh;
    +    die "can't connect to database\n" unless $dbh;
         my $sth = $dbh->prepare("
     		select
     			gp.symbol,
    @@ -125,27 +101,39 @@
     		and a.is_not = 0
     		and t.id = d.term_id 
     		order by species_id");
    -							
    -    foreach my $acc(@accessions){
    -		unless ($acc =~/^GO:/){
    -			$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    -		}
    -		my @simples;
    -        $sth->execute($acc);
    -        while (my ($symb, $sp, $namsp, $type, $name, $def) = $sth->fetchrow_array){
    -            my $response_data .= "\n";
    -			$response_data .= "	\n";
    -			$response_data .= "		\n";
    -			$response_data .= "		\n";
    -            $response_data .= "	\n";
    -            $response_data .= "\n";
    -			push @simples, $response_data;
    +
    +    my @validNS = validateNamespaces("GO");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= collectionResponse([], "Collection_Article_Input_Invalid", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= $MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $acc, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			unless (defined($acc)){
    +				$MOBY_RESPONSE .= collectionResponse([], "Invalid_Accession", $ID);
    +				next;
    +			}
    +			unless ($acc =~/^GO:/){
    +				$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    +			}
    +			my @simples;
    +			$sth->execute($acc);
    +			while (my ($symb, $sp, $namsp, $type, $name, $def) = $sth->fetchrow_array){
    +				my $response_data .= "\n";
    +				$response_data .= "	\n";
    +				$response_data .= "		\n";
    +				$response_data .= "	\n";
    +				$response_data .= "\n";
    +				push @simples, $response_data;
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples,"Known_GO_Term_Associations",$ID); # after all images have been collected, create the collection
             }
    -		$response .= collectionResponse(\@simples); # after all images have been collected, create the collection
         }
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
         
     }
     
    @@ -153,67 +141,51 @@
     sub RetrieveGOFromKeywords {
     	my $SOM = pop; 	
     	my ($self, $query) = @_;
    -	use GO::AppHandle;
    -
    -	my $ua = new LWP::UserAgent;
    -	my $req = new HTTP::Request GET => 'http://www.godatabase.org/dev/database/server.cfg';
    -	my $res = $ua->request($req);
    +	# INITIALIZE CONNECTION TO GO DB
     	my $host; my $dbname;
     	$host = "sin.lbl.gov";
     	$dbname = "go";
    -#	if ($res->is_success) {
    -	#	my $resp =  $res->content;
    -	#	if ($resp =~ /(\w+)\@(\S+)/){
    -	#		$host = $2;
    -	#		$dbname= $1;
    -	#	} else {
    -	#		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	#	}
    -	#}
     	my %connect_hash;
     	$connect_hash{-dbname}=$dbname;
     	$connect_hash{-dbhost}=$host;
    -	
     	my $GO_API = GO::AppHandle->connect(%connect_hash);
     	unless ($GO_API){
     		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
     	}
    +	# DB is now initialized
     	
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'Global_Keyword');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace Global_Keyword does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($query); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($query); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my $response;
    -	foreach (@input_nodes){
    -		my $input =  $_->[0];  # we only allow one input object per query
    -		my ($kw) = getSimpleArticleIDs($VALID_NAMESPACE, [$input]);
    -		($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
    -		my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    -		next unless($terms[0]);
    -		my @simples;
    -		foreach my $term(@terms){
    -			my $acc = $term->public_acc;
    -			my $def = $term->definition;
    -			my $name = $term->name;
    -            push @simples, "
    -                    
    -						
    -					
    -                    $name
    -                    $def
    -                ";
    +    my @validNS = validateNamespaces("Global_Keyword");  # ONLY do this if you are intending to be namespace aware!
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= collectionResponse([], "Collection_Input_Invalid", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $kw = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +            ($MOBY_RESPONSE .= collectionResponse([], "No_Keyword", $ID) && (next)) unless defined $kw;
    +			($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
    +			my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    +			next unless($terms[0]);
    +			my @simples;
    +			foreach my $term(@terms){
    +				my $acc = $term->public_acc;
    +				my $def = $term->definition;
    +				my $name = $term->name;
    +				push @simples, "
    +						$name
    +						$def
    +					";
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples, "GO_terms_from_keywords", $ID);
     		}
    -		$response .= collectionResponse(\@simples);
    -	}
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse	
    +    }
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
     
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:24:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:24:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092224.hB9MO30d028782@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:24:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28763/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    updating my GO services to be 0.6 compliant and a bit more readable
    
    moby-live/Perl/MOBY CommonSubs.pm,1.32,1.33
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.32
    retrieving revision 1.33
    diff -u -r1.32 -r1.33
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:38:39	1.32
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 22:24:03	1.33
    @@ -248,16 +248,16 @@
      function : to get the IDs of simple articles that are in the given namespace
      usage    : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles);
      args     : (in order)
    -            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology
    +            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
                 \@Simples   - (required) a listref of Simple XML::DOM nodes
                               i.e. the XML::DOM representing an XML structure like this:
                                   
                                       
                                   
    - note     : it will return *only* the ids that are in the given namespace
    + note     : it will return *only* the ids that are in the given namespace, if you provide one
                 but since you are required to return an output for every input
                 (even if it is invalid) this routine will return undef for
    -            those articles that are not in that namespace
    +            those articles in the list that are not in that namespace so you can keep track
     
     =cut
     
    @@ -271,45 +271,52 @@
     	my @input_nodes = @{$input_nodes};
     	my $OS = MOBY::Client::OntologyServer->new;
     	my ($s, $m);
    -	($s, $m, $desired_namespace) = $OS->namespaceExists(term => $desired_namespace); # returns (success, message, lsid)
    -	return undef unless $s;  # bail if not successful
    +    if ($desired_namespace){
    +        ($s, $m, $desired_namespace) = $OS->namespaceExists(term => $desired_namespace); # returns (success, message, lsid)
    +    	unless ($s){  # bail if not successful
    +            print STDERR "MOBY::CommonSubs WARNING ** the namespace $desired_namespace does not exist in the MOBY ontology, and is not a valid LSID\n";
    +            return undef;
    +    	}
    +    }
     
    -	my @accessions;	
    +	my @ids;	
     	foreach my $in(@input_nodes){
     		#$in = ""
             next unless $in->getNodeName =~ /simple/i;  # only allow simples
     		my @simples = $in->getChildNodes;
     		foreach (@simples){ # $_ = 
     			next unless $_->getNodeType == ELEMENT_NODE;
    -			my $ns = $_->getAttributeNode('namespace');  # get the namespace DOM node
    -			$ns = $_->getAttributeNode('moby:namespace') unless ($ns);  # perhaps it is namespaced...
    -			unless ($ns){   # if we don't get it at all, then move on to the next input
    -				push @accessions, undef;  # but push an undef onto teh stack in order
    -				next;
    -			}
    -			$ns = $ns->getValue;   # if we have a namespace, then get its value
    -			($s, $m, $ns) = $OS->namespaceExists(term => $ns);
    -			
    -			unless ($ns eq $desired_namespace){  # we are registering as working in a particular namespace, so check this
    -				push @accessions, undef;  # and push undef onto the stack if it isn't 
    -				next;
    +			if ($desired_namespace){
    +                my $ns = $_->getAttributeNode('namespace');  # get the namespace DOM node
    +                $ns = $_->getAttributeNode('moby:namespace') unless ($ns);  # perhaps it is namespaced...
    +                unless ($ns){   # if we don't get it at all, then move on to the next input
    +                    push @ids, undef;  # but push an undef onto teh stack in order
    +                    next;
    +                }
    +                $ns = $ns->getValue;   # if we have a namespace, then get its value
    +                ($s, $m, $ns) = $OS->namespaceExists(term => $ns);
    +                
    +                unless ($ns eq $desired_namespace){  # we are registering as working in a particular namespace, so check this
    +                    push @ids, undef;  # and push undef onto the stack if it isn't 
    +                    next;
    +                }
     			}
     			# Now do the same thing for ID's
     			my $id = $_->getAttributeNode('id');
     			$id = $_->getAttributeNode('moby:id') unless ($id);
     			unless ($id){
    -				push @accessions, undef;
    +				push @ids, undef;
     				next;
     			}
     			$id = $id->getValue;
     			unless (defined $id){  # it has to have a hope in hell of retrieving something...
    -				push @accessions, undef;  # otherwise push undef onto the stack if it isn't 
    +				push @ids, undef;  # otherwise push undef onto the stack if it isn't 
     				next;
     			}
    -			push @accessions, $id;
    +			push @ids, $id;
     		}
     	}
    -	return @accessions;
    +	return @ids;
     }
     
     
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:47:16 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:47:16 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092247.hB9MlGoI028900@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:47:16 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28881/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    dumb.  I was picking up the results of the XML parse as a scalar instead of a list
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.38,1.39
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.38
    retrieving revision 1.39
    diff -u -r1.38 -r1.39
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:24:03	1.38
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:47:16	1.39
    @@ -46,7 +46,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $accession = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
     			unless (defined($accession)){
     				$MOBY_RESPONSE .= simpleResponse("", "Invalid_Accession", $ID);
     				next;
    @@ -112,7 +112,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= $MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $acc, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
     			unless (defined($acc)){
     				$MOBY_RESPONSE .= collectionResponse([], "Invalid_Accession", $ID);
     				next;
    @@ -167,7 +167,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $kw = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($kw) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
                 ($MOBY_RESPONSE .= collectionResponse([], "No_Keyword", $ID) && (next)) unless defined $kw;
     			($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
     			my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 17:56:19 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:56:19 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092256.hB9MuJrE028986@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:56:19 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28967/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    eek, I broke all my services.  I am no longer poping the SOM off the end of the argument list, since I never use it.  They should all kick back into life now
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.39,1.40
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.39
    retrieving revision 1.40
    diff -u -r1.39 -r1.40
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:47:16	1.39
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:56:19	1.40
    @@ -202,7 +202,6 @@
     #  =        namespace                            =
     #  ===============================================
     sub GenbankAccVirtualSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -246,7 +245,6 @@
         return $SOAPResponse
     }
     sub GenbankAccSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -291,7 +289,6 @@
         return $SOAPResponse   
     }
     sub GenbankGIVirtualSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -336,7 +333,6 @@
     }
     
     sub GenbankGISequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -389,7 +385,7 @@
     # and producing GenericSequence objects.  However, it will
     # actually produce DNA, RNA or PRotein objects, as appropriate
     # and will produce a cross-reference block as well
    -    my $SOM = pop;  
    +
         my ($self, $data) = @_;
         my $response; my @gis;
     
    @@ -476,7 +472,6 @@
     sub GenbankRecordRetrieve {
     	use Bio::SeqIO;
     	use IO::String;
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; # prepare a variable to hold the responses
     
    @@ -548,7 +543,7 @@
     #################################################
     
     sub getDragonMutantImages {
    -	my $SOM = pop;  
    +
         my ($self, $data) = @_;
     	use Ace;
     	use LWP::UserAgent;
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:22:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:22:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102222.hBAMM3QV032633@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:22:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv32614/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    minor changes to make some CommonSubs more friendly.  Also added a new service which is the beginning of me weaning myself off of GenBank because genbank is broken almost every time I need to use it.  The new service uses SeqHound to make the data lookups, so it is always 24 hours behind the real genbank, but thats not bad.  The new service consumes NCBI_Acc, NCBI_gi, PIR, Swissprot, EMBL, or PDB identifiers and returns the genbank record as a flatfile
    
    moby-live/Perl/MOBY CommonSubs.pm,1.33,1.34
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.33
    retrieving revision 1.34
    diff -u -r1.33 -r1.34
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 22:24:03	1.33
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/10 22:22:03	1.34
    @@ -247,24 +247,29 @@
      name     : getSimpleArticleIDs
      function : to get the IDs of simple articles that are in the given namespace
      usage    : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles);
    - args     : (in order)
    -            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
    +            my @ids = getSimpleArticleIDs(\@SimpleArticles);
    + args     : $Namespace  - (optional) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
                 \@Simples   - (required) a listref of Simple XML::DOM nodes
                               i.e. the XML::DOM representing an XML structure like this:
                                   
                                       
                                   
    - note     : it will return *only* the ids that are in the given namespace, if you provide one
    -            but since you are required to return an output for every input
    -            (even if it is invalid) this routine will return undef for
    -            those articles in the list that are not in that namespace so you can keep track
    + note     : If you provide a namespace, it will return *only* the ids that are in the given namespace,
    +            but will return 'undef' for any articles in the WRONG namespace so that you get an
    +            equivalent number of outputs to inputs.
    +            
    +            Note that if you call this with a single argument, this is assumed to
    +            be \@Articles, so you will get ALL id's regardless of namespace!
     
     =cut
     
     
     sub getSimpleArticleIDs {
     	my ($desired_namespace, $input_nodes) = @_;
    -	return undef unless $input_nodes;
    +	if ($desired_namespace && !($input_nodes)){  # if called with ONE argument, then these are the input nodes!
    +        $input_nodes = $desired_namespace;
    +        $desired_namespace = undef;   
    +	}
         $input_nodes = [$input_nodes] unless ref($input_nodes) =~ /ARRAY/; # be flexible!
     	return undef unless scalar @{$input_nodes};
     
    @@ -281,6 +286,7 @@
     
     	my @ids;	
     	foreach my $in(@input_nodes){
    +        next unless $in;
     		#$in = ""
             next unless $in->getNodeName =~ /simple/i;  # only allow simples
     		my @simples = $in->getChildNodes;
    @@ -932,6 +938,7 @@
     sub validateThisNamespace {
         my ($ns, @namespaces) = @_;
         foreach (@namespaces){
    +        next unless $_;
             return 1 if $ns eq $_;
         }
         return 0;
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:22:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:22:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102222.hBAMM3Ul032652@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:22:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv32614/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    minor changes to make some CommonSubs more friendly.  Also added a new service which is the beginning of me weaning myself off of GenBank because genbank is broken almost every time I need to use it.  The new service uses SeqHound to make the data lookups, so it is always 24 hours behind the real genbank, but thats not bad.  The new service consumes NCBI_Acc, NCBI_gi, PIR, Swissprot, EMBL, or PDB identifiers and returns the genbank record as a flatfile
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.40,1.41
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.40
    retrieving revision 1.41
    diff -u -r1.40 -r1.41
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:56:19	1.40
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:22:03	1.41
    @@ -7,6 +7,7 @@
     use lib "/export/home/root/BIOPERL/perl-api";
     
     use strict;
    +use SeqHound;
     use SOAP::Lite;
     use DBI;
     use DBD::mysql;
    @@ -23,6 +24,7 @@
     #responseFooter
     #getInputArticles
     #getNodeContentWithArticle
    +my $debug = 1;
     
     use vars qw(@ISA);
     
    @@ -201,49 +203,126 @@
     #  =        having a single service for each     =
     #  =        namespace                            =
     #  ===============================================
    -sub GenbankAccVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
     
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_Acc');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +sub _generic_service_template {
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +			# do your thing here!
    +        }
    +    }
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +}
    +
    +sub MOBYSHoundGetGenBankff {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
     	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc (@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetGenBankff($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "";
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "
    +					
    +						
    +					
    +					";
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "
    +					
    +						
    +					
    +					";
    +			}
     		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_acc($acc);
    -		my $length;
    -		if ($seq){$length = $seq->length;}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +}
    +
    +sub GenbankAccVirtualSequenceRetrieve {
    +    my ($self, $data) = @_;
    +
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +			(($MOBY_RESPONSE .= simpleResponse("", "no_input_object", $qID)) && (next)) unless (defined $input);
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse([], "Invalid_Namespace", $qID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +            ($MOBY_RESPONSE .= collectionResponse([], "No_Accession_provided", $qID) && (next)) unless defined $acc;
    +			use Bio::DB::GenBank;
    +			my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    +			my $seq = $gb->get_Seq_by_acc($acc);
    +			my $length;
    +			if ($seq){$length = $seq->length;}
    +			if ($length){
    +				$MOBY_RESPONSE .= simpleResponse("
    +			
    +				$length
    +			", "", $qID);
    +			} else {
    +				$MOBY_RESPONSE .= simpleResponse("", "sequence_has_no_length", $qID);
    +			}
     		}
     	}
    -		
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
    +
     sub GenbankAccSequenceRetrieve {
         my ($self, $data) = @_;
         my $response; my @accessions;
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:34:36 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:34:36 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102234.hBAMYaZc032738@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:34:36 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv32719/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    small changes to service output
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.41,1.42
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.41
    retrieving revision 1.42
    diff -u -r1.41 -r1.42
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:22:03	1.41
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:34:36	1.42
    @@ -70,7 +70,7 @@
             }
         }
         
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub getGoTermAssociations {
    @@ -135,7 +135,7 @@
     			$MOBY_RESPONSE .= collectionResponse(\@simples,"Known_GO_Term_Associations",$ID); # after all images have been collected, create the collection
             }
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
         
     }
     
    @@ -187,7 +187,7 @@
     			$MOBY_RESPONSE .= collectionResponse(\@simples, "GO_terms_from_keywords", $ID);
     		}
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     
    @@ -223,7 +223,7 @@
     			# do your thing here!
             }
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub MOBYSHoundGetGenBankff {
    @@ -281,8 +281,8 @@
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +	#print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub GenbankAccVirtualSequenceRetrieve {
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:40:57 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:40:57 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102240.hBAMevNm000374@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:40:56 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv355/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    Doh.  Use the output format you dummy
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.42,1.43
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.42
    retrieving revision 1.43
    diff -u -r1.42 -r1.43
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:34:36	1.42
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:40:56	1.43
    @@ -262,21 +262,23 @@
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					";
    +					",
    +					"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					";
    +					",
    +					"", $qID);
     			}
     		}
         }
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 17:45:12 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:45:12 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102245.hBAMjCKF000512@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:45:12 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv493/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    missed one
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.43,1.44
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.43
    retrieving revision 1.44
    diff -u -r1.43 -r1.44
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:40:56	1.43
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:45:11	1.44
    @@ -256,7 +256,7 @@
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my $gb = SHoundGetGenBankff($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "";
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 10:36:38 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 10:36:38 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111536.hBBFac9j003421@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 10:36:38 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv3402/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    the last of the Sequence services complete.  We now return genbank flatfiles, fasta, Virtual, DNA, RNA, AA sequence objects for gi's, gb accessions, PDB, embl (embl doesn't work at the moment for unknown reasons), SP, and PIR.  These services should be sufficient for me to de-register the services that are currently depending on genbank via bioperl.  Unfortunately, genbank is sufficiently unreliable that I am embarrassed to build services that use their interfaces because as often as not they don't work...
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.44,1.45
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.44
    retrieving revision 1.45
    diff -u -r1.44 -r1.45
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:45:11	1.44
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 15:36:38	1.45
    @@ -12,6 +12,7 @@
     use DBI;
     use DBD::mysql;
     use GO::AppHandle;
    +use IO::String;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -28,6 +29,46 @@
     
     use vars qw(@ISA);
     
    +##################################################
    +##################################################
    +#  ALL BROWSERS PLEASE NOTE!!
    +#  Most of the subroutines in this module use the
    +#  following basic template for service
    +#  provision.  They add a few more lines to do
    +#  error_checking and validations, but generally
    +#  speaking the few lines below are all
    +#  that a service requires :-)
    +##################################################
    +##################################################
    +
    +sub _generic_service_template {
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +			# do your thing here!
    +        }
    +    }
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +##################################################
    +##################################################
    +##################################################
    +##################################################
    +
    +
     sub getGoTerm {
         my ($caller, $message) = @_;
         my $MOBY_RESPONSE;
    @@ -204,29 +245,79 @@
     #  =        namespace                            =
     #  ===============================================
     
    -sub _generic_service_template {
    +
    +sub MOBYSHoundGetGenBankff {
         my ($caller, $data) = @_;
    -    my $MOBY_RESPONSE;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
         return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
     
         foreach (@inputs){
             my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
                 next;
             } else {
    -            my $namespace = getSimpleArticleNamespaceURI($input);
    -			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    -			# do your thing here!
    -        }
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetGenBankff($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					",
    +					"", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					",
    +					"", $qID);
    +			}
    +		}
         }
    +	$aa = SHoundFini();
    +	#print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    -sub MOBYSHoundGetGenBankff {
    +sub _makeSeqObj {
    +	my ($id) = @_;
    +	my $gb = SHoundGetGenBankff($id);
    +	return undef unless $gb;
    +	my $gbio = IO::String->new($gb);
    +	my $sio = Bio::SeqIO->new(-fh => \*$gbio, '-format' => 'genbank');
    +	my $seq = $sio->next_seq;
    +	return ($seq, $seq->length, $seq->seq);	
    +}
    +
    +sub MOBYSHoundGetGenBankVirtSequence {
         my ($caller, $data) = @_;
     	my $MOBY_RESPONSE;
     	
    @@ -254,30 +345,167 @@
     			my ($identifier) = getSimpleArticleIDs($input);
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    -				my $gb = SHoundGetGenBankff($identifier);
    +				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +												 ".($SEQ->length)."
    +												 ", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					".($SEQ->length)."
    +					",
    +					"", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					".($SEQ->length)."
    +					",
    +					"", $qID);
    +			}
    +		}
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub MOBYSHoundGetGenBankWhateverSequence {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my %objtype = ('dna', "DNASequence", 'rna', "RNASequence", 'protein', "AminoAcidSequence");
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +				my $objType = $objtype{$SEQ->alphabet};
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$identifier'>
    +												 ".($SEQ->length)."
    +												 ".($SEQ->seq)."
    +												 ", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my $objType = $objtype{$SEQ->alphabet};
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    +					
    +						
    +					
    +					 ".($SEQ->length)."
    +					 ".($SEQ->seq)."
    +					 ", "", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my $objType = $objtype{$SEQ->alphabet};
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    +					
    +						
    +					
    +					 ".($SEQ->length)."
    +					 ".($SEQ->seq)."
    +					 ", "", $qID);
    +			}
    +		}
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub MOBYSHoundGetGenBankFasta {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetFasta($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    -				my $gb = SHoundGetGenBankff($gi);
    +				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					",
    +					",
     					"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    -				my $gb = SHoundGetGenBankff($gi);
    +				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					",
    +					",
     					"", $qID);
     			}
     		}
    @@ -287,6 +515,7 @@
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    +
     sub GenbankAccVirtualSequenceRetrieve {
         my ($self, $data) = @_;
     
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 13:08:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 13:08:14 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111808.hBBI8EdB004309@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:08:14 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts
    In directory pub.open-bio.org:/tmp/cvs-serv4290
    
    Modified Files:
    	MOBY-Client05.cgi 
    Log Message:
    added Xrefs to my new services.  Small change in the client program to improve readability
    
    moby-live/Perl/scripts MOBY-Client05.cgi,1.25,1.26
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi,v
    retrieving revision 1.25
    retrieving revision 1.26
    diff -u -r1.25 -r1.26
    --- /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/11/06 16:42:41	1.25
    +++ /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/12/11 18:08:14	1.26
    @@ -1,6 +1,6 @@
     #!/usr/bin/perl -w
     use strict;
    -use lib '/usr/local/apache/cgi-bin/MOBY05';
    +use lib '/usr/local/apache/cgi-bin/BIO/moby-live/Perl';
     
     use MOBY::Client::Central;
     use MOBY::Client::Service;
    @@ -466,11 +466,15 @@
                 my $output = "(";
                 foreach my $param(@{$objs}){
                     if ($param->isSimple){
    -                    $output .= "Simple:".($param->objectType)." ,";
    +                    my $type = (($param->objectType =~ /\:(\S+)$/) && $1);
    +                    $type = $param->objectType unless $type;
    +                    $output .= "Simple: $type ,";
                     } else {
                         $output .= "Collection:[";
                         foreach my $simp(@{$param->Simples}){
    -                        $output .= ($simp->objectType).",";
    +                        my $type = (($simp->objectType =~ /\:(\S+)$/) && $1);
    +                        $type = $simp->objectType unless $type;
    +                        $output .= "$type,";
                         }
                         chop $output;
                         $output .="],";
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 13:08:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 13:08:14 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111808.hBBI8EFh004328@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:08:14 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv4290/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    added Xrefs to my new services.  Small change in the client program to improve readability
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.45,1.46
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.45
    retrieving revision 1.46
    diff -u -r1.45 -r1.46
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 15:36:38	1.45
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:08:14	1.46
    @@ -9,6 +9,7 @@
     use strict;
     use SeqHound;
     use SOAP::Lite;
    +use Bio::SeqIO;
     use DBI;
     use DBD::mysql;
     use GO::AppHandle;
    @@ -317,6 +318,16 @@
     	return ($seq, $seq->length, $seq->seq);	
     }
     
    +sub _getXrefs {
    +	my ($seq) = @_;  # bioperl seq object
    +	#my $gi = $seq->primary_id;		  # e.g. 163483
    +	#print STDERR "\n\n*********************$ gi\n\n";
    +	my $acc = $seq->accession;        # e.g. A123434
    +	my $kw = $seq->species->binomial; # e.g. mus musculus
    +	my $taxon = $seq->species->ncbi_taxid;  # e.g. 1234
    +	return ($acc, $kw, $taxon);
    +}		
    +
     sub MOBYSHoundGetGenBankVirtSequence {
         my ($caller, $data) = @_;
     	my $MOBY_RESPONSE;
    @@ -346,39 +357,53 @@
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    -	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -												 ".($SEQ->length)."
    -												 ", "", $qID);
    +
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="\n".($SEQ->length)."
    +												 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -					
    -						
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
    -					".($SEQ->length)."
    -					",
    -					"", $qID);
    +					 ".($SEQ->length)."
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -					
    -						
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
    -					".($SEQ->length)."
    -					",
    -					"", $qID);
    +					 ".($SEQ->length)."
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			}
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +#	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    @@ -413,43 +438,59 @@
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$identifier'>
    -												 ".($SEQ->length)."
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="\n".($SEQ->length)."
     												 ".($SEQ->seq)."
    -												 ", "", $qID);
    +												 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    -					
    -						
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
    -					 ", "", $qID);
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    -					
    -						
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
    -					 ", "", $qID);
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			}
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +#	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    @@ -516,335 +557,6 @@
     }
     
     
    -sub GenbankAccVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -
    -    my $MOBY_RESPONSE;
    -    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    -    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    -
    -    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    -
    -    foreach (@inputs){
    -        my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    -            next;
    -        } else {
    -			(($MOBY_RESPONSE .= simpleResponse("", "no_input_object", $qID)) && (next)) unless (defined $input);
    -			my $ns = getSimpleArticleNamespaceURI($input);
    -			(($MOBY_RESPONSE .= simpleResponse([], "Invalid_Namespace", $qID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    -            ($MOBY_RESPONSE .= collectionResponse([], "No_Accession_provided", $qID) && (next)) unless defined $acc;
    -			use Bio::DB::GenBank;
    -			my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -			my $seq = $gb->get_Seq_by_acc($acc);
    -			my $length;
    -			if ($seq){$length = $seq->length;}
    -			if ($length){
    -				$MOBY_RESPONSE .= simpleResponse("
    -			
    -				$length
    -			", "", $qID);
    -			} else {
    -				$MOBY_RESPONSE .= simpleResponse("", "sequence_has_no_length", $qID);
    -			}
    -		}
    -	}
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    -}
    -
    -sub GenbankAccSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_Acc');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_acc($acc);
    -		my $length;my $sequence;
    -		if ($seq){$length = $seq->length;$sequence = $seq->seq}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -			$sequence
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -	
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse   
    -}
    -sub GenbankGIVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_gi');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_gi($acc);
    -		my $length;
    -		if ($seq){$length = $seq->length;}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -	
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse   
    -}
    -
    -sub GenbankGISequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_gi');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_gi($acc);  # get the sequence object for each gi
    -		my $length;my $sequence;
    -		if ($seq){$length = $seq->length;$sequence = $seq->seq}  # if it exists, get the length and sequence
    -		if ($length){  # and construct the response
    -			$response .= simpleResponse("
    -		
    -			$length
    -			$sequence
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse;
    -}
    -#=================================================
    -#=================================================
    -#=================================================
    -
    -sub GenbankCompleteSequenceRetrieve {
    -
    -# this service is registered as consuming NCBI_Acc OR NCBI_gi
    -# and producing GenericSequence objects.  However, it will
    -# actually produce DNA, RNA or PRotein objects, as appropriate
    -# and will produce a cross-reference block as well
    -
    -    my ($self, $data) = @_;
    -    my $response; my @gis;
    -
    -	my ($GB_Acc_LSID, $GB_gi_LSID) = validateNamespaces('NCBI_Acc', 'NCBI_gi');
    -	unless ($GB_Acc_LSID && $GB_gi_LSID){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc or NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -	
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	foreach my $node(@inputs){
    - 
    -		my $namespace_LSID = getSimpleArticleNamespaceURI($node);  # get the LSID of the namespace for this input object
    -		unless (($namespace_LSID eq $GB_Acc_LSID) || ($namespace_LSID eq $GB_gi_LSID)){ # validate the namespace
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if bad namespace
    -			next;
    -		}
    -			
    -		my ($ID)= getSimpleArticleIDs($namespace_LSID, [$node]);  # get the ID within this namespace
    -		unless (defined $ID){  # send a blank if we failed to get an id, 
    -			$response .= simpleResponse("");  # because we have to send one response per input
    -			next;
    -		}
    -
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');  # now that we have a namespace and ID, we are ready to retrieve
    -		my $seq;
    -		if ($namespace_LSID eq $GB_Acc_LSID){  # if the namespace is a genbank Accession thebn
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the accession
    -		} elsif ($namespace_LSID  eq $GB_gi_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_gi($ID);  # get the sequence object for the gi
    -		} else {
    -			$response .= simpleResponse("");  # if it is neither,then send a blank as required by the API
    -			next;
    -		}
    -			
    -		my $length;my $sequence;
    -		if ($seq){
    -			$length = $seq->length;$sequence = $seq->seq;  # if it exists, get the length and sequence
    -		} else {
    -			$response .= simpleResponse("");  # if we got nada, then send a blank as required
    -			next;
    -		}
    -
    -		my $gi = $seq->primary_id;		  # e.g. 163483
    -		my $acc = $seq->accession;        # e.g. A123434
    -		my $kw = $seq->species->binomial; # e.g. mus musculus
    -		my $moltype = $seq->alphabet;     #  'dna', 'rna', 'protein'
    -		my $taxon = $seq->species->ncbi_taxid;  # e.g. 1234
    -		
    -		my $ObjectType="GenericSequence";           # set it as the generic as default
    -		if ($moltype eq 'dna'){$ObjectType = "DNASequence"}  # set to DNA
    -		elsif ($moltype eq 'rna'){$ObjectType = "RNASequence"} # set to RNA
    -		elsif ($moltype eq 'protein'){$ObjectType = "AminoAcidSequence"}  # set to Protein
    -		
    -		if ($length){  # and construct the response; luckily, all of these objects have exactly the same structure :-)
    -			my $tempresponse .= "
    -		
    -			";
    -			if ($taxon){ $tempresponse .=""}
    -			if ($kw){$tempresponse .=""}
    -			if ($acc && !($namespace_LSID eq $GB_Acc_LSID)){$tempresponse .=""}
    -			if ($gi && !($namespace_LSID eq $GB_gi_LSID)){$tempresponse .=""}
    -			$tempresponse .="
    -			$length
    -			$sequence
    -		";
    -			$response .= simpleResponse($tempresponse);
    -		} else {
    -			$response .= simpleResponse("");  # if we failed to get a sequence length, then something weird happened, so just ignore it
    -		}
    -	}
    -    my $fullresponse =  responseHeader() . $response . responseFooter();  # add the headers and footers
    -    my $SOAPResponse = SOAP::Data->type('base64' => $fullresponse);  # base 64 encode it (optional)
    -    return $SOAPResponse;	
    -}
    -
    -
    -sub GenbankRecordRetrieve {
    -	use Bio::SeqIO;
    -	use IO::String;
    -    my ($self, $data) = @_;
    -    my $response; # prepare a variable to hold the responses
    -
    -	# Step 1 - validate the namespaces you plan to accept as input
    -	my ($GB_Acc_LSID, $GB_gi_LSID, $EMBL_LSID) = validateNamespaces('NCBI_Acc', 'NCBI_gi', 'EMBL');
    -	unless ($GB_Acc_LSID && $GB_gi_LSID && $EMBL_LSID){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc, NCBI_gi, or EMBL_LSID that we are expecting does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# Step 2 - get your input objects
    -	# in this case, we have registered as accepting
    -	# only simple inputs (not collections), therefore
    -	# we can insist on that constraint.
    -	my @inputs = getInputArticles($data); # returns ([SimpleDOM], [SimpleDOM],...), each represents a unique query input
    -	foreach my $node(@inputs){
    -		# do a bit of simple validation
    -		# the next 12 lines or so are ~cut-n-paste for every service
    -		unless (isSimpleArticle($node)){ 		# we only allow Simple inputs to this service, ignore anything else
    -			$response .= simpleResponse("");	# because we have to send one response per input, send a blank if it fails
    -			next;
    -		}
    -		my $namespace_LSID = getSimpleArticleNamespaceURI($node);  # get the LSID of the namespace for this input object
    -		unless (($namespace_LSID eq $GB_Acc_LSID) || ($namespace_LSID eq $GB_gi_LSID) || $namespace_LSID eq $EMBL_LSID){ # validate the namespace
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if bad namespace
    -			next;
    -		}
    -		my ($ID)= getSimpleArticleIDs($namespace_LSID, [$node]);  # get the ID within this namespace
    -		unless (defined $ID){  # send a blank if we failed to get an id, 
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if there is no id (?!?)
    -			next;
    -		}
    -
    -		# Now, do the analysis
    -		use Bio::DB::GenBank;
    -		use Bio::DB::EMBL;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');  # now that we have a namespace and ID, we are ready to retrieve
    -		my $emb = new Bio::DB::EMBL(-retrievaltype => 'io_string');
    -		my $seq;
    -		if ($namespace_LSID eq $GB_Acc_LSID){  # if the namespace is a genbank Accession thebn
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the accession
    -		} elsif ($namespace_LSID  eq $GB_gi_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_gi($ID);  # get the sequence object for the gi
    -		} elsif ($namespace_LSID  eq $EMBL_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the gi
    -		} else {
    -			$response .= simpleResponse("");  # if it is neither,then send a blank as required by the API
    -			next;
    -		}
    -
    -		my $string;
    -		my $stringio = IO::String->new($string);
    -		my $out = Bio::SeqIO->new('-fh' => $stringio,
    -							   '-format' => 'genbank');
    -		# output goes into $string
    -		$out->write_seq($seq);
    -		$response .= simpleResponse(""); # append this queryResponse to the list
    -	}
    -    my $fullresponse =  responseHeader() . $response . responseFooter();  # add the headers and footers around all queryResponses
    -    my $SOAPResponse = SOAP::Data->type('base64' => $fullresponse);  # base 64 encode it (optional)
    -    return $SOAPResponse;	# and yer done!
    -}
    -
     
     #################################################
     #################################################
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 13:22:02 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 13:22:02 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111822.hBBIM2nY004412@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:22:02 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv4393/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    fixed the CRIB XML tag - it is CrossReference not CrossReferences.  This also pointed me to an error in the API documentation which is also now fixed and consistent throughout
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.46,1.47
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.46
    retrieving revision 1.47
    diff -u -r1.46 -r1.47
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:08:14	1.46
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:22:02	1.47
    @@ -284,9 +284,9 @@
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			} else {
    @@ -295,9 +295,9 @@
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			}
    @@ -359,12 +359,12 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
     
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n";
    +				my $tempresponse = "\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
    -				$tempresponse .="\n".($SEQ->length)."
    +				$tempresponse .="\n".($SEQ->length)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    @@ -373,13 +373,13 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n\n";
    +				my $tempresponse = "\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
    @@ -389,13 +389,13 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n\n";
    +				my $tempresponse = "\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
    @@ -441,12 +441,12 @@
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
    -				$tempresponse .="\n".($SEQ->length)."
    +				$tempresponse .="\n".($SEQ->length)."
     												 ".($SEQ->seq)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    @@ -457,13 +457,13 @@
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
     					 ";
    @@ -475,13 +475,13 @@
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
     					 ";
    @@ -532,9 +532,9 @@
     				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			} else {
    @@ -543,9 +543,9 @@
     				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			}
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 17:30:53 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 17:30:53 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312112230.hBBMUrFG005178@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 17:30:53 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv5159/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    two more services dealing with taxon data
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.47,1.48
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.47
    retrieving revision 1.48
    diff -u -r1.47 -r1.48
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:22:02	1.47
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 22:30:53	1.48
    @@ -46,13 +46,13 @@
         my ($caller, $data) = @_;
         my $MOBY_RESPONSE;
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    -    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (scalar(@inputs));
     
         my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
     
         foreach (@inputs){
             my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    +        unless (($articleType == SIMPLE) && ($input)){
                 $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
                 next;
             } else {
    @@ -69,6 +69,97 @@
     ##################################################
     ##################################################
     
    +sub getTaxChildNodes {  # WORKS
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= collectionResponse([], "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= collectionResponse([], "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $children = SHoundGetTaxChildNodes($identifier);
    +            $MOBY_RESPONSE .= collectionResponse([], "nothing_found", $qID) unless ($children);
    +			my @children = split ",", $children;
    +			my @simples;
    +			foreach my $taxon (@children){
    +				next unless $taxon;
    +				$taxon =~ s/\s//g;
    +	            push @simples, "";
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples, "", $qID);
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub getTaxParent { # DOES NOT WORK - SHound call doesn't exist
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= simpleResponse("", "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $parent = SHoundGetTaxParent($identifier);
    +            $MOBY_RESPONSE .= simpleResponse("", "nothing_found", $qID) unless ($parent);
    +			$parent && ($MOBY_RESPONSE .= simpleResponse("", "", $qID));
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +
    +sub getTaxNameFromTaxID{  # WORKS
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= simpleResponse("", "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $name = SHoundGetTaxNameFromTaxID($identifier);
    +            $MOBY_RESPONSE .= simpleResponse("", "nothing_found", $qID) unless ($name);
    +			$name && ($MOBY_RESPONSE .= simpleResponse("
    +													   
    +													   
    +													   $name", "", $qID));
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
     
     sub getGoTerm {
         my ($caller, $message) = @_;
    
    
    
    From mwilkinson at pub.open-bio.org  Fri Dec 12 14:22:45 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri, 12 Dec 2003 14:22:45 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312121922.hBCJMikJ009022@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 12 14:22:44 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv9003/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    making GMOD moby server revealed a commonsubs error.  removed the deprecated services from my CGI client
    
    moby-live/Perl/MOBY CommonSubs.pm,1.34,1.35
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.34
    retrieving revision 1.35
    diff -u -r1.34 -r1.35
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/10 22:22:03	1.34
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/12 19:22:44	1.35
    @@ -397,7 +397,7 @@
             ";
         } elsif($data) {
             return "
    -        
    +        
                 $data
             
             ";
    
    
    
    From mwilkinson at pub.open-bio.org  Fri Dec 12 14:22:45 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri, 12 Dec 2003 14:22:45 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312121922.hBCJMjo6009041@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 12 14:22:44 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts
    In directory pub.open-bio.org:/tmp/cvs-serv9003/Perl/scripts
    
    Modified Files:
    	Services.cgi 
    Log Message:
    making GMOD moby server revealed a commonsubs error.  removed the deprecated services from my CGI client
    
    moby-live/Perl/scripts Services.cgi,1.4,1.5
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services.cgi,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -r1.4 -r1.5
    --- /home/repository/moby/moby-live/Perl/scripts/Services.cgi	2003/10/17 21:29:52	1.4
    +++ /home/repository/moby/moby-live/Perl/scripts/Services.cgi	2003/12/12 19:22:44	1.5
    @@ -2,8 +2,13 @@
     # _________________________________________________________________
     use SOAP::Transport::HTTP;
     use lib "/usr/local/apache/cgi-bin";
    +use lib "/usr/local/apache/cgi-bin/MOBY05";
    +use lib "/usr/local/apache/cgi-bin/BIO/go-dev/perl-api";
     use lib "/usr/local/apache/cgi-bin/BIO/moby-live/Perl";
    -use lib "/usr/local/apache/cgi-bin/BIO/core/Perl";
    +use lib '/usr/local/apache/cgi-bin/bioperl/core';
    +use lib '/usr/local/apache/cgi-bin/Services/';
    +use Bio::SeqIO::genbank;
    +use GO::AppHandle;
     use Services::LocalServices;
     use strict;
     
    @@ -12,13 +17,13 @@
     $x->dispatch_with({
     'http://biomoby.org/#getGoTerm' => 'Services::LocalServices',
     'http://biomoby.org/#getGoTermAssociations' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankAccVirtualSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankAccSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankGIVirtualSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankGISequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankCompleteSequenceRetrieve' => 'Services::LocalServices',
     'http://biomoby.org/#RetrieveGOFromKeywords' => 'Services::LocalServices',
     'http://biomoby.org/#getDragonMutantImages' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankff' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankFasta' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankWhateverSequence' => 'Services::LocalServices',
    +'http://biomoby.org/#getTaxNameFromTaxID' => 'Services::LocalServices',
    +'http://biomoby.org/#getTaxChildNodes' => 'Services::LocalServices',
     
     });
     $x->handle;
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec 16 15:46:40 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 16 Dec 2003 15:46:40 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312162046.hBGKke7h000685@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec 16 15:46:40 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv665/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    corrected the SeqHound call for EMBL accession numbers  Added a new service that wraps the SeqHound SHoundGetTaxParent function to retrieve the taxonomic parents of a given taxon id.
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.48,1.49
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.48
    retrieving revision 1.49
    diff -u -r1.48 -r1.49
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 22:30:53	1.48
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/16 20:46:40	1.49
    @@ -17,15 +17,31 @@
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    -use MOBY::CommonSubs qw(:all);  # this provides the
    -# subroutines:
    -#getSimpleArticleIDs
    -#getSimpleArticleNamespaceURI
    -#simpleResponse
    -#responseHeader
    -#responseFooter
    -#getInputArticles
    -#getNodeContentWithArticle
    +use MOBY::CommonSubs qw(:all);  # this provides the following vars and functions
    +    #getSimpleArticleIDs
    +    #getSimpleArticleNamespaceURI
    +    #simpleResponse
    +    #responseHeader
    +    #responseFooter
    +    #getInputArticles
    +    #getInputs
    +    #getInputID
    +    #getArticles
    +    #getCollectedSimples
    +    #getNodeContentWithArticle
    +    #extractRawContent
    +    #collectionResponse
    +    #validateNamespaces
    +    #validateThisNamespace
    +    #isSimpleArticle
    +    #isCollectionArticle
    +    #extractResponseArticles
    +    #getResponseArticles
    +    #getCrossReferences
    +    #genericServiceInputParser
    +    #COLLECTION
    +    #SIMPLE
    +
     my $debug = 1;
     
     use vars qw(@ISA);
    @@ -103,7 +119,7 @@
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    -sub getTaxParent { # DOES NOT WORK - SHound call doesn't exist
    +sub getTaxParent { # now it works.
         my ($caller, $data) = @_;
         my $MOBY_RESPONSE;
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    @@ -327,14 +343,6 @@
     #  ===============================================
     #  =    Genbank Retrieval Scripts                =
     #  =                                             =
    -#  = Note:  The two VirtualSequenceRetrieve's    =
    -#  =        and two SequenceRetrieves below could=
    -#  =        have been registered as two services =
    -#  =        instead of four, by simply           =
    -#  =        registering each under two different =
    -#  =        namespaces (Acc and gi) instead of   =
    -#  =        having a single service for each     =
    -#  =        namespace                            =
     #  ===============================================
     
     
    @@ -369,7 +377,7 @@
     				my $gb = SHoundGetGenBankff($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
    @@ -458,7 +466,7 @@
     				$tempresponse .="\n".($SEQ->length)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    @@ -541,7 +549,7 @@
     												 ".($SEQ->seq)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    @@ -617,7 +625,7 @@
     				my $gb = SHoundGetFasta($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetFasta($gi);
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 12:05:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 12:05:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221705.hBMH53k3013451@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 12:05:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv13432/Perl/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    added some sanity checking to the authURI attribute of all register* calls.  Its still allows some insanity through, but not the most obviously sick ones
    
    moby-live/Perl/MOBY Central.pm,1.116,1.117
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.116
    retrieving revision 1.117
    diff -u -r1.116 -r1.117
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 01:08:24	1.116
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:05:03	1.117
    @@ -234,6 +234,8 @@
     		if ($term =~ /FAILED/){return &_error("Malformed XML;","");}
     		return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +
     	# validate that the final ontology will be valid by testing against existing relationships and such
     	while (my ($reltype, $obj) = each %{$relationships}){
     		my ($success, $message, $URI) = $RelOntologyServer->relationshipExists(term => $reltype, ontology => 'object'); # success = 1 if it does
    @@ -466,6 +468,8 @@
     		if ($term =~ /FAILED/){		return &_error("Malformed XML\n $term","");}
     		return &_error("Malformed XML\n may be missing required parameters serviceType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +
     	# validate that the final ontology will be valid
     
     	my ($exists, $exists_message, $existingURI) = $OntologyServer->serviceExists(term => $term); # success = 1 if it does
    @@ -678,6 +682,7 @@
     	unless (defined $term && defined $desc && defined $auth && defined $email){
     		return &_error("Malformed XML; may be missing required parameters namespaceType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
     
     	my ($exists, $exists_message, $URI) = $OntologyServer->namespaceExists(term => $term); # success = 1 if it does
     	(($exists==1) && return &_error("Namespace $term already exists", $URI));
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 12:21:16 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 12:21:16 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221721.hBMHLGvN013584@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 12:21:16 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv13565/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    Doh!  I broke it.  Should be fixed now
    
    moby-live/Perl/MOBY Central.pm,1.117,1.118
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.117
    retrieving revision 1.118
    diff -u -r1.117 -r1.118
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:05:03	1.117
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:21:16	1.118
    @@ -234,7 +234,7 @@
     		if ($term =~ /FAILED/){return &_error("Malformed XML;","");}
     		return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	# validate that the final ontology will be valid by testing against existing relationships and such
     	while (my ($reltype, $obj) = each %{$relationships}){
    @@ -468,7 +468,7 @@
     		if ($term =~ /FAILED/){		return &_error("Malformed XML\n $term","");}
     		return &_error("Malformed XML\n may be missing required parameters serviceType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	# validate that the final ontology will be valid
     
    @@ -682,7 +682,7 @@
     	unless (defined $term && defined $desc && defined $auth && defined $email){
     		return &_error("Malformed XML; may be missing required parameters namespaceType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	my ($exists, $exists_message, $URI) = $OntologyServer->namespaceExists(term => $term); # success = 1 if it does
     	(($exists==1) && return &_error("Namespace $term already exists", $URI));
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 14:57:04 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 14:57:04 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221957.hBMJv4gk014200@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 14:57:04 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv14181/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    be kind, allow them to send a listref to validateThisNamespace if they do so by accident.
    
    moby-live/Perl/MOBY CommonSubs.pm,1.35,1.36
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.35
    retrieving revision 1.36
    diff -u -r1.35 -r1.36
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/12 19:22:44	1.35
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/22 19:57:04	1.36
    @@ -937,6 +937,8 @@
     
     sub validateThisNamespace {
         my ($ns, @namespaces) = @_;
    +    return 1 unless scalar @namespaces; # if you don't give me a list, I assume everything is valid...
    +    if (ref($namespaces[1]) =~ /ARRAY/){@namespaces = @{$namespaces[1]}}  # if you send me an arrayref I should be kind... DWIM!
         foreach (@namespaces){
             next unless $_;
             return 1 if $ns eq $_;
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 14:59:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 14:59:14 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221959.hBMJxEO6014268@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 14:59:13 EST 2003
    Update of /home/repository/moby/moby-live/Perl
    In directory pub.open-bio.org:/tmp/cvs-serv14249
    
    Added Files:
    	README 
    Log Message:
    putting README back into the Perl folder
    
    moby-live/Perl README,1.2,1.3
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/README,v
    retrieving revision 1.2
    retrieving revision 1.3
    diff -u -r1.2 -r1.3
    
    
    
    From tyotirkjwegi at vilcrfnh.beautytipmakeup.info  Mon Dec 22 17:26:09 2003
    From: tyotirkjwegi at vilcrfnh.beautytipmakeup.info (Wgec Sd)
    Date: Mon, 22 Dec 2003 15:26:09 -0700
    Subject: [MOBY-guts] Headline NEWS - Face Looks 20 years Younger
    In-Reply-To: <09X6.VxKH-PDCB$KRxVxKH.xAP.X00YW5>
    References: <09X6.VxKH-PDCB$KRxVxKH.xAP.X00YW5>
    Message-ID: 
    
    An HTML attachment was scrubbed...
    URL: http://biomoby.org/pipermail/moby-guts/attachments/20031222/3a20bb44/attachment.html
    
    From mwilkinson at pub.open-bio.org  Fri Dec 26 17:01:31 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri, 26 Dec 2003 17:01:31 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312262201.hBQM1VtN026461@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 26 17:01:31 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv26442/Perl/MOBY/Client
    
    Modified Files:
    	Central.pm 
    Log Message:
    duh!  If you pass identical objects to the ISA routine, CLEARLY it should return TRUE!!
    
    moby-live/Perl/MOBY/Client Central.pm,1.64,1.65
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.64
    retrieving revision 1.65
    diff -u -r1.64 -r1.65
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:57:15	1.64
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/26 22:01:31	1.65
    @@ -1383,6 +1383,7 @@
     
     sub ISA {
     	my ($self, $class1, $class2) = @_;
    +	return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2"));
     	my $OS = MOBY::Client::OntologyServer->new;
     	my ($s, $d, $lsid1) = $OS->objectExists(term => $class1);
     	return 0 unless $s;
    
    
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 08:55:20 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat, 27 Dec 2003 08:55:20 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271355.hBRDtKVf028530@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 08:55:20 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv28511/Perl/MOBY/Client
    
    Modified Files:
    	Central.pm 
    Log Message:
    serious performance issues revealed by the new Gbrowse moby client program.  The ISA call of MOB::Clien:Central requires two CGI calls, a SOAP call, which itself results in two CGI calls, and a myriad of independent database calls to traverse the ontology.  It ended up being >1 second per call,which was unacceptable for many situations where you just need a quick answer to a 'what the heck is this' question.  Started client-side caching of the ontology and LSID terms in Client::Central to speed things up.  It is now only slow the first time, and <.05 seconds per call thereafter.  It does show how critical the need is to start storing the ontology in memory on the server side, though.
    
    moby-live/Perl/MOBY/Client Central.pm,1.65,1.66
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.65
    retrieving revision 1.66
    diff -u -r1.65 -r1.66
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/26 22:01:31	1.65
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/27 13:55:20	1.66
    @@ -1385,13 +1385,27 @@
     	my ($self, $class1, $class2) = @_;
     	return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2"));
     	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $d, $lsid1) = $OS->objectExists(term => $class1);
    -	return 0 unless $s;
    -	my ($s2, $d2, $lsid2) = $OS->objectExists(term => $class2);
    -	return 0 unless $s2;
    -	my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1);
    -	my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
    -	foreach (@$lsids){
    +	my ($lsid1, $lsid2);
    +	unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){
    +		my ($s, $d, $lsid) = $OS->objectExists(term => $class1);
    +		$self->{LSID_CACHE}->{$class1} = $lsid;
    +		$lsid1 = $lsid;
    +		return 0 unless $s;
    +	}
    +	unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){
    +		my ($s, $d, $lsid) = $OS->objectExists(term => $class2);
    +		$self->{LSID_CACHE}->{$class2} = $lsid;
    +		$lsid2 = $lsid;
    +		return 0 unless $s;
    +	}
    +	my @lsids;
    +	unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){
    +		my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']);
    +		my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
    +		@lsids = @$lsids;
    +	}
    +	$self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids];
    +	foreach (@lsids){
     		return 1 if $_ eq $lsid2;
     	}
     	return 0;
    
    
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 10:12:32 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat, 27 Dec 2003 10:12:32 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271512.hBRFCWeV028733@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 10:12:31 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28714/Perl/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    Gbrowse client reveals another MOBY Central bug.  Searching for services where you provide an invalid namespace as a parameter should NOT find ALL services, it should find NO services.
    
    moby-live/Perl/MOBY Central.pm,1.118,1.119
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.118
    retrieving revision 1.119
    diff -u -r1.118 -r1.119
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:21:16	1.118
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/27 15:12:31	1.119
    @@ -1849,7 +1849,7 @@
     			next unless ($_->getNodeType == TEXT_NODE);
     			my $name = $_->toString; chomp $name;
     			my ($success, $message, $URI) = $OS->namespaceExists(term => $name);
    -			($URI) && push @namespaces, $URI;
    +			$URI?(push @namespaces, $URI):(push @namespaces, "__MOBY__INVALID__NAMESPACE__");
     		}
     	}
     	return ($objectURI, \@namespaces);
    
    
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 12:41:32 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat, 27 Dec 2003 12:41:32 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271741.hBRHfWiQ029662@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 12:41:32 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv29639/Perl/MOBY/Client
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    more tweaks for the Gbrowse project.  Create getter/setter methods for the LSID and ISA caches in MOBY::Client::Central so that they can be called from outside of the module itself.  This will allow us to build external tools that play with these caches.  This may not seem useful at the moment since we only have CGI based clients, so the cache is erased every time we make a call, but once we have a standalone client it will be very useful
    
    moby-live/Perl/MOBY/Client Central.html,1.13,1.14 Central.pm,1.66,1.67
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v
    retrieving revision 1.13
    retrieving revision 1.14
    diff -u -r1.13 -r1.14
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/02 00:57:15	1.13
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/27 17:41:32	1.14
    @@ -2,7 +2,7 @@
     
     
     MOBY::Client::Central - a client side wrapper for MOBY Central
    -
    +
     
     
     
    @@ -20,8 +20,8 @@
     	
     
     
    @@ -135,7 +137,7 @@
                     at all, and everything should work
     

    -

    registerObject a.k.a registerObjectClass

    +

    registerObject a.k.a registerObjectClass

      Title     :    registerObject ; registerObjectClass
      Usage     :    $REG = $MOBY->registerObject(%args)
    @@ -154,7 +156,7 @@
                             [Object1, articleName]]}

    -

    deregisterObject a.k.a. deregisterObjectClass

    +

    deregisterObject a.k.a. deregisterObjectClass

      Title     :    deregisterObject ; deregisterObjectClass
      Usage     :    $REG = $MOBY->deregisterObject(%args)
    @@ -430,6 +432,27 @@
      Function  :    DUMP the mysql for the current MOBY Central database
      Returns   :    text
      Args      :    $reg - name of MOBY Central you want to use if not default
    +

    +

    +

    LSID_CACHE

    +
    + Title     :    LSID_CACHE
    + Usage     :    $lsid = $MOBY->LSID_CACHE($term, $lsid)
    + Function  :    get/set LSID from the cache
    + Returns   :    lsid as a scalar
    + Args      :    the term for which you have/want an lsid,
    +                and optionally the lsid to set.
    +

    +

    +

    ISA_CACHE

    +
    + Title     :    ISA_CACHE
    + Usage     :    $lsid = $MOBY->ISA_CACHE($term, \@isas)
    + Function  :    get/set the ISA relationships in the cache
    + Returns   :    listref of ISA relationships.  The resulting
    +                list is IN ORDER from term to root.
    + Args      :    the term for which you have/want the ISA parentage,
    +                and optionally the parentage listref to set.
    =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 13:55:20 1.66 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 17:41:32 1.67 @@ -213,6 +213,7 @@ } } + sub new { my ($caller, %args) = @_; @@ -1342,6 +1343,7 @@ } + sub _relationshipsPayload{ my ($payload) = @_; return undef unless $payload; @@ -1388,23 +1390,23 @@ my ($lsid1, $lsid2); unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){ my ($s, $d, $lsid) = $OS->objectExists(term => $class1); - $self->{LSID_CACHE}->{$class1} = $lsid; + $self->LSID_CACHE($class1, $lsid); $lsid1 = $lsid; return 0 unless $s; } unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){ my ($s, $d, $lsid) = $OS->objectExists(term => $class2); - $self->{LSID_CACHE}->{$class2} = $lsid; + $self->LSID_CACHE($class2, $lsid); $lsid2 = $lsid; return 0 unless $s; } my @lsids; - unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ + unless ($self->ISA_CACHE($lsid1) && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']); my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'}; @lsids = @$lsids; } - $self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids]; + $self->ISA_CACHE($lsid1, [@lsids]); foreach (@lsids){ return 1 if $_ eq $lsid2; } @@ -1507,6 +1509,61 @@ return \@Services; } + +=head2 LSID_CACHE + + Title : LSID_CACHE + Usage : $lsid = $MOBY->LSID_CACHE($term, $lsid) + Function : get/set LSID from the cache + Returns : lsid as a scalar + Args : the term for which you have/want an lsid, + and optionally the lsid to set. + +=cut + + +sub LSID_CACHE { + my ($self, $term, $lsid) = @_; + if ($term && $lsid){ + $self->{LSID_CACHE}->{$term} = $lsid; + return $self->{LSID_CACHE}->{$term}; + } elsif ($term){ + return $self->{LSID_CACHE}->{$term}; + } else { + return undef + } +} + + +=head2 ISA_CACHE + + Title : ISA_CACHE + Usage : $lsid = $MOBY->ISA_CACHE($term, \@isas) + Function : get/set the ISA relationships in the cache + Returns : listref of ISA relationships. The resulting + list is IN ORDER from term to root. + Args : the term for which you have/want the ISA parentage, + and optionally the parentage listref to set. + +=cut + +sub ISA_CACHE { + my ($self, $term, $isas) = @_; + return [] if $isas && !(ref($isas)=~/ARRAY/); + if ($term && $isas){ + while (scalar(@$isas)){ + $self->{ISA_CACHE}->{$term} = [@$isas]; + $term = shift(@$isas); + } + return $self->{ISA_CACHE}->{$term}; + } elsif ($term){ + return $self->{ISA_CACHE}->{$term}; + } else { + return [] + } +} + + sub parseRegXML { # # $id From mwilkinson at pub.open-bio.org Sat Dec 27 15:11:49 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat, 27 Dec 2003 15:11:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272011.hBRKBnPp029986@pub.open-bio.org> mwilkinson Sat Dec 27 15:11:49 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv29963/Perl/MOBY/Client Modified Files: Central.pm Central.html Log Message: Gbrowse client modifications and additions. Caching is clearly an issue for speed purposes so there are some nice caching routines now in MOBY::Client::Central, as well as accessor methods to play with the cache. moby-live/Perl/MOBY/Client Central.pm,1.67,1.68 Central.html,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 17:41:32 1.67 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 20:11:48 1.68 @@ -1377,8 +1377,8 @@ Function : a pre-canned use of the Relationships function to quickly get an answer to whether class1 ISA class2 Returns : Boolean - Args : $class1 - an Object ontology term - $class2 - an Object ontology term + Args : $class1 - an Object ontology term or LSID + $class2 - an Object ontology term or LSID =cut @@ -1386,27 +1386,17 @@ sub ISA { my ($self, $class1, $class2) = @_; return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2")); - my $OS = MOBY::Client::OntologyServer->new; - my ($lsid1, $lsid2); - unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){ - my ($s, $d, $lsid) = $OS->objectExists(term => $class1); - $self->LSID_CACHE($class1, $lsid); - $lsid1 = $lsid; - return 0 unless $s; - } - unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){ - my ($s, $d, $lsid) = $OS->objectExists(term => $class2); - $self->LSID_CACHE($class2, $lsid); - $lsid2 = $lsid; - return 0 unless $s; - } + my $lsid1 = $self->ObjLSID($class1); + my $lsid2 = $self->ObjLSID($class2); + return 0 unless $lsid1 && $lsid2; my @lsids; - unless ($self->ISA_CACHE($lsid1) && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ + unless (@lsids = $self->ISA_CACHE($lsid1)){ my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']); my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'}; @lsids = @$lsids; + $self->ISA_CACHE($lsid1, [@lsids]); + $self->ISA_CACHE($class1, [@lsids]); } - $self->ISA_CACHE($lsid1, [@lsids]); foreach (@lsids){ return 1 if $_ eq $lsid2; } @@ -1509,6 +1499,29 @@ return \@Services; } +# my ($e, $m, $lsid) = $OS->objectExists(term => $_); + +=head2 ObjLSID + +=cut + +sub ObjLSID { + my ($self, $term) = @_; + return undef unless $term; + if (my $lsid = $self->LSID_CACHE($term)){ + return $lsid; + } else { + my $os = MOBY::Client::OntologyServer->new; + my ($s, $m, $lsid) = $os->objectExists(term => $term); + if ($lsid){ + $self->LSID_CACHE($term, $lsid); # link both the term + $self->LSID_CACHE($lsid, $lsid); # and the lsid to itself + return $lsid + } else { + return undef + } + } +} =head2 LSID_CACHE @@ -1537,29 +1550,32 @@ =head2 ISA_CACHE - Title : ISA_CACHE - Usage : $lsid = $MOBY->ISA_CACHE($term, \@isas) - Function : get/set the ISA relationships in the cache - Returns : listref of ISA relationships. The resulting - list is IN ORDER from term to root. - Args : the term for which you have/want the ISA parentage, - and optionally the parentage listref to set. + Title : ISA_CACHE + Usage : @lsids = $MOBY->ISA_CACHE($lsid, \@isas) + Function : get/set the ISA relationships in the cache + Returns : list of ISA relationships. The ISA list + is IN ORDER from, excluding the term itself, to + root Object. Base Object returns an empty list. + Args : The LSID for which you have/want the ISA parentage, + and optionally the parentage listref to set. + Note : WHAT COMES BACK ARE LSIDs!!! =cut sub ISA_CACHE { - my ($self, $term, $isas) = @_; - return [] if $isas && !(ref($isas)=~/ARRAY/); + my ($self, $desiredterm, $isas) = @_; + my $term = $desiredterm; + return (undef) if $isas && !(ref($isas)=~/ARRAY/); if ($term && $isas){ - while (scalar(@$isas)){ + $self->{ISA_CACHE}->{$desiredterm} = [@$isas]; + while (my $term = shift(@$isas)){ $self->{ISA_CACHE}->{$term} = [@$isas]; - $term = shift(@$isas); } - return $self->{ISA_CACHE}->{$term}; - } elsif ($term){ - return $self->{ISA_CACHE}->{$term}; + return @{$self->{ISA_CACHE}->{$desiredterm}}; + } elsif ($term && $self->{ISA_CACHE}->{$desiredterm}){ + return @{$self->{ISA_CACHE}->{$desiredterm}}; } else { - return [] + return (); } } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/27 17:41:32 1.14 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/27 20:11:49 1.15 @@ -41,6 +41,7 @@
  • Relationships
  • ISA
  • DUMP
  • +
  • ObjLSID
  • LSID_CACHE
  • ISA_CACHE
  • @@ -421,8 +422,8 @@ Function : a pre-canned use of the Relationships function to quickly get an answer to whether class1 ISA class2 Returns : Boolean - Args : $class1 - an Object ontology term - $class2 - an Object ontology term + Args : $class1 - an Object ontology term or LSID + $class2 - an Object ontology term or LSID

    DUMP

    @@ -434,6 +435,9 @@ Args : $reg - name of MOBY Central you want to use if not default

    +

    ObjLSID

    +

    +

    LSID_CACHE

      Title     :    LSID_CACHE
    @@ -446,13 +450,15 @@
     

    ISA_CACHE

    - Title     :    ISA_CACHE
    - Usage     :    $lsid = $MOBY->ISA_CACHE($term, \@isas)
    - Function  :    get/set the ISA relationships in the cache
    - Returns   :    listref of ISA relationships.  The resulting
    -                list is IN ORDER from term to root.
    - Args      :    the term for which you have/want the ISA parentage,
    -                and optionally the parentage listref to set.
    + Title : ISA_CACHE + Usage : @lsids = $MOBY->ISA_CACHE($lsid, \@isas) + Function : get/set the ISA relationships in the cache + Returns : list of ISA relationships. The ISA list + is IN ORDER from, excluding the term itself, to + root Object. Base Object returns an empty list. + Args : The LSID for which you have/want the ISA parentage, + and optionally the parentage listref to set. + Note : WHAT COMES BACK ARE LSIDs!!!
    From mwilkinson at pub.open-bio.org Sat Dec 27 15:15:45 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat, 27 Dec 2003 15:15:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272015.hBRKFjpJ030037@pub.open-bio.org> mwilkinson Sat Dec 27 15:15:45 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv30014/Perl/MOBY Modified Files: CommonSubs.pm CommonSubs.html Log Message: Gbrowse client needed a new utility routine in CommonSubs. This will take a list of 'known' Object ontology nodes and check it against the parentage of an in-hand object type, returning to you the term from your list that is DEEPEST in the ontology in the ISA parentage of your in-hand object. Why? (you might ask) Well, because when you want to assign renderers to objects you want the most complex renderer possible to deal with your in-hand object, so if you have rendrers for a variety of base object types, you want to chose the one that is best able to deal with whatever you have in-hand, thus you want the node closest to your object type moby-live/Perl/MOBY CommonSubs.pm,1.36,1.37 CommonSubs.html,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/22 19:57:04 1.36 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:15:45 1.37 @@ -175,6 +175,7 @@ getResponseArticles getCrossReferences genericServiceInputParser + whichDeepestParentObject COLLECTION SIMPLE BE_NICE @@ -202,6 +203,7 @@ getResponseArticles getCrossReferences genericServiceInputParser + whichDeepestParentObject COLLECTION SIMPLE BE_NICE @@ -1071,6 +1073,43 @@ return @XREFS; } + + +=head2 whichDeepestParentObject + + name : whichDeepestParentObject + function : select the parent node from nodeList that is + closest to the querynode + usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + args : $CENTRAL - your MOBY::Client::Central object + $queryNode - the node I am interested in + \@nodelist - the list of nodes that I know about + returns : an ontology term as a scalar, or undef if there + is no parent of this node in the nodelist + +=cut + + +sub whichDeepestParentObject { + use MOBY::Client::OntologyServer; + my ($CENTRAL, $queryTerm, $termlist) = @_; + return undef unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); + my %nodeLSIDs; + foreach (@$termlist){ # get list of known LSIDs + my $lsid = $CENTRAL->ObjLSID($_); + $nodeLSIDs{$lsid}=1; + } + my $queryLSID = $CENTRAL->ObjLSID($queryTerm); + return undef unless keys(%nodeLSIDs); + my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already + return undef unless $isa; # this should return true or we are in BIIIG trouble! + my @lsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root + while (my $thisnode = shift @lsids){ # @isas are lsid's + return $thisnode if $nodeLSIDs{$thisnode}; + } + return undef +} + sub _makeXrefType { my ($xref) = @_; my $ns = $xref->getAttributeNode('namespace'); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/11/08 17:21:31 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:15:45 1.7 @@ -4,7 +4,7 @@ MOBY::CommonSubs.pm - a set of exportable subroutines that are useful in clients and services to deal with the input/output from MOBY Services - + @@ -41,9 +41,12 @@
  • isSimpleArticle
  • isCollectionArticle
  • getNodeContentWithArticle
  • +
  • extractRawContent
  • validateNamespaces
  • -
  • getResponseArticles (a.k.a. extractResponseArticles)
  • +
  • validateThisNamespace
  • +
  • getResponseArticles (a.k.a. extractResponseArticles)
  • getCrossReferences
  • +
  • whichDeepestParentObject
  • @@ -181,17 +184,19 @@ name : getSimpleArticleIDs function : to get the IDs of simple articles that are in the given namespace usage : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles); - args : (in order) - $Namespace - (required) a namespace stringfrom the MOBY namespace ontology + my @ids = getSimpleArticleIDs(\@SimpleArticles); + args : $Namespace - (optional) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care \@Simples - (required) a listref of Simple XML::DOM nodes i.e. the XML::DOM representing an XML structure like this: <Simple> <Object namespace="NCBI_gi" id="163483"/> </Simple> - note : it will return *only* the ids that are in the given namespace - but since you are required to return an output for every input - (even if it is invalid) this routine will return undef for - those articles that are not in that namespace + note : If you provide a namespace, it will return *only* the ids that are in the given namespace, + but will return 'undef' for any articles in the WRONG namespace so that you get an + equivalent number of outputs to inputs. + + Note that if you call this with a single argument, this is assumed to + be \@Articles, so you will get ALL id's regardless of namespace!

    getSimpleArticleNamespaceURI

    @@ -417,6 +422,16 @@ }

    +

    extractRawContent

    +
    + name     : extractRawContent
    + function : pass me an article (Simple, or Collection) and I'll give you the
    +            content AS A STRING - i.e. the raw XML of the contained MOBY Object(s)
    + usage    : extractRawContent($simple)
    + input    : the one element of the output from getArticles
    + returns  : string
    +

    +

    validateNamespaces

      name     : validateNamespaces
    @@ -427,7 +442,16 @@
                 presumptive namespaces; undef for each namespace that was invalid

    -

    getResponseArticles (a.k.a. extractResponseArticles)

    +

    validateThisNamespace

    +
    + name     : validateThisNamespace
    + function : checks a given namespace against a list of valid namespaces
    + usage    : $valid = validateThisNamespace($ns, @validNS);
    + args     : ordered list of the namespace of interest and the list of valid NS's
    + returns  : boolean
    +

    +

    +

    getResponseArticles (a.k.a. extractResponseArticles)

      name     : getResponseArticles
      function : get the DOM nodes corresponding to individual
    @@ -461,6 +485,19 @@
               }
           }
        }
    +

    +

    +

    whichDeepestParentObject

    +
    + name     : whichDeepestParentObject
    + function : select the parent node from nodeList that is
    +            closest to the querynode
    + usage    : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList)
    + args     : $CENTRAL - your MOBY::Client::Central object
    +            $queryNode - the node I am interested in
    +            \@nodelist - the list of nodes that I know about
    + returns  : an ontology term as a scalar, or undef if there
    +            is no parent of this node in the nodelist
    From mwilkinson at pub.open-bio.org Sat Dec 27 15:24:52 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat, 27 Dec 2003 15:24:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272024.hBRKOqJS030126@pub.open-bio.org> mwilkinson Sat Dec 27 15:24:52 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv30103/Perl/MOBY Modified Files: CommonSubs.html CommonSubs.pm Log Message: changed my mind and decided to return both the object name as well as its LSID, since the latter is a bit arcane sometimes. moby-live/Perl/MOBY CommonSubs.html,1.7,1.8 CommonSubs.pm,1.37,1.38 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:15:45 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:24:52 1.8 @@ -492,10 +492,10 @@ name : whichDeepestParentObject function : select the parent node from nodeList that is closest to the querynode - usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList) args : $CENTRAL - your MOBY::Client::Central object - $queryNode - the node I am interested in - \@nodelist - the list of nodes that I know about + $queryTerm - the object type I am interested in + \@termlist - the list of object types that I know about returns : an ontology term as a scalar, or undef if there is no parent of this node in the nodelist =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:15:45 1.37 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:24:52 1.38 @@ -1080,10 +1080,10 @@ name : whichDeepestParentObject function : select the parent node from nodeList that is closest to the querynode - usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList) args : $CENTRAL - your MOBY::Client::Central object - $queryNode - the node I am interested in - \@nodelist - the list of nodes that I know about + $queryTerm - the object type I am interested in + \@termlist - the list of object types that I know about returns : an ontology term as a scalar, or undef if there is no parent of this node in the nodelist @@ -1093,21 +1093,21 @@ sub whichDeepestParentObject { use MOBY::Client::OntologyServer; my ($CENTRAL, $queryTerm, $termlist) = @_; - return undef unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); + return (undef,undef) unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); my %nodeLSIDs; foreach (@$termlist){ # get list of known LSIDs my $lsid = $CENTRAL->ObjLSID($_); - $nodeLSIDs{$lsid}=1; + $nodeLSIDs{$lsid}=$_; } my $queryLSID = $CENTRAL->ObjLSID($queryTerm); - return undef unless keys(%nodeLSIDs); + return (undef, undef) unless keys(%nodeLSIDs); my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already - return undef unless $isa; # this should return true or we are in BIIIG trouble! - my @lsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root - while (my $thisnode = shift @lsids){ # @isas are lsid's - return $thisnode if $nodeLSIDs{$thisnode}; + return (undef, undef) unless $isa; # this should return true or we are in BIIIG trouble! + my @ISAlsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root + while (my $thislsid = shift @ISAlsids){ # @isas are lsid's + return ($nodeLSIDs{$thislsid},$thislsid) if $nodeLSIDs{$thislsid}; } - return undef + return (undef, undef); } sub _makeXrefType { From mwilkinson at pub.open-bio.org Sun Dec 28 15:41:59 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sun, 28 Dec 2003 15:41:59 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312282041.hBSKfx4X009349@pub.open-bio.org> mwilkinson Sun Dec 28 15:41:59 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv9318/MOBY Modified Files: Central.pm CommonSubs.pm OntologyServer.pm simple_input.pm Log Message: making MOBY Central case-sensitive for LSIDs. I might have missed a few places. please let me know if you find any. moby-live/Perl/MOBY Central.pm,1.119,1.120 CommonSubs.pm,1.38,1.39 OntologyServer.pm,1.30,1.31 simple_input.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/27 15:12:31 1.119 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/28 20:41:59 1.120 @@ -758,7 +758,7 @@ my $dbh = MOBY::central_db_connection->new->dbh; - my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where namespace_type_uris like '%$existingURI%'"); + my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where INSTR(namespace_type_uris,'$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -768,7 +768,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where INSTR(namespace_type_uris,'$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -778,7 +778,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where INSTR(namespace_type_uris, '$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -788,7 +788,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where INSTR(namespace_type_uris, '$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -1699,7 +1699,7 @@ my $nsquery; foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's - $nsquery .=" OR namespace_type_uris like '%$ns%' "; + $nsquery .=" OR INSTR(namespace_type_uris, '$ns') "; } if ($nsquery){ $nsquery =~ s/OR//; # just the first @@ -1754,7 +1754,7 @@ my $nsquery; foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's - $nsquery .=" OR namespace_type_uris like '%$ns%' "; + $nsquery .=" OR INSTR(namespace_type_uris, '$ns') "; } if ($nsquery){ $nsquery =~ s/^\sOR//; # just the first =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:24:52 1.38 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/28 20:41:59 1.39 @@ -1074,7 +1074,6 @@ } - =head2 whichDeepestParentObject name : whichDeepestParentObject @@ -1084,8 +1083,12 @@ args : $CENTRAL - your MOBY::Client::Central object $queryTerm - the object type I am interested in \@termlist - the list of object types that I know about - returns : an ontology term as a scalar, or undef if there - is no parent of this node in the nodelist + returns : an ontology term and LSID as a scalar, or undef if there + is no parent of this node in the nodelist. + (note that it will only return the term if you give it + term names in the @termList. If you give it + LSID's in the termList, then both the parameters + returned will be LSID's - it doesn't back-translate...) =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/02 00:23:23 1.30 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/28 20:41:59 1.31 @@ -179,7 +179,7 @@ } if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_lsid = ?"); + $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where INSTR(object_lsid, ?)"); } else { $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_type = ?"); } @@ -326,7 +326,7 @@ return (0, "requires both term and ontology arguments\n",'') unless (defined($term) && defined($ont)); my $sth; if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_lsid = ? and ontology=?"); + $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where INSTR(relationship_lsid,?) and ontology=?"); } else { $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_type = ? and ontology=?"); } @@ -433,7 +433,7 @@ my $sth; if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_lsid = ?"); + $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where INSTR(service_lsid, ?)"); } else { $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_type = ?"); } @@ -545,7 +545,7 @@ } if ($term =~ /^urn:lsid:biomoby.org:namespacetype/){ - $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_lsid = ?"); + $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where INSTR(namespace_lsid, ?)"); } else { $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_type = ?"); } @@ -691,7 +691,7 @@ sub getObjectCommonName { my ($self, $URI) = @_; return undef unless $URI =~ /urn\:lsid/; - my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_id = ?}, undef, $URI); + my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_lsid = ?}, undef, $URI); return $name?$name:$URI; } @@ -702,7 +702,7 @@ sub getNamespaceCommonName { my ($self, $URI) = @_; return undef unless $URI =~ /urn\:lsid/; - my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_id = ?}, undef, $URI); + my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_lsid = ?}, undef, $URI); return $name?$name:$URI; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm 2003/05/07 19:20:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm 2003/12/28 20:41:59 1.2 @@ -14,7 +14,7 @@ =head1 SYNOPSIS - use MOBY::authority; + use MOBY::simple_input; my $Instance = MOBY::simple_input->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], From mwilkinson at pub.open-bio.org Sun Dec 28 21:43:43 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sun, 28 Dec 2003 21:43:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312290243.hBT2hhlC010292@pub.open-bio.org> mwilkinson Sun Dec 28 21:43:43 EST 2003 Update of /home/repository/moby/moby-live In directory pub.open-bio.org:/tmp/cvs-serv10273 Modified Files: README Log Message: just testing the new cron on biomoby.org moby-live README,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/README,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/README 2003/02/19 21:12:16 1.3 +++ /home/repository/moby/moby-live/README 2003/12/29 02:43:43 1.4 @@ -1,3 +1,4 @@ +test README # # Revision History From mwilkinson at pub.open-bio.org Tue Dec 30 15:03:54 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue, 30 Dec 2003 15:03:54 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312302003.hBUK3sN1016258@pub.open-bio.org> mwilkinson Tue Dec 30 15:03:54 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16239/Perl/MOBY Modified Files: OntologyServer.pm Log Message: changing the case of the LSID's buggered up the Relationships call of the OntologyServer. I noticed this when the Gbrowse MOBY browser stopped working. moby-live/Perl/MOBY OntologyServer.pm,1.31,1.32 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/28 20:41:59 1.31 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/30 20:03:54 1.32 @@ -801,13 +801,13 @@ $term = $self->getObjectURI($term); } my %results; - while (($term ne 'urn:lsid:biomoby.org:objectclass:object') && ($term ne 'urn:lsid:biomoby.org:servicetype:service')){ + while (($term ne 'urn:lsid:biomoby.org:objectclass:Object') && ($term ne 'urn:lsid:biomoby.org:servicetype:Service')){ my $defs = $self->_doRelationshipsQuery($ontology, $term, $relationship, $direction); my $lsid; my $rel; foreach (@{$defs}){ $lsid = $_->[0]; $rel = $_->[1]; - $debug && _LOG("\t\tADDING RELATIONSHIP $_ : $lsid to $rel\n"); + $debug && _LOG("\t\tADDING RELATIONSHIP $_ : $lsid to $rel\n"); push @{$results{$rel}}, $lsid; } last unless ($expand); From mwilkinson at pub.open-bio.org Tue Dec 30 15:21:31 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue, 30 Dec 2003 15:21:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312302021.hBUKLVww016376@pub.open-bio.org> mwilkinson Tue Dec 30 15:21:31 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16357/Perl/MOBY Modified Files: CommonSubs.pm Log Message: whichDeepestParentObject should return right away if it finds an object in the list you provided it. Before this would actualy return Object if you gave it the exact object type as part of the search moby-live/Perl/MOBY CommonSubs.pm,1.39,1.40 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/28 20:41:59 1.39 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/30 20:21:30 1.40 @@ -1098,11 +1098,12 @@ my ($CENTRAL, $queryTerm, $termlist) = @_; return (undef,undef) unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); my %nodeLSIDs; + my $queryLSID = $CENTRAL->ObjLSID($queryTerm); foreach (@$termlist){ # get list of known LSIDs my $lsid = $CENTRAL->ObjLSID($_); - $nodeLSIDs{$lsid}=$_; + return ($_, $lsid) if ($lsid eq $queryLSID); # of course, if we find it in the list, then return it right away! + $nodeLSIDs{$lsid}=$_; } - my $queryLSID = $CENTRAL->ObjLSID($queryTerm); return (undef, undef) unless keys(%nodeLSIDs); my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already return (undef, undef) unless $isa; # this should return true or we are in BIIIG trouble! From mwilkinson at pub.open-bio.org Tue Dec 2 00:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNax021442@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl Removed Files: MOBY.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl MOBY.pm,1.2,NONE rcsdiff: /home/repository/moby/moby-live/Perl/RCS/MOBY.pm,v: No such file or directory From mwilkinson at pub.open-bio.org Tue Dec 2 00:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNC9021529@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/scripts In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/scripts Modified Files: testMOBYClientCentral_v05.pl Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/scripts testMOBYClientCentral_v05.pl,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl 2003/07/04 16:12:37 1.11 +++ /home/repository/moby/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl 2003/12/02 00:23:23 1.12 @@ -23,7 +23,12 @@ } -my $C = MOBY::Client::Central->new(); +my $C = MOBY::Client::Central->new( +#Registries => { +# mobycentral => {URL => 'http://localhost/cgi-bin/MOBY-Central.pl', +# URI => 'http://localhost/MOBY/Central'} +# } +); #reg first object class From mwilkinson at pub.open-bio.org Tue Dec 2 00:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNoQ021508@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/MOBY/Client Modified Files: Central.html Central.pm CollectionArticle.pm SimpleArticle.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/MOBY/Client Central.html,1.11,1.12 Central.pm,1.62,1.63 CollectionArticle.pm,1.5,1.6 SimpleArticle.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/10/22 14:29:09 1.11 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/02 00:23:23 1.12 @@ -409,7 +409,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) - expandRelationships (NOT YET IMPLEMENTED) + expandRelationships => [1/0] (optional)

    ISA

    =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/11/22 00:08:10 1.62 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/02 00:23:23 1.63 @@ -1294,7 +1294,7 @@ Relationships => \@relationship_types (optional, 'all' if parameter is missing) Registry => $registry_name (optional) - expandRelationships (NOT YET IMPLEMENTED) + expandRelationships => [1/0] (optional) =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/09/12 18:34:21 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/CollectionArticle.pm 2003/12/02 00:23:23 1.6 @@ -9,16 +9,24 @@ =head1 NAME -MOBY::Client::CollectionArticle - a small object describing a MOBY Collection input or output +MOBY::Client::CollectionArticle - a small object describing the Collection articles from the findService Response message of MOBY Central =head1 SYNOPSIS +experimental - please do not use in your code + =cut =head1 DESCRIPTION +This describes the Collection articles from the findService Response of MOBY Central +(i.e. the description of the service), it DOES NOT create collection articles +as provided by a service provider (i.e. simple articles containing data) + =head1 AUTHORS +Mark Wilkinson (markw at illuminae dot com) + =cut =head1 METHODS =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm 2003/07/01 16:01:01 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/SimpleArticle.pm 2003/12/02 00:23:23 1.3 @@ -8,16 +8,24 @@ =head1 NAME -MOBY::Client::SimpleArticle - a small object describing a MOBY Simple input/output article +MOBY::Client::SimpleArticle - a small object describing the Simple articles from the findService Response message of MOBY Central =head1 SYNOPSIS +experimental - please do not use in your code + =cut =head1 DESCRIPTION +This describes the Simple articles from the findService Response of MOBY Central +(i.e. the description of the service), it DOES NOT create simple articles +as provided by a service provider (i.e. simple articles containing data) + =head1 AUTHORS +Mark Wilkinson (markw at illuminae dot com) + =cut =head1 METHODS From mwilkinson at pub.open-bio.org Tue Dec 2 00:23:23 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:23:23 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020023.hB20NNTw021474@pub.open-bio.org> mwilkinson Mon Dec 1 19:23:23 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv21426/Perl/MOBY Modified Files: Central.html Central.pm OntologyServer.pm service_instance.pm Log Message: lots of changes to allow registration of arbitrary SOAP services. MOBY Central expects such services to register their inputs and outputs as LSIDs. They can similarly be discovered using LSID's. A mix of MOBY and non-MOBY inputs and outputs is allowed, but has not been tested. The URL component of the registration is the URL to the WSDL document describing the service. moby-live/Perl/MOBY Central.html,1.9,1.10 Central.pm,1.113,1.114 OntologyServer.pm,1.29,1.30 service_instance.pm,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/11/01 16:42:13 1.9 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html 2003/12/02 00:23:23 1.10 @@ -333,12 +333,54 @@
  • only Input Secondary articles are defined during registration; Output Secondary objects are entirely optional and may or may not be interpreted Client-side using their articleName tags.
  • +
  • Service Categories:
    +
  • +
      Input XML :
           <registerService>
    -         <Category>moby</Category> <!-- one of 'moby', 'cgi', 'soap' ; currently only 'moby' services are fully supported -->
    +         <Category>moby</Category> <!-- one of 'moby', 'cgi', 'wsdl' ; currently only 'moby' and 'wsdl' services are fully supported -->
              <serviceName>YourServiceNameHere</serviceName>
              <serviceType>TypeOntologyTerm</serviceType>
              <authURI>your.URI.here</authURI>
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.113
    retrieving revision 1.114
    diff -u -r1.113 -r1.114
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/11/24 18:06:45	1.113
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 00:23:23	1.114
    @@ -873,25 +873,27 @@
     
     =over 2
     
    -=item *  in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class.  For "soap" services, there is additional flexibility:
    +=item *  in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class.
    +
    +=item *  For "soap" services, there is additional flexibility:
     
     =over 2
     
    -=item *  Similar to a "moby" service, your "soap" service must consume/produce ontologically valid named data-types in order to be discovered by registry searches.  As such, you _must_ register a single unique name for any non-MOBY input or output data Classes, regardless of the actual complexity of the input/output message.
    +=item *  Similar to a "moby" service, your "soap" service must consume/produce named data types.  These are represented as LSID's
     
    -=item *  Do this using the registerObjectClass call of MOBY Central; To ensure uniqueness and LSID compatibilty of data class names, you must name your data using the following format:  your.authURI:dataClassName
    +=item *  YOU DO NOT NEED TO REGISTER THESE DATA TYPES in MOBY Central; it is up to you what your LSID's represent, and MOBY Central WILL NOT try to resolve them!
     
    -=item *  remember, you may use any MOBY Object as your input/output (i.e. any Class Ontology term that inherits from Object) so long as you follow the MOBY message structure for that input or output.
    +=item *  You may mix ontologies when describing your service - i.e. you may freely use any MOBY Object as your input or (XOR) your output and use a non-MOBY object (LSID) for the alternate so long as you follow the MOBY message structure for the parameter that uses the MOBY Object
     
    -=item *  You may register, for example, a service that consumes a non-MOBY data Class and outputs a MOBY data class, so long as you follow the MOBY Messaging format for the output data
    +=over 2
     
    -=item *  You may register, for example, a service that consumes a MOBY data Class and outputs a non-MOBY data class, so long as you follow the MOBY Messaging format for the ihput data
    +=item *  You may register, for example, a service that consumes a non-MOBY data Class and outputs a MOBY data class, so long as you follow the MOBY Messaging format for the output data
     
    -=item *  NOTE: Nether of the cases above are considred MOBY services, and are therefore described in the category of "soap" service
    +=item *  You may register, for example, a service that consumes a MOBY data Class and outputs a non-MOBY data class, so long as you follow the MOBY Messaging format for the input data
     
    -=item *  When registering a non-MOBY data Class name, it DOES NOT have any "Relationship" component (see registerObjectClass API)
    +=item *  NOTE: Nether of the cases above are considered MOBY services, and are therefore described in the category of "soap" service
     
    -=item *  non-MOBY inputs or outputs are described as a single Primary, Simple article of your new named type.
    +=back
     
     =back
     
    @@ -903,6 +905,7 @@
     
     =back
     
    +=back
     
      Input XML :
     
    @@ -1079,17 +1082,18 @@
     	
     	foreach (keys %objects_to_be_validated){
     		my ($valid, $message, $URI) = $OS->objectExists(term => $_);
    -		return &_error("$message","$URI") unless ($valid);
    +		return &_error("$message","$URI") unless ($valid || (($_ =~ /urn:lsid/i) && !($_ =~ /urn:lsid:biomoby.org/i))); # either valid, or a non-moby LSID
     	}
    -	$debug && &_LOG("\n\n\aall objects okay\n");
    +
    +	$debug && &_LOG("\n\n\aall objects okay - either valid MOBY objects, or LSID's\n");
     
     	$OS = MOBY::OntologyServer->new(ontology => 'service');
     	my ($valid, $message, $URI) = $OS->serviceExists(term => $serviceType);
    -	return &_error("$message","$URI") unless ($valid);
    +	print STDERR "\n\nChecking $URI\n\n";
    +	return &_error("$message","$URI") unless ($valid || (($serviceType =~ /urn:lsid/i) && !($serviceType =~ /urn:lsid:biomoby.org/i)));  # either valid, or a non-MOBY LSID
    +	print STDERR "\n\nChecking $URI OK!!\n\n";
     	# right, registration should be successful now!
     	
    -	# "soap" services may only have one input and one output
    -
     	my $SVC = MOBY::service_instance->new(
     		category => $Category,
     		servicename => $serviceName,
    @@ -1158,8 +1162,8 @@
     			($_->getNodeType == TEXT_NODE) && ($object_type = $_->toString);
     		}
     		my ($success, $message, $typeURI) = $OE->objectExists(term => $object_type);
    -		unless ($success) {
    -			$SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist");
    +		if ((!($success) && ($object_type =~ /urn:lsid:biomoby.org/i)) || (!($success) && !($object_type =~ /urn:lsid/i))) {  # if the object doesn't exist, and it isn't an LSID
    +			$SVC->DELETE_THYSELF; return (-1,"object: $object_type does not exist, and is not an LSID");
     		}				# kill it all unless this was successful!
     
     		my $namespace_string;
    @@ -1169,10 +1173,11 @@
     		for (my $n = 0; $n<$num_ns;++$n) {
     			foreach my $name ($namespaces->item($n)->getChildNodes) {
     				if ($name->getNodeType == TEXT_NODE) {
    -					my ($success, $message, $URI) = $OE->namespaceExists(term => $name->toString);
    -					unless ($success) {
    +					my $term = $name->toString;
    +					my ($success, $message, $URI) = $OE->namespaceExists(term => $term);
    +					if ((!($success) && ($term =~ /urn:lsid:biomoby.org/i)) || (!($success) && !($term =~ /urn:lsid/i))) {  # if the object doesn't exist, and it isn't an LSID
     						$SVC->DELETE_THYSELF;
    -						return (-1,"namespace: " . $name->toString . " doesn't exist");
    +						return (-1,"namespace: $term doesn't exist and is not an LSID");
     					}
     					$namespace_string .=$URI.",";
     				}
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
    retrieving revision 1.29
    retrieving revision 1.30
    diff -u -r1.29 -r1.30
    --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/11/24 17:25:49	1.29
    +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/12/02 00:23:23	1.30
    @@ -171,9 +171,13 @@
         my ($self, %args) = @_;
         my $term = $args{term};
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
    -
    -    return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'object');
         my $sth;
    +    return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'object');
    +    
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objecttype/)){
    +        return (1, "external ontology", $term);
    +    }
    +
         if ($term =~ /^urn\:lsid/){
             $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_lsid = ?");
         } else {
    @@ -204,6 +208,10 @@
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objectclass/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -265,11 +273,15 @@
         return (0, "WRONG ONTOLOGY",'') unless ($self->ontology eq 'object');
     
         my $term = $args{term};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:objectclass/)){
    +        return (0, "can't delete from external ontology", $term);
    +    }
    +
         my $LSID;
         unless ($term =~ /urn\:lsid/){$LSID = $self->getObjectURI($term)} else {$LSID=$term}
         return (0, q{Object type $term cannot be resolved to an LSID},"") unless $LSID;
     
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select object_id, object_lsid from object where object_type = ?},undef,$term);
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select object_id, object_lsid from object where object_lsid = ?},undef,$LSID);
         # object1_id ISA object2_id?
         my (@isa) = $self->dbh->selectrow_array(q{select * from object_term2term where object2_id = ?},undef, $id);
         if (scalar @isa){
    @@ -415,6 +427,10 @@
         my $term = $args{term};
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
     
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){
    +        return (1, "external ontology", $term);
    +    }
    +
         my $sth;
         if ($term =~ /^urn\:lsid/){
             $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_lsid = ?");
    @@ -446,6 +462,10 @@
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -475,11 +495,17 @@
         my ($self, %args) = @_;
         return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'service');
         my $term = $args{term};
    -    my $LSID;
    -    unless ($term =~ /urn\:lsid/){$LSID = $self->getServiceURI($term)} else {$LSID=$term}
    -    return (0, q{Service type $term cannot be resolved to an LSID},"") unless $LSID;
     
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select service_id, service_lsid from service where service_type = ?},undef,$term);
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:servicetype/)){
    +        return (0, "can't delete from external ontology", $term);
    +    }
    +
    +    my $LSID;    
    +    unless ($term =~ /^urn:lsid:biomoby.org:servicetype/){$LSID = $self->getServiceURI($term)} else {$LSID=$term}
    +    return (0, q{Service type $term cannot be resolved to an LSID in the MOBY ontologies},"") unless $LSID;
    +
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select service_id, service_lsid from service where service_lsid = ?}, undef, $LSID);
    +
         if (!defined $id){
             return (0, q{Service type $term does not exist in the ontology},$lsid);
         }
    @@ -514,7 +540,11 @@
         $term =~ s/^moby://;   # if the term is namespaced, then remove that
     
         my $sth;
    -    if ($term =~ /^urn\:lsid/){
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){
    +        return (1, "external ontology", $term);
    +    }
    +        
    +    if ($term =~ /^urn:lsid:biomoby.org:namespacetype/){
             $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_lsid = ?");
         } else {
             $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_type = ?");
    @@ -540,10 +570,14 @@
     			#authority => $auth,
     			#contact_email => $email);
         return (0, "WRONG ONTOLOGY!",'') unless ($self->ontology eq 'namespace');
    -    return (0, "requires a object type node",'') unless ($args{node});
    +    return (0, "requires a namespace type node",'') unless ($args{node});
         return (0, "requires an authURI ",'') unless ($args{authority});
         return (0, "requires a contact email address",'') unless ($args{contact_email});
         return (0, "requires a object description",'') unless ($args{description});
    +    my $term = $args{node};
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){  # if it is an LSID, but not a MOBY LSID, than barf
    +        return (0, "can't create a term in a non-MOBY ontology!", $term);
    +    }
     
         my $LSID = ($args{'node'} =~ /urn\:lsid/)?$args{'node'}:$self->setURI($args{'node'});
         unless ($LSID){return (0, "Failed during creation of an LSID",'')}
    @@ -575,8 +609,12 @@
         my $LSID;
         unless ($term =~ /urn\:lsid/){$LSID = $self->getNamespaceURI($term)} else {$LSID=$term}
         return (0, q{Namespace type $term cannot be resolved to an LSID},"") unless $LSID;
    +
    +    if ($term =~ /^urn:lsid/ && !($term =~ /^urn:lsid:biomoby.org:namespacetype/)){
    +        return (0, "cannot delete a term from an external ontology", $term);
    +    }
         
    -    my ($id, $lsid) = $self->dbh->selectrow_array(q{select namespace_id, namespace_lsid from namespace where namespace_type = ?},undef,$term);
    +    my ($id, $lsid) = $self->dbh->selectrow_array(q{select namespace_id, namespace_lsid from namespace where namespace_lsid = ?},undef,$LSID);
         unless ($id){return (0, q{Namespace type $term does not exist in the ontology},$lsid)}
     
         # service1_id ISA service2_id?
    @@ -839,7 +877,7 @@
     sub setURI {
         my ($self, $id) = @_;
         my $URI;
    -    $id = lc($id);
    +    # $id = lc($id);
         if ($self->ontology eq 'object'){
             $URI = "urn:lsid:biomoby.org:objectclass:$id"
         } elsif ($self->ontology eq 'namespace'){
    @@ -847,7 +885,7 @@
         } elsif ($self->ontology eq 'service'){
             $URI = "urn:lsid:biomoby.org:servicetype:$id"
         } elsif ($self->ontology eq 'relationship'){
    -        $URI = "urn:lsid:biomoby.org:servicetype:$id"
    +        $URI = "urn:lsid:biomoby.org:relationshiptype:$id"
         } else {
             $URI = 0
         }
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm,v
    retrieving revision 1.2
    retrieving revision 1.3
    diff -u -r1.2 -r1.3
    --- /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2003/05/08 15:08:03	1.2
    +++ /home/repository/moby/moby-live/Perl/MOBY/service_instance.pm	2003/12/02 00:23:23	1.3
    @@ -197,8 +197,8 @@
         if ($self->service_type){
             my $OE = MOBY::OntologyServer->new(ontology => 'service');
             my ($success, $message, $servicetypeURI) = $OE->serviceExists(term => $self->service_type);
    -        unless ($success){return undef}
    -        $self->service_type_uri($servicetypeURI);
    +        unless (($success || (($self->service_type =~ /urn:lsid/i) && !($self->service_type =~ /urn:lsid:biomoby.org/i)))){return undef}
    +        ($self->service_type =~ /urn:lsid/)?$self->service_type_uri($self->service_type):$self->service_type_uri($servicetypeURI);
         }
         
         my ($serviceid, $category, $name, $typeURI, $authid,$url,$email,$authoritative,$desc) = $dbh->selectrow_array( # does this service already exist?
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  2 00:57:15 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 1 Dec 2003 19:57:15 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312020057.hB20vFsF021742@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec  1 19:57:15 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv21719/MOBY
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    I just remembered that Martin objected to me calling the non-MOBY services 'soap' services, so I now call them 'wsdl' services.  Also fixed some more documentation errors, and fixed an error in the test suite.
    
    moby-live/Perl/MOBY Central.html,1.10,1.11 Central.pm,1.114,1.115
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v
    retrieving revision 1.10
    retrieving revision 1.11
    diff -u -r1.10 -r1.11
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:23:23	1.10
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:57:15	1.11
    @@ -27,7 +27,6 @@
     		
  • deregisterServiceType
  • registerNamespace
  • deregisterNamespace
  • -
  • retrieveRelationshipTypes
  • registerService
  • registerServiceWSDL
  • deregisterService
  • @@ -301,24 +300,6 @@

    ...Registration Object...

    -

    retrieveRelationshipTypes

    -
      -
    • used to remove a Namespace from the controlled vocabulary
      -
    • -
    • will fail if that namespace is being used by any services
      -
    • -
    • you will recieve an email for confirmation of the deregistration
      -
    • -
    -

    Input XML :

    -
    -        <deregisterNamespace>
    -           <namespaceType>MyNamespace</namespaceType>
    -        </deregisterNamespace>
    -

    Ouptut XML :

    -

    ...Registration Object...

    -

    -

    registerService

    • all elements are required
      =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.114 retrieving revision 1.115 diff -u -r1.114 -r1.115 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/02 00:23:23 1.114 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/02 00:57:15 1.115 @@ -812,43 +812,16 @@ } - -=head2 retrieveRelationshipTypes - -=over 3 - -=item * used to remove a Namespace from the controlled vocabulary - -=item * will fail if that namespace is being used by any services - -=item * you will recieve an email for confirmation of the deregistration - -=back - - -Input XML : - - - MyNamespace - - -Ouptut XML : - -...Registration Object... - - =head2 registerService =over 3 =item * all elements are required -=item * a service must have at least one Input OR Output Object Class. +=item * a service must have at least one Input OR Output Object Class. Either Input or Output may be blank to represent "PUT" or "GET" services respectively =item * the contactEmail address must be valid, as it is used to authorize deregistrations and changes to the service you registered. -=item * the Object Classes, Namespaces, and Service Types must all exist for the registration to be successful, so make sure you register these first, or ensure that they already exist in their respective ontologies. - =item * the "authoritativeService" tag is used to indicate whether or not the registered service is "authoritative" for that transformation. i.e. if anyone else were to perform the same transformation they would have to have obtained the information to do so from you. This is similar to, but not necessarily identical to, mirroring someone elses data, since the data in question may not exist prior to service invocation. =item * only Input Secondary articles are defined during registration; Output Secondary objects are entirely optional and may or may not be interpreted Client-side using their articleName tags. @@ -859,7 +832,17 @@ =item * moby - for services that use the MOBY SOAP messaging format and object structure (i.e. the objects used in service transaction inherit from the root 'Object' Class in the MOBY Class ontology). -=item * soap - for other SOAP services that do not use the MOBY messaging format. The other elements in the registration should be interpreted as follows: +=over 2 + +=item * authURI - a URI representing your organization (e.g. yourdomain.com); no http-prefix, and no trailing path information is allowed. + +=item * serviceName - an arbitrary, but unique, name for your service within your authURI namespace + +=item * URL - the URL to a SOAP CGI server that can invoke a method as described by your serviceName + +=back + +=item * wsdl - for other SOAP services that do not use the MOBY messaging format. The other elements in the registration should be interpreted as follows: =over 2 @@ -869,17 +852,19 @@ =item * URL - the URL from which a WSDL document describing your service can be retrieved by an HTTP GET call. -=item * Comments about Input and Output: +=back + +=item * Comments about Input and Output for MOBY and non-MOBY services =over 2 =item * in "moby" services, the input and output messaging structure is defined by the BioMOBY API, and the services use data Objects that are defined in the Class ontology as inheriting from the root "Object" Class. -=item * For "soap" services, there is additional flexibility: +=item * For "wsdl" services, there is additional flexibility: =over 2 -=item * Similar to a "moby" service, your "soap" service must consume/produce named data types. These are represented as LSID's +=item * Similar to a "moby" service, your "wsdl" service must consume/produce named data types. These are represented as LSID's =item * YOU DO NOT NEED TO REGISTER THESE DATA TYPES in MOBY Central; it is up to you what your LSID's represent, and MOBY Central WILL NOT try to resolve them! @@ -905,7 +890,6 @@ =back -=back Input XML : @@ -1063,10 +1047,14 @@ $error .="missing Category \n" unless defined $Category; return &_error("malformed payload $error\n\n","") if ($error); - return &_error("Category may take the (case sensitive) values 'moby', 'cgi', 'soap'\n","") unless (($Category eq "est") || ($Category eq "cgi") || ($Category eq "moby")); + return &_error("Category may take the (case sensitive) values 'moby', 'cgi', 'soap'\n","") unless ( + ($Category eq "wsdl") +# || ($Category eq "cgi") + || ($Category eq "moby") + ); $debug && &_LOG("Entering switch with $Category method\n"); - return &_error("Service categories other than 'moby' and 'soap' are not yet implemented","") unless ($Category eq "moby" || $Category eq "soap"); + return &_error("Service categories other than 'moby' and 'wsdl' are not yet implemented","") unless ($Category eq "moby" || $Category eq "wsdl"); my @IN = @{$INPUTS}; my @OUT = @{$OUTPUTS}; my @SECS = @{$SECONDARY}; From mwilkinson at pub.open-bio.org Tue Dec 2 00:57:16 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Mon, 1 Dec 2003 19:57:16 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312020057.hB20vGuu021766@pub.open-bio.org> mwilkinson Mon Dec 1 19:57:15 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv21719/MOBY/Client Modified Files: Central.html Central.pm Log Message: I just remembered that Martin objected to me calling the non-MOBY services 'soap' services, so I now call them 'wsdl' services. Also fixed some more documentation errors, and fixed an error in the test suite. moby-live/Perl/MOBY/Client Central.html,1.12,1.13 Central.pm,1.63,1.64 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/02 00:23:23 1.12 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/02 00:57:15 1.13 @@ -245,8 +245,8 @@ authURI => $authURI, contactEmail => "your at mail.address", description => $human_readable_description, - category => "moby" | "cgi" | "soap" (currently only moby supported) - URL => $URL_TO_SERVICE
    + category => "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported) + URL => $URL_TO_SERVICE (or URL to WSDL document for wsdl-type services)
         input:      listref; (articleName may be undef) 
                 input =>[
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.63
    retrieving revision 1.64
    diff -u -r1.63 -r1.64
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:23:23	1.63
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:57:15	1.64
    @@ -621,8 +621,8 @@
          authURI      => $authURI,      
          contactEmail => "your at mail.address",      
          description => $human_readable_description, 
    -     category  =>  "moby" | "cgi" | "soap" (currently only moby supported)
    -     URL    =>  $URL_TO_SERVICE
    +     category  =>  "moby" | "cgi" | "wsdl" (currently only moby and wsdl supported)
    +     URL    =>  $URL_TO_SERVICE  (or URL to WSDL document for wsdl-type services)
     
         input:	listref; (articleName may be undef) 
                 input =>[
    @@ -670,8 +670,8 @@
     	my $email = $a{contactEmail}; $email ||="";
     	my $URL = $a{URL}; $URL ||="";
     	my $desc = $a{description}; $desc ||="";
    -	my $Category = lc($a{Category}); $Category ||="moby";
    -	return $self->errorRegXML("Only MOBY Service Categories are currently allowed") unless ($Category eq 'moby');
    +	my $Category = lc($a{category}); chomp $Category; $Category ||="";
    +	return $self->errorRegXML("Only 'moby' and 'wsdl' Service Categories are currently allowed - you gave me $Category") unless (($Category eq 'moby') || ($Category eq 'wsdl'));
     	return $self->errorRegXML("All Fields Required:  serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary") unless (
     		$name && $type && $authURI && $email && $URL && $desc && $Category);
     
    @@ -685,7 +685,7 @@
     			$authURI
     			$email";
     
    -	if ($Category eq "moby") {
    +	if ($Category eq "moby" || $Category eq 'soap') {
     		my %SEC;
     		if ($a{'secondary'} && ref($a{'secondary'} =~ /hash/i)){
     			%SEC = %{$a{secondary}}
    @@ -778,7 +778,7 @@
     		}
     		$message .= "\n";
     		$message .= "";
    -	} else {	return $self->errorRegXML("cannot register services with a client initialized with multiple registries")}
    +	} else {	return $self->errorRegXML("only 'moby' and 'wsdl' service types are allowed to be registered at this time.")}
     
     	#elsif ($Category eq "cgi") {
     	#		my $IN = $a{input}; 
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  2 01:08:24 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 1 Dec 2003 20:08:24 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312020108.hB218O1t021842@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec  1 20:08:24 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv21819/Perl/MOBY
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    still calling Collection articles 'Complex' articles.  This is confusing.  It is now consistent thorughout the documentation
    
    moby-live/Perl/MOBY Central.html,1.11,1.12 Central.pm,1.115,1.116
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.html,v
    retrieving revision 1.11
    retrieving revision 1.12
    diff -u -r1.11 -r1.12
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 00:57:15	1.11
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.html	2003/12/02 01:08:24	1.12
    @@ -304,12 +304,10 @@
     
     
      Input XML :
    @@ -372,13 +378,13 @@
                    human readable COMPREHENSIVE description of your service]]>
              </Description>
              <Input>
    -              <!-- zero or more Primary (Simple and/or Complex) articles -->
    +              <!-- zero or more Primary (Simple and/or Collection) articles -->
              </Input>
              <secondaryArticles>
                   <!-- zero or more INPUT Secondary articles -->
              </secondaryArticles>
              <Output>
    -              <!-- zero or more Primary (Simple and/or Complex) articles --> 
    +              <!-- zero or more Primary (Simple and/or Collection) articles --> 
              </Output>
           </registerService>
    @@ -553,10 +559,10 @@
             <contactEmail>your at email.address</contactEmail>
             <URL>http://endpoint.of.service</URL>;
             <Input>
    -                 <!-- one or more Simple and/or Complex Primary articles -->
    +                 <!-- one or more Simple and/or Collection Primary articles -->
             </Input>
             <Output>
    -                 <!-- one or more Simple and/or Complex Primary articles --> 
    +                 <!-- one or more Simple and/or Collection Primary articles --> 
             </Output>
             <secondaryArticles>
                      <!-- one or more Secondary articles -->
    
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.115
    retrieving revision 1.116
    diff -u -r1.115 -r1.116
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 00:57:15	1.115
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 01:08:24	1.116
    @@ -905,13 +905,13 @@
                    human readable COMPREHENSIVE description of your service]]>
              
              
    -              
    +              
              
              
                   
              
              
    -               
    +               
              
           
     
    @@ -1019,13 +1019,12 @@
     #  http://URL.to.your/CGI.pl
     #  your.URI.here
     #  
    -#     
    +#     
     #  
     #  
    -#     
    +#     
     #  
     #  
    -#     
     #  
     #  
    @@ -1119,7 +1118,7 @@
         my $dbh = $SVC->dbh;
         return  (-1,'Bad node') unless $node->getNodeType == ELEMENT_NODE;
     
    -    # this is a Simple or a Complex object
    +    # this is a Simple or a Collection object
         my $simp_coll = $node->getTagName;
     	$debug && &_LOG("TAGNAME in $inout _registerArticle is $simp_coll");
     	
    @@ -1431,10 +1430,10 @@
     	your at email.address
     	http://endpoint.of.service
     	
    -		 
    +		 
     	
     	
    -		  
    +		  
     	
     	
     		 
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 21:06:51 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:06:51 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092106.hB9L6pJU028188@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:06:51 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28169/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    added a generic server-side parser to CommonSubs that should basically do all of the work for you and be compatible with the 0.6 API.  Not yet documented; just testing on my own services first.
    
    moby-live/Perl/MOBY CommonSubs.pm,1.28,1.29
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.28
    retrieving revision 1.29
    diff -u -r1.28 -r1.29
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/11/12 16:47:16	1.28
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:06:51	1.29
    @@ -143,9 +143,17 @@
     use XML::DOM;
     use MOBY::CrossReference;
     use MOBY::Client::OntologyServer;
    +use strict;
    +use warnings;
     
    - at ISA = qw(Exporter);
    - at EXPORT_OK = qw(
    +use constant COLLECTION => 1;
    +use constant SIMPLE => 2;
    +use constant BE_NICE => 1;
    +use constant BE_STRICT => 0;
    +
    +our @ISA = qw(Exporter);
    +our @EXPORT = qw(COLLECTION SIMPLE BE_NICE BE_STRICT);
    +our @EXPORT_OK = qw(
         getSimpleArticleIDs
         getSimpleArticleNamespaceURI
         simpleResponse
    @@ -165,8 +173,13 @@
         extractResponseArticles
         getResponseArticles
         getCrossReferences
    +    genericServiceInputParser
    +    COLLECTION
    +    SIMPLE
    +    BE_NICE
    +    BE_STRICT
         );
    -%EXPORT_TAGS =(all => [qw(
    +our %EXPORT_TAGS =(all => [qw(
         getSimpleArticleIDs
         getSimpleArticleNamespaceURI
         simpleResponse
    @@ -186,9 +199,39 @@
         extractResponseArticles
         getResponseArticles
         getCrossReferences
    +    genericServiceInputParser
    +    COLLECTION
    +    SIMPLE
    +    BE_NICE
    +    BE_STRICT
         )]);
     
     
    +
    +sub genericServiceInputParser {
    +    my ($message, $namespaces) = @_;  # get the incoming MOBY query XML
    +    my @inputs;           # set empty response
    +    my @queries = getInputs($message);  # returns XML::DOM nodes
    +    
    +    foreach my $query(@queries){
    +        my $queryID = getInputID($query);  # get the queryID attribute of the queryInput
    +        my @input_articles = getArticles($query); # get the Simple/Collection articles making up this query
    +        foreach my $input(@input_articles){       # input is a listref
    +           my ($articleName, $article) = @{$input}; # get the named article
    +           my $simple = isSimpleArticle($article);  # articles may be simple or collection
    +           my $collection = isCollectionArticle($article);
    +            if ($collection){
    +                my @simples = getCollectedSimples($article);
    +                push @inputs, [COLLECTION,$queryID, \@simples];
    +
    +            } elsif ($simple){
    +                push @inputs, [SIMPLE,$queryID,$simple];
    +            }
    +        }
    +    }
    +    return @inputs;
    +}
    +
     #################################################
     					 ##################################
     					 ##################################
    @@ -482,7 +525,7 @@
     sub getInputs {
     
     	my ($XML) = @_;
    -
    +    my $moby;
         unless (ref($XML) =~ /XML\:\:DOM/){
             my $parser = new XML::DOM::Parser;
             my $doc = $parser->parse($XML);
    @@ -573,7 +616,7 @@
         return undef unless $moby->getNodeType == ELEMENT_NODE;
         return undef unless ($moby->getTagName =~ /queryInput/ || $moby->getTagName =~ /queryResponse/);
         my @articles;
    -    foreach $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +    foreach my $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
             next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
             next unless ($child->getTagName =~ /Simple/ || $child->getTagName =~ /Collection/);
             my $articleName = $child->getAttribute('articleName');
    @@ -608,7 +651,7 @@
         return undef unless ($moby->getTagName =~ /Collection/);
         
         my @articles;
    -    foreach $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +    foreach my $child($moby->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
             next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
             next unless ($child->getTagName =~ /Simple/);
             push @articles, $child;   # take the child elements, which are  or 
    @@ -667,7 +710,7 @@
         my @queries;
         for (0..$x->getLength-1){ # there may be more than one queryInput per message
     		my @this_query;
    -        foreach $child($x->item($_)->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
    +        foreach my $child($x->item($_)->getChildNodes){ # there may be more than one Simple/Collection per input; iterate over them 
                 next unless $child->getNodeType == ELEMENT_NODE; # ignore whitespace
                     push @this_query, $child;   # take the child elements, which are  or 
             }
    @@ -814,7 +857,7 @@
             $nodes = $node->getElementsByTagName("moby:$element");
         }
     	for (0..$nodes->getLength-1){
    -        $child = $nodes->item($_);
    +        my $child = $nodes->item($_);
     		if (
                 (($child->getAttribute("articleName")) && (($child->getAttribute("articleName") eq $articleName)))
                 || (($child->getAttribute("moby:articleName")) && (($child->getAttribute("moby:articleName") eq $articleName)))){
    @@ -859,6 +902,29 @@
     }
     
     
    +
    +
    +=head2 validateThisNamespace
    +
    + name     : validateThisNamespace
    + function : checks a given namespace against a list of valid namespaces
    + usage    : $valid = validateThisNamespace($ns, @validNS);
    + args     : ordered list of the namespace of interest and the list of valid NS's
    + returns  : boolean
    +
    +
    +=cut
    +
    +
    +sub validateThisNamespace {
    +    my ($ns, @namespaces) = @_;
    +    foreach (@namespaces){
    +        return 1 if $ns eq $_;
    +    }
    +    return 0;
    +}
    +
    +
     =head2 getResponseArticles (a.k.a. extractResponseArticles)
     
      name     : getResponseArticles
    @@ -976,7 +1042,7 @@
             }
         }
         foreach (@xrefs){
    -        $x = &_makeXrefType($_) if $_->getTagName =~/Xref/;
    +        my $x = &_makeXrefType($_) if $_->getTagName =~/Xref/;
             $x = &_makeObjectType($_) if $_->getTagName =~ /Object/;
             push @XREFS, $x if $x;
         }
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 21:06:51 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:06:51 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092106.hB9L6phR028208@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:06:51 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28169/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    added a generic server-side parser to CommonSubs that should basically do all of the work for you and be compatible with the 0.6 API.  Not yet documented; just testing on my own services first.
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.36,1.37
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.36
    retrieving revision 1.37
    diff -u -r1.36 -r1.37
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/10/21 14:09:21	1.36
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 21:06:51	1.37
    @@ -8,6 +8,8 @@
     
     use strict;
     use SOAP::Lite;
    +use DBI;
    +use DBD::mysql;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -26,37 +28,27 @@
                                            # last parameter passed to the subroutine
     
     sub getGoTerm {
    +    my ($caller, $message) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($message, []); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my $SOM = pop;  # NOTA BENE!!  You only do this if you have set @ISAQ = qw(SOAP::Server::Parameters) above!!!!!
    -    my ($self, $data) = @_;
    -    my $response = "";
    -	my @accessions;
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'GO');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace GO does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +    my @validNS = validateNamespaces();  # ONLY do this if you are intending to be namespace aware!
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data);
    -	foreach (@input_nodes){
    -		my ($input) = @{$_}; # this service only allows one input per query, so take the first
    -		my $ns = getSimpleArticleNamespaceURI($input);
    -		push @accessions, undef unless $ns eq $VALID_NAMESPACE; # if we have been sent an invalid namespace, then stack an undef as a response
    -		my ($id) = getSimpleArticleIDs($ns, [$input]);
    -		if (defined $id){
    -			push @accessions, $id;
    -		} else {
    -			push @accessions, undef;
    -		}
    +	my @accessions;
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			((push @accessions, undef) && (next)) unless validateThisNamespace($ns, @validNS);
    +			push @accessions, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):1;
    +        }
         }
    -
    -    use DBI;
    -    use DBD::mysql;
         my $dbh = _dbAccess('go');
    -    die "can't connecvt to database\n" unless $dbh;
    +    die "can't connect to GO database\n" unless $dbh;
         my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
         
         foreach my $acc(@accessions){
    @@ -66,20 +58,16 @@
             $sth->execute($acc);        
             my ($term, $def) = $sth->fetchrow_array;
             if ($term){
    -            $response .= simpleResponse("
    +            $MOBY_RESPONSE .= simpleResponse("
                     
                         $term
                         $def
                     ")
             } else {
    -            $response .= simpleResponse("")
    +            $MOBY_RESPONSE .= simpleResponse("")
             }
         }
    -
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    -    
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
     
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 21:23:24 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:23:24 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092123.hB9LNOTl028369@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:23:24 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28350/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    dumb dumb dumb dumb
    
    moby-live/Perl/MOBY CommonSubs.pm,1.29,1.30
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.29
    retrieving revision 1.30
    diff -u -r1.29 -r1.30
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:06:51	1.29
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:23:24	1.30
    @@ -209,7 +209,7 @@
     
     
     sub genericServiceInputParser {
    -    my ($message, $namespaces) = @_;  # get the incoming MOBY query XML
    +    my ($message) = @_;  # get the incoming MOBY query XML
         my @inputs;           # set empty response
         my @queries = getInputs($message);  # returns XML::DOM nodes
         
    @@ -225,7 +225,7 @@
                     push @inputs, [COLLECTION,$queryID, \@simples];
     
                 } elsif ($simple){
    -                push @inputs, [SIMPLE,$queryID,$simple];
    +                push @inputs, [SIMPLE,$queryID,$article];
                 }
             }
         }
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 21:30:33 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:30:33 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092130.hB9LUXWW028465@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:30:33 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28446/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    dumb dumb dumb dumb
    
    moby-live/Perl/MOBY CommonSubs.pm,1.30,1.31
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.30
    retrieving revision 1.31
    diff -u -r1.30 -r1.31
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:23:24	1.30
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:30:33	1.31
    @@ -168,6 +168,7 @@
         extractRawContent
         collectionResponse
         validateNamespaces
    +    validateThisNamespace
         isSimpleArticle
         isCollectionArticle
         extractResponseArticles
    @@ -194,6 +195,7 @@
         extractRawContent
         collectionResponse
         validateNamespaces
    +    validateThisNamespace
         isSimpleArticle
         isCollectionArticle
         extractResponseArticles
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 21:38:39 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 16:38:39 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092138.hB9LcdU5028578@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 16:38:39 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28559/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    initialize possibly undef values
    
    moby-live/Perl/MOBY CommonSubs.pm,1.31,1.32
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.31
    retrieving revision 1.32
    diff -u -r1.31 -r1.32
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:30:33	1.31
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:38:39	1.32
    @@ -370,8 +370,12 @@
     
     sub simpleResponse {
         my ($data, $articleName, $qID) = @_;  # articleName optional
    -    $data ||='';
         $qID = &_getQueryID($qID) if ref($qID) =~ /XML::DOM/; # in case they send the DOM instead of the ID
    +
    +    $data ||='';  # initialize to avoid uninit value errors
    +    $qID ||="";
    +    $articleName ||="";
    +    
         if ($articleName) {
             return "
             
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 22:24:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:24:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092224.hB9MO3AB028801@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:24:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28763/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    updating my GO services to be 0.6 compliant and a bit more readable
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.37,1.38
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.37
    retrieving revision 1.38
    diff -u -r1.37 -r1.38
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 21:06:51	1.37
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:24:03	1.38
    @@ -10,6 +10,7 @@
     use SOAP::Lite;
     use DBI;
     use DBD::mysql;
    +use GO::AppHandle;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -24,85 +25,60 @@
     #getNodeContentWithArticle
     
     use vars qw(@ISA);
    - at ISA = qw(SOAP::Server::Parameters);   # uncomment this line if you want access to the SOM as the
    -                                       # last parameter passed to the subroutine
     
     sub getGoTerm {
         my ($caller, $message) = @_;
         my $MOBY_RESPONSE;
    -    my (@inputs)= genericServiceInputParser($message, []); # ([SIMPLE, $queryID, $simple],...)
    +    my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...)
         return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my @validNS = validateNamespaces();  # ONLY do this if you are intending to be namespace aware!
    +    my @validNS = validateNamespaces("GO");  # ONLY do this if you are intending to be namespace aware!
    +
    +    my $dbh = _dbAccess('go');
    +    die "can't connect to GO database\n" unless $dbh;
    +    my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
     
    -	my @accessions;
         foreach (@inputs){
             my ($articleType, $ID, $input) = @{$_};
             unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $ID) ;
    +            $MOBY_RESPONSE .= simpleResponse("", "Collection_Article_Not_allowed_as_input", $ID);
                 next;
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
    -			((push @accessions, undef) && (next)) unless validateThisNamespace($ns, @validNS);
    -			push @accessions, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):1;
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $accession = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			unless (defined($accession)){
    +				$MOBY_RESPONSE .= simpleResponse("", "Invalid_Accession", $ID);
    +				next;
    +			}
    +			unless ($accession =~/^GO:/){
    +				$accession = "GO:$accession";  # we still haven't decided on whether id's should include the prefix...
    +			}
    +			$sth->execute($accession);        
    +			my ($term, $def) = $sth->fetchrow_array;
    +			if ($term){
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						$term
    +						$def
    +					", "GO_Term_From_ID", $ID)
    +			} else {
    +				$MOBY_RESPONSE .= simpleResponse("", "NO_Term_Found", $ID)
    +			}
             }
         }
    -    my $dbh = _dbAccess('go');
    -    die "can't connect to GO database\n" unless $dbh;
    -    my $sth = $dbh->prepare(q{select name, term_definition from term, term_definition where term.id = term_definition.term_id and acc=?});
         
    -    foreach my $acc(@accessions){
    -		unless ($acc =~/^GO:/){
    -			$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    -		}
    -        $sth->execute($acc);        
    -        my ($term, $def) = $sth->fetchrow_array;
    -        if ($term){
    -            $MOBY_RESPONSE .= simpleResponse("
    -                
    -                    $term
    -                    $def
    -                ")
    -        } else {
    -            $MOBY_RESPONSE .= simpleResponse("")
    -        }
    -    }
         return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
    -
     sub getGoTermAssociations {
    +    my ($caller, $message) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($message); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my $SOM = pop;  
    -    my ($self, $data) = @_;
    -    my $response = "";
    -	my @accessions;
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'GO');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace GO does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data);
    -	foreach (@input_nodes){
    -		my ($input) = @{$_}; # this service only allows one input per query, so take the first
    -		my $ns = getSimpleArticleNamespaceURI($input);
    -		push @accessions, undef unless $ns eq $VALID_NAMESPACE; # if we have been sent an invalid namespace, then stack an undef as a response
    -		my ($id) = getSimpleArticleIDs($ns, [$input]);
    -		if (defined $id){
    -			push @accessions, $id;
    -		} else {
    -			push @accessions, undef;
    -		}
    -    }
    -
    -    use DBI;
    -    use DBD::mysql;
         my $dbh = _dbAccess('go');
    -    die "can't connecvt to database\n" unless $dbh;
    +    die "can't connect to database\n" unless $dbh;
         my $sth = $dbh->prepare("
     		select
     			gp.symbol,
    @@ -125,27 +101,39 @@
     		and a.is_not = 0
     		and t.id = d.term_id 
     		order by species_id");
    -							
    -    foreach my $acc(@accessions){
    -		unless ($acc =~/^GO:/){
    -			$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    -		}
    -		my @simples;
    -        $sth->execute($acc);
    -        while (my ($symb, $sp, $namsp, $type, $name, $def) = $sth->fetchrow_array){
    -            my $response_data .= "\n";
    -			$response_data .= "	\n";
    -			$response_data .= "		\n";
    -			$response_data .= "		\n";
    -            $response_data .= "	\n";
    -            $response_data .= "\n";
    -			push @simples, $response_data;
    +
    +    my @validNS = validateNamespaces("GO");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= collectionResponse([], "Collection_Article_Input_Invalid", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= $MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $acc, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			unless (defined($acc)){
    +				$MOBY_RESPONSE .= collectionResponse([], "Invalid_Accession", $ID);
    +				next;
    +			}
    +			unless ($acc =~/^GO:/){
    +				$acc = "GO:$acc";  # we still haven't decided on whether id's should include the prefix...
    +			}
    +			my @simples;
    +			$sth->execute($acc);
    +			while (my ($symb, $sp, $namsp, $type, $name, $def) = $sth->fetchrow_array){
    +				my $response_data .= "\n";
    +				$response_data .= "	\n";
    +				$response_data .= "		\n";
    +				$response_data .= "	\n";
    +				$response_data .= "\n";
    +				push @simples, $response_data;
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples,"Known_GO_Term_Associations",$ID); # after all images have been collected, create the collection
             }
    -		$response .= collectionResponse(\@simples); # after all images have been collected, create the collection
         }
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
         
     }
     
    @@ -153,67 +141,51 @@
     sub RetrieveGOFromKeywords {
     	my $SOM = pop; 	
     	my ($self, $query) = @_;
    -	use GO::AppHandle;
    -
    -	my $ua = new LWP::UserAgent;
    -	my $req = new HTTP::Request GET => 'http://www.godatabase.org/dev/database/server.cfg';
    -	my $res = $ua->request($req);
    +	# INITIALIZE CONNECTION TO GO DB
     	my $host; my $dbname;
     	$host = "sin.lbl.gov";
     	$dbname = "go";
    -#	if ($res->is_success) {
    -	#	my $resp =  $res->content;
    -	#	if ($resp =~ /(\w+)\@(\S+)/){
    -	#		$host = $2;
    -	#		$dbname= $1;
    -	#	} else {
    -	#		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	#	}
    -	#}
     	my %connect_hash;
     	$connect_hash{-dbname}=$dbname;
     	$connect_hash{-dbhost}=$host;
    -	
     	my $GO_API = GO::AppHandle->connect(%connect_hash);
     	unless ($GO_API){
     		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
     	}
    +	# DB is now initialized
     	
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'Global_Keyword');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace Global_Keyword does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($query); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($query); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my $response;
    -	foreach (@input_nodes){
    -		my $input =  $_->[0];  # we only allow one input object per query
    -		my ($kw) = getSimpleArticleIDs($VALID_NAMESPACE, [$input]);
    -		($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
    -		my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    -		next unless($terms[0]);
    -		my @simples;
    -		foreach my $term(@terms){
    -			my $acc = $term->public_acc;
    -			my $def = $term->definition;
    -			my $name = $term->name;
    -            push @simples, "
    -                    
    -						
    -					
    -                    $name
    -                    $def
    -                ";
    +    my @validNS = validateNamespaces("Global_Keyword");  # ONLY do this if you are intending to be namespace aware!
    +    foreach (@inputs){
    +        my ($articleType, $ID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= collectionResponse([], "Collection_Input_Invalid", $ID) ;
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my $kw = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +            ($MOBY_RESPONSE .= collectionResponse([], "No_Keyword", $ID) && (next)) unless defined $kw;
    +			($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
    +			my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    +			next unless($terms[0]);
    +			my @simples;
    +			foreach my $term(@terms){
    +				my $acc = $term->public_acc;
    +				my $def = $term->definition;
    +				my $name = $term->name;
    +				push @simples, "
    +						$name
    +						$def
    +					";
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples, "GO_terms_from_keywords", $ID);
     		}
    -		$response .= collectionResponse(\@simples);
    -	}
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse	
    +    }
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
     
     
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 22:24:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:24:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092224.hB9MO30d028782@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:24:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28763/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    updating my GO services to be 0.6 compliant and a bit more readable
    
    moby-live/Perl/MOBY CommonSubs.pm,1.32,1.33
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.32
    retrieving revision 1.33
    diff -u -r1.32 -r1.33
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 21:38:39	1.32
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 22:24:03	1.33
    @@ -248,16 +248,16 @@
      function : to get the IDs of simple articles that are in the given namespace
      usage    : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles);
      args     : (in order)
    -            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology
    +            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
                 \@Simples   - (required) a listref of Simple XML::DOM nodes
                               i.e. the XML::DOM representing an XML structure like this:
                                   
                                       
                                   
    - note     : it will return *only* the ids that are in the given namespace
    + note     : it will return *only* the ids that are in the given namespace, if you provide one
                 but since you are required to return an output for every input
                 (even if it is invalid) this routine will return undef for
    -            those articles that are not in that namespace
    +            those articles in the list that are not in that namespace so you can keep track
     
     =cut
     
    @@ -271,45 +271,52 @@
     	my @input_nodes = @{$input_nodes};
     	my $OS = MOBY::Client::OntologyServer->new;
     	my ($s, $m);
    -	($s, $m, $desired_namespace) = $OS->namespaceExists(term => $desired_namespace); # returns (success, message, lsid)
    -	return undef unless $s;  # bail if not successful
    +    if ($desired_namespace){
    +        ($s, $m, $desired_namespace) = $OS->namespaceExists(term => $desired_namespace); # returns (success, message, lsid)
    +    	unless ($s){  # bail if not successful
    +            print STDERR "MOBY::CommonSubs WARNING ** the namespace $desired_namespace does not exist in the MOBY ontology, and is not a valid LSID\n";
    +            return undef;
    +    	}
    +    }
     
    -	my @accessions;	
    +	my @ids;	
     	foreach my $in(@input_nodes){
     		#$in = ""
             next unless $in->getNodeName =~ /simple/i;  # only allow simples
     		my @simples = $in->getChildNodes;
     		foreach (@simples){ # $_ = 
     			next unless $_->getNodeType == ELEMENT_NODE;
    -			my $ns = $_->getAttributeNode('namespace');  # get the namespace DOM node
    -			$ns = $_->getAttributeNode('moby:namespace') unless ($ns);  # perhaps it is namespaced...
    -			unless ($ns){   # if we don't get it at all, then move on to the next input
    -				push @accessions, undef;  # but push an undef onto teh stack in order
    -				next;
    -			}
    -			$ns = $ns->getValue;   # if we have a namespace, then get its value
    -			($s, $m, $ns) = $OS->namespaceExists(term => $ns);
    -			
    -			unless ($ns eq $desired_namespace){  # we are registering as working in a particular namespace, so check this
    -				push @accessions, undef;  # and push undef onto the stack if it isn't 
    -				next;
    +			if ($desired_namespace){
    +                my $ns = $_->getAttributeNode('namespace');  # get the namespace DOM node
    +                $ns = $_->getAttributeNode('moby:namespace') unless ($ns);  # perhaps it is namespaced...
    +                unless ($ns){   # if we don't get it at all, then move on to the next input
    +                    push @ids, undef;  # but push an undef onto teh stack in order
    +                    next;
    +                }
    +                $ns = $ns->getValue;   # if we have a namespace, then get its value
    +                ($s, $m, $ns) = $OS->namespaceExists(term => $ns);
    +                
    +                unless ($ns eq $desired_namespace){  # we are registering as working in a particular namespace, so check this
    +                    push @ids, undef;  # and push undef onto the stack if it isn't 
    +                    next;
    +                }
     			}
     			# Now do the same thing for ID's
     			my $id = $_->getAttributeNode('id');
     			$id = $_->getAttributeNode('moby:id') unless ($id);
     			unless ($id){
    -				push @accessions, undef;
    +				push @ids, undef;
     				next;
     			}
     			$id = $id->getValue;
     			unless (defined $id){  # it has to have a hope in hell of retrieving something...
    -				push @accessions, undef;  # otherwise push undef onto the stack if it isn't 
    +				push @ids, undef;  # otherwise push undef onto the stack if it isn't 
     				next;
     			}
    -			push @accessions, $id;
    +			push @ids, $id;
     		}
     	}
    -	return @accessions;
    +	return @ids;
     }
     
     
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 22:47:16 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:47:16 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092247.hB9MlGoI028900@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:47:16 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28881/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    dumb.  I was picking up the results of the XML parse as a scalar instead of a list
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.38,1.39
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.38
    retrieving revision 1.39
    diff -u -r1.38 -r1.39
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:24:03	1.38
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:47:16	1.39
    @@ -46,7 +46,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $accession = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($accession) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
     			unless (defined($accession)){
     				$MOBY_RESPONSE .= simpleResponse("", "Invalid_Accession", $ID);
     				next;
    @@ -112,7 +112,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= $MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $acc, defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
     			unless (defined($acc)){
     				$MOBY_RESPONSE .= collectionResponse([], "Invalid_Accession", $ID);
     				next;
    @@ -167,7 +167,7 @@
             } else {
     			my $ns = getSimpleArticleNamespaceURI($input);
     			(($MOBY_RESPONSE .= collectionResponse([], "Invalid_Namespace", $ID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my $kw = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +			my ($kw) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
                 ($MOBY_RESPONSE .= collectionResponse([], "No_Keyword", $ID) && (next)) unless defined $kw;
     			($kw) = (($kw =~ /^\s*(.*)\s*$/) && ($1));
     			my @terms = @{$GO_API->get_terms({search=>"$kw"})};
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec  9 22:56:19 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 9 Dec 2003 17:56:19 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312092256.hB9MuJrE028986@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec  9 17:56:19 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv28967/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    eek, I broke all my services.  I am no longer poping the SOM off the end of the argument list, since I never use it.  They should all kick back into life now
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.39,1.40
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.39
    retrieving revision 1.40
    diff -u -r1.39 -r1.40
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:47:16	1.39
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:56:19	1.40
    @@ -202,7 +202,6 @@
     #  =        namespace                            =
     #  ===============================================
     sub GenbankAccVirtualSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -246,7 +245,6 @@
         return $SOAPResponse
     }
     sub GenbankAccSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -291,7 +289,6 @@
         return $SOAPResponse   
     }
     sub GenbankGIVirtualSequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -336,7 +333,6 @@
     }
     
     sub GenbankGISequenceRetrieve {
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; my @accessions;
     
    @@ -389,7 +385,7 @@
     # and producing GenericSequence objects.  However, it will
     # actually produce DNA, RNA or PRotein objects, as appropriate
     # and will produce a cross-reference block as well
    -    my $SOM = pop;  
    +
         my ($self, $data) = @_;
         my $response; my @gis;
     
    @@ -476,7 +472,6 @@
     sub GenbankRecordRetrieve {
     	use Bio::SeqIO;
     	use IO::String;
    -    my $SOM = pop;  
         my ($self, $data) = @_;
         my $response; # prepare a variable to hold the responses
     
    @@ -548,7 +543,7 @@
     #################################################
     
     sub getDragonMutantImages {
    -	my $SOM = pop;  
    +
         my ($self, $data) = @_;
     	use Ace;
     	use LWP::UserAgent;
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 22:22:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:22:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102222.hBAMM3QV032633@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:22:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv32614/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    minor changes to make some CommonSubs more friendly.  Also added a new service which is the beginning of me weaning myself off of GenBank because genbank is broken almost every time I need to use it.  The new service uses SeqHound to make the data lookups, so it is always 24 hours behind the real genbank, but thats not bad.  The new service consumes NCBI_Acc, NCBI_gi, PIR, Swissprot, EMBL, or PDB identifiers and returns the genbank record as a flatfile
    
    moby-live/Perl/MOBY CommonSubs.pm,1.33,1.34
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.33
    retrieving revision 1.34
    diff -u -r1.33 -r1.34
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/09 22:24:03	1.33
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/10 22:22:03	1.34
    @@ -247,24 +247,29 @@
      name     : getSimpleArticleIDs
      function : to get the IDs of simple articles that are in the given namespace
      usage    : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles);
    - args     : (in order)
    -            $Namespace  - (required) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
    +            my @ids = getSimpleArticleIDs(\@SimpleArticles);
    + args     : $Namespace  - (optional) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care
                 \@Simples   - (required) a listref of Simple XML::DOM nodes
                               i.e. the XML::DOM representing an XML structure like this:
                                   
                                       
                                   
    - note     : it will return *only* the ids that are in the given namespace, if you provide one
    -            but since you are required to return an output for every input
    -            (even if it is invalid) this routine will return undef for
    -            those articles in the list that are not in that namespace so you can keep track
    + note     : If you provide a namespace, it will return *only* the ids that are in the given namespace,
    +            but will return 'undef' for any articles in the WRONG namespace so that you get an
    +            equivalent number of outputs to inputs.
    +            
    +            Note that if you call this with a single argument, this is assumed to
    +            be \@Articles, so you will get ALL id's regardless of namespace!
     
     =cut
     
     
     sub getSimpleArticleIDs {
     	my ($desired_namespace, $input_nodes) = @_;
    -	return undef unless $input_nodes;
    +	if ($desired_namespace && !($input_nodes)){  # if called with ONE argument, then these are the input nodes!
    +        $input_nodes = $desired_namespace;
    +        $desired_namespace = undef;   
    +	}
         $input_nodes = [$input_nodes] unless ref($input_nodes) =~ /ARRAY/; # be flexible!
     	return undef unless scalar @{$input_nodes};
     
    @@ -281,6 +286,7 @@
     
     	my @ids;	
     	foreach my $in(@input_nodes){
    +        next unless $in;
     		#$in = ""
             next unless $in->getNodeName =~ /simple/i;  # only allow simples
     		my @simples = $in->getChildNodes;
    @@ -932,6 +938,7 @@
     sub validateThisNamespace {
         my ($ns, @namespaces) = @_;
         foreach (@namespaces){
    +        next unless $_;
             return 1 if $ns eq $_;
         }
         return 0;
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 22:22:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:22:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102222.hBAMM3Ul032652@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:22:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv32614/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    minor changes to make some CommonSubs more friendly.  Also added a new service which is the beginning of me weaning myself off of GenBank because genbank is broken almost every time I need to use it.  The new service uses SeqHound to make the data lookups, so it is always 24 hours behind the real genbank, but thats not bad.  The new service consumes NCBI_Acc, NCBI_gi, PIR, Swissprot, EMBL, or PDB identifiers and returns the genbank record as a flatfile
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.40,1.41
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.40
    retrieving revision 1.41
    diff -u -r1.40 -r1.41
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/09 22:56:19	1.40
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:22:03	1.41
    @@ -7,6 +7,7 @@
     use lib "/export/home/root/BIOPERL/perl-api";
     
     use strict;
    +use SeqHound;
     use SOAP::Lite;
     use DBI;
     use DBD::mysql;
    @@ -23,6 +24,7 @@
     #responseFooter
     #getInputArticles
     #getNodeContentWithArticle
    +my $debug = 1;
     
     use vars qw(@ISA);
     
    @@ -201,49 +203,126 @@
     #  =        having a single service for each     =
     #  =        namespace                            =
     #  ===============================================
    -sub GenbankAccVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
     
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_Acc');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    +sub _generic_service_template {
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +			# do your thing here!
    +        }
    +    }
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +}
    +
    +sub MOBYSHoundGetGenBankff {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
     	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc (@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetGenBankff($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "";
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "
    +					
    +						
    +					
    +					";
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= "
    +					
    +						
    +					
    +					";
    +			}
     		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_acc($acc);
    -		my $length;
    -		if ($seq){$length = $seq->length;}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +}
    +
    +sub GenbankAccVirtualSequenceRetrieve {
    +    my ($self, $data) = @_;
    +
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +			(($MOBY_RESPONSE .= simpleResponse("", "no_input_object", $qID)) && (next)) unless (defined $input);
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse([], "Invalid_Namespace", $qID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    +			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    +            ($MOBY_RESPONSE .= collectionResponse([], "No_Accession_provided", $qID) && (next)) unless defined $acc;
    +			use Bio::DB::GenBank;
    +			my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    +			my $seq = $gb->get_Seq_by_acc($acc);
    +			my $length;
    +			if ($seq){$length = $seq->length;}
    +			if ($length){
    +				$MOBY_RESPONSE .= simpleResponse("
    +			
    +				$length
    +			", "", $qID);
    +			} else {
    +				$MOBY_RESPONSE .= simpleResponse("", "sequence_has_no_length", $qID);
    +			}
     		}
     	}
    -		
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
     }
    +
     sub GenbankAccSequenceRetrieve {
         my ($self, $data) = @_;
         my $response; my @accessions;
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 22:34:36 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:34:36 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102234.hBAMYaZc032738@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:34:36 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv32719/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    small changes to service output
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.41,1.42
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.41
    retrieving revision 1.42
    diff -u -r1.41 -r1.42
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:22:03	1.41
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:34:36	1.42
    @@ -70,7 +70,7 @@
             }
         }
         
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub getGoTermAssociations {
    @@ -135,7 +135,7 @@
     			$MOBY_RESPONSE .= collectionResponse(\@simples,"Known_GO_Term_Associations",$ID); # after all images have been collected, create the collection
             }
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
         
     }
     
    @@ -187,7 +187,7 @@
     			$MOBY_RESPONSE .= collectionResponse(\@simples, "GO_terms_from_keywords", $ID);
     		}
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     
    @@ -223,7 +223,7 @@
     			# do your thing here!
             }
         }
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub MOBYSHoundGetGenBankff {
    @@ -281,8 +281,8 @@
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    +	#print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
     sub GenbankAccVirtualSequenceRetrieve {
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 22:40:57 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:40:57 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102240.hBAMevNm000374@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:40:56 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv355/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    Doh.  Use the output format you dummy
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.42,1.43
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.42
    retrieving revision 1.43
    diff -u -r1.42 -r1.43
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:34:36	1.42
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:40:56	1.43
    @@ -262,21 +262,23 @@
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					";
    +					",
    +					"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					";
    +					",
    +					"", $qID);
     			}
     		}
         }
    
    
    
    From mwilkinson at pub.open-bio.org  Wed Dec 10 22:45:12 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Wed, 10 Dec 2003 17:45:12 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312102245.hBAMjCKF000512@pub.open-bio.org>
    
    
    mwilkinson
    Wed Dec 10 17:45:12 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv493/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    missed one
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.43,1.44
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.43
    retrieving revision 1.44
    diff -u -r1.43 -r1.44
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:40:56	1.43
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:45:11	1.44
    @@ -256,7 +256,7 @@
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my $gb = SHoundGetGenBankff($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= "";
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 15:36:38 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 10:36:38 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111536.hBBFac9j003421@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 10:36:38 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv3402/Perl/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    the last of the Sequence services complete.  We now return genbank flatfiles, fasta, Virtual, DNA, RNA, AA sequence objects for gi's, gb accessions, PDB, embl (embl doesn't work at the moment for unknown reasons), SP, and PIR.  These services should be sufficient for me to de-register the services that are currently depending on genbank via bioperl.  Unfortunately, genbank is sufficiently unreliable that I am embarrassed to build services that use their interfaces because as often as not they don't work...
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.44,1.45
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.44
    retrieving revision 1.45
    diff -u -r1.44 -r1.45
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/10 22:45:11	1.44
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 15:36:38	1.45
    @@ -12,6 +12,7 @@
     use DBI;
     use DBD::mysql;
     use GO::AppHandle;
    +use IO::String;
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    @@ -28,6 +29,46 @@
     
     use vars qw(@ISA);
     
    +##################################################
    +##################################################
    +#  ALL BROWSERS PLEASE NOTE!!
    +#  Most of the subroutines in this module use the
    +#  following basic template for service
    +#  provision.  They add a few more lines to do
    +#  error_checking and validations, but generally
    +#  speaking the few lines below are all
    +#  that a service requires :-)
    +##################################################
    +##################################################
    +
    +sub _generic_service_template {
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless ($articleType == SIMPLE){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +			# do your thing here!
    +        }
    +    }
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +##################################################
    +##################################################
    +##################################################
    +##################################################
    +
    +
     sub getGoTerm {
         my ($caller, $message) = @_;
         my $MOBY_RESPONSE;
    @@ -204,29 +245,79 @@
     #  =        namespace                            =
     #  ===============================================
     
    -sub _generic_service_template {
    +
    +sub MOBYSHoundGetGenBankff {
         my ($caller, $data) = @_;
    -    my $MOBY_RESPONSE;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
         return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
     
    -    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
     
         foreach (@inputs){
             my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
                 next;
             } else {
    -            my $namespace = getSimpleArticleNamespaceURI($input);
    -			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    -			# do your thing here!
    -        }
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetGenBankff($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					",
    +					"", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my $gb = SHoundGetGenBankff($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					",
    +					"", $qID);
    +			}
    +		}
         }
    +	$aa = SHoundFini();
    +	#print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    -sub MOBYSHoundGetGenBankff {
    +sub _makeSeqObj {
    +	my ($id) = @_;
    +	my $gb = SHoundGetGenBankff($id);
    +	return undef unless $gb;
    +	my $gbio = IO::String->new($gb);
    +	my $sio = Bio::SeqIO->new(-fh => \*$gbio, '-format' => 'genbank');
    +	my $seq = $sio->next_seq;
    +	return ($seq, $seq->length, $seq->seq);	
    +}
    +
    +sub MOBYSHoundGetGenBankVirtSequence {
         my ($caller, $data) = @_;
     	my $MOBY_RESPONSE;
     	
    @@ -254,30 +345,167 @@
     			my ($identifier) = getSimpleArticleIDs($input);
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    -				my $gb = SHoundGetGenBankff($identifier);
    +				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +												 ".($SEQ->length)."
    +												 ", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					".($SEQ->length)."
    +					",
    +					"", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("
    +					
    +						
    +					
    +					".($SEQ->length)."
    +					",
    +					"", $qID);
    +			}
    +		}
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub MOBYSHoundGetGenBankWhateverSequence {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my %objtype = ('dna', "DNASequence", 'rna', "RNASequence", 'protein', "AminoAcidSequence");
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +				my $objType = $objtype{$SEQ->alphabet};
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$identifier'>
    +												 ".($SEQ->length)."
    +												 ".($SEQ->seq)."
    +												 ", "", $qID);
    +			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +				my $gi = SHoundFindAcc($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my $objType = $objtype{$SEQ->alphabet};
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    +					
    +						
    +					
    +					 ".($SEQ->length)."
    +					 ".($SEQ->seq)."
    +					 ", "", $qID);
    +			} else {
    +				my $gi = SHoundFindName($identifier);
    +				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    +				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    +	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my $objType = $objtype{$SEQ->alphabet};
    +				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    +					
    +						
    +					
    +					 ".($SEQ->length)."
    +					 ".($SEQ->seq)."
    +					 ", "", $qID);
    +			}
    +		}
    +    }
    +	$aa = SHoundFini();
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub MOBYSHoundGetGenBankFasta {
    +    my ($caller, $data) = @_;
    +	my $MOBY_RESPONSE;
    +	
    +	my $aa = SHoundInit("TRUE", "MOBY_SHoundGetGenBankff_Service"); # initialize SeqHound
    +	$aa = SHoundIsInited(); # confirm initialization
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter) unless $aa eq "TRUE";    
    +
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +	my %validNS;
    +	foreach (qw(NCBI_Acc NCBI_gi PIR Swiss-Prot EMBL PDB)){
    +		my ($valid) = validateNamespaces($_);  # we are going to ignore anything that is invalid		
    +		$validNS{$_} = $valid;
    +	}
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && (defined($input))){  # we only accept simple inputs to this service
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;  # send back a blank response for this queryID
    +            next;
    +        } else {
    +			my $ns = getSimpleArticleNamespaceURI($input);
    +			(($MOBY_RESPONSE .= simpleResponse("", "Invalid_Namespace", $qID)) && next) unless validateThisNamespace($ns, values(%validNS));  # return blank if they have sent us a namespace we don't understand
    +			my ($identifier) = getSimpleArticleIDs($input);
    +            (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
    +			
    +			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
    +				my $gb = SHoundGetFasta($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    +				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    -				my $gb = SHoundGetGenBankff($gi);
    +				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					",
    +					",
     					"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
    -				my $gb = SHoundGetGenBankff($gi);
    +				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
    -				$MOBY_RESPONSE .= simpleResponse("
    +				$MOBY_RESPONSE .= simpleResponse("
     					
     						
     					
    -					",
    +					",
     					"", $qID);
     			}
     		}
    @@ -287,6 +515,7 @@
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    +
     sub GenbankAccVirtualSequenceRetrieve {
         my ($self, $data) = @_;
     
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 18:08:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 13:08:14 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111808.hBBI8EdB004309@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:08:14 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts
    In directory pub.open-bio.org:/tmp/cvs-serv4290
    
    Modified Files:
    	MOBY-Client05.cgi 
    Log Message:
    added Xrefs to my new services.  Small change in the client program to improve readability
    
    moby-live/Perl/scripts MOBY-Client05.cgi,1.25,1.26
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi,v
    retrieving revision 1.25
    retrieving revision 1.26
    diff -u -r1.25 -r1.26
    --- /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/11/06 16:42:41	1.25
    +++ /home/repository/moby/moby-live/Perl/scripts/MOBY-Client05.cgi	2003/12/11 18:08:14	1.26
    @@ -1,6 +1,6 @@
     #!/usr/bin/perl -w
     use strict;
    -use lib '/usr/local/apache/cgi-bin/MOBY05';
    +use lib '/usr/local/apache/cgi-bin/BIO/moby-live/Perl';
     
     use MOBY::Client::Central;
     use MOBY::Client::Service;
    @@ -466,11 +466,15 @@
                 my $output = "(";
                 foreach my $param(@{$objs}){
                     if ($param->isSimple){
    -                    $output .= "Simple:".($param->objectType)." ,";
    +                    my $type = (($param->objectType =~ /\:(\S+)$/) && $1);
    +                    $type = $param->objectType unless $type;
    +                    $output .= "Simple: $type ,";
                     } else {
                         $output .= "Collection:[";
                         foreach my $simp(@{$param->Simples}){
    -                        $output .= ($simp->objectType).",";
    +                        my $type = (($simp->objectType =~ /\:(\S+)$/) && $1);
    +                        $type = $simp->objectType unless $type;
    +                        $output .= "$type,";
                         }
                         chop $output;
                         $output .="],";
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 18:08:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 13:08:14 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111808.hBBI8EFh004328@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:08:14 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv4290/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    added Xrefs to my new services.  Small change in the client program to improve readability
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.45,1.46
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.45
    retrieving revision 1.46
    diff -u -r1.45 -r1.46
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 15:36:38	1.45
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:08:14	1.46
    @@ -9,6 +9,7 @@
     use strict;
     use SeqHound;
     use SOAP::Lite;
    +use Bio::SeqIO;
     use DBI;
     use DBD::mysql;
     use GO::AppHandle;
    @@ -317,6 +318,16 @@
     	return ($seq, $seq->length, $seq->seq);	
     }
     
    +sub _getXrefs {
    +	my ($seq) = @_;  # bioperl seq object
    +	#my $gi = $seq->primary_id;		  # e.g. 163483
    +	#print STDERR "\n\n*********************$ gi\n\n";
    +	my $acc = $seq->accession;        # e.g. A123434
    +	my $kw = $seq->species->binomial; # e.g. mus musculus
    +	my $taxon = $seq->species->ncbi_taxid;  # e.g. 1234
    +	return ($acc, $kw, $taxon);
    +}		
    +
     sub MOBYSHoundGetGenBankVirtSequence {
         my ($caller, $data) = @_;
     	my $MOBY_RESPONSE;
    @@ -346,39 +357,53 @@
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    -	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -												 ".($SEQ->length)."
    -												 ", "", $qID);
    +
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="\n".($SEQ->length)."
    +												 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -					
    -						
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
    -					".($SEQ->length)."
    -					",
    -					"", $qID);
    +					 ".($SEQ->length)."
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("
    -					
    -						
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    +				my $tempresponse = "\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
    -					".($SEQ->length)."
    -					",
    -					"", $qID);
    +					 ".($SEQ->length)."
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			}
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +#	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    @@ -413,43 +438,59 @@
                 (($MOBY_RESPONSE .= simpleResponse("", "No_Identifier_provided", $qID)) && next) unless $identifier;
     			if ($ns eq $validNS{'NCBI_gi'}){  # gi numbers are used natively by SeqHound
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$identifier'>
    -												 ".($SEQ->length)."
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="\n".($SEQ->length)."
     												 ".($SEQ->seq)."
    -												 ", "", $qID);
    +												 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    -					
    -						
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
    -					 ", "", $qID);
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			} else {
     				my $gi = SHoundFindName($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    +				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				$MOBY_RESPONSE .= simpleResponse("<$objType namespace='NCBI_gi' id='$gi'>
    -					
    -						
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				if ($taxon){ $tempresponse .="\n"}
    +				if ($kw){$tempresponse .="\n"}
    +				if ($acc){$tempresponse .="\n"}
    +				$tempresponse .="\n";
    +				$tempresponse .="
     					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
    -					 ", "", $qID);
    +					 ";
    +				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
     			}
     		}
         }
     	$aa = SHoundFini();
    -	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +#	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    @@ -516,335 +557,6 @@
     }
     
     
    -sub GenbankAccVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -
    -    my $MOBY_RESPONSE;
    -    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    -    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    -
    -    my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
    -
    -    foreach (@inputs){
    -        my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    -            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    -            next;
    -        } else {
    -			(($MOBY_RESPONSE .= simpleResponse("", "no_input_object", $qID)) && (next)) unless (defined $input);
    -			my $ns = getSimpleArticleNamespaceURI($input);
    -			(($MOBY_RESPONSE .= simpleResponse([], "Invalid_Namespace", $qID)) && (next)) unless validateThisNamespace($ns, @validNS);  # only do this if you are truly validating namespaces
    -			my ($acc) = defined(getSimpleArticleIDs($ns, [$input]))?getSimpleArticleIDs($ns,[$input]):undef;
    -            ($MOBY_RESPONSE .= collectionResponse([], "No_Accession_provided", $qID) && (next)) unless defined $acc;
    -			use Bio::DB::GenBank;
    -			my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -			my $seq = $gb->get_Seq_by_acc($acc);
    -			my $length;
    -			if ($seq){$length = $seq->length;}
    -			if ($length){
    -				$MOBY_RESPONSE .= simpleResponse("
    -			
    -				$length
    -			", "", $qID);
    -			} else {
    -				$MOBY_RESPONSE .= simpleResponse("", "sequence_has_no_length", $qID);
    -			}
    -		}
    -	}
    -    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter);    
    -}
    -
    -sub GenbankAccSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_Acc');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_acc($acc);
    -		my $length;my $sequence;
    -		if ($seq){$length = $seq->length;$sequence = $seq->seq}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -			$sequence
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -	
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse   
    -}
    -sub GenbankGIVirtualSequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_gi');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_gi($acc);
    -		my $length;
    -		if ($seq){$length = $seq->length;}
    -		if ($length){
    -			$response .= simpleResponse("
    -		
    -			$length
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -	
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse   
    -}
    -
    -sub GenbankGISequenceRetrieve {
    -    my ($self, $data) = @_;
    -    my $response; my @accessions;
    -
    -	# first, get the valid URI for the namespace that we accept
    -	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $m, $VALID_NAMESPACE) = $OS->namespaceExists(term => 'NCBI_gi');
    -	unless ($VALID_NAMESPACE){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	@accessions = getSimpleArticleIDs($VALID_NAMESPACE, \@inputs);
    -	foreach my $acc(@accessions){
    -		unless (defined $acc){
    -			$response .= simpleResponse("");
    -			next;
    -		}
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');
    -		my $seq = $gb->get_Seq_by_gi($acc);  # get the sequence object for each gi
    -		my $length;my $sequence;
    -		if ($seq){$length = $seq->length;$sequence = $seq->seq}  # if it exists, get the length and sequence
    -		if ($length){  # and construct the response
    -			$response .= simpleResponse("
    -		
    -			$length
    -			$sequence
    -		");
    -		} else {
    -			$response .= simpleResponse("");
    -		}
    -	}
    -    $response =  responseHeader() . $response . responseFooter();
    -    my $SOAPResponse = SOAP::Data->type('base64' => $response);
    -    return $SOAPResponse;
    -}
    -#=================================================
    -#=================================================
    -#=================================================
    -
    -sub GenbankCompleteSequenceRetrieve {
    -
    -# this service is registered as consuming NCBI_Acc OR NCBI_gi
    -# and producing GenericSequence objects.  However, it will
    -# actually produce DNA, RNA or PRotein objects, as appropriate
    -# and will produce a cross-reference block as well
    -
    -    my ($self, $data) = @_;
    -    my $response; my @gis;
    -
    -	my ($GB_Acc_LSID, $GB_gi_LSID) = validateNamespaces('NCBI_Acc', 'NCBI_gi');
    -	unless ($GB_Acc_LSID && $GB_gi_LSID){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc or NCBI_gi does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -	
    -	# now start analyzing the input data
    -	my @input_nodes = getInputArticles($data); # returns ([obj1, obj2], [obj3, obj4], [obj5], [obj6],...)
    -	my @inputs;
    -	foreach (@input_nodes){
    -		push @inputs, $_->[0];  # we only allow one input object per query
    -	}
    -	foreach my $node(@inputs){
    - 
    -		my $namespace_LSID = getSimpleArticleNamespaceURI($node);  # get the LSID of the namespace for this input object
    -		unless (($namespace_LSID eq $GB_Acc_LSID) || ($namespace_LSID eq $GB_gi_LSID)){ # validate the namespace
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if bad namespace
    -			next;
    -		}
    -			
    -		my ($ID)= getSimpleArticleIDs($namespace_LSID, [$node]);  # get the ID within this namespace
    -		unless (defined $ID){  # send a blank if we failed to get an id, 
    -			$response .= simpleResponse("");  # because we have to send one response per input
    -			next;
    -		}
    -
    -		use Bio::DB::GenBank;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');  # now that we have a namespace and ID, we are ready to retrieve
    -		my $seq;
    -		if ($namespace_LSID eq $GB_Acc_LSID){  # if the namespace is a genbank Accession thebn
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the accession
    -		} elsif ($namespace_LSID  eq $GB_gi_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_gi($ID);  # get the sequence object for the gi
    -		} else {
    -			$response .= simpleResponse("");  # if it is neither,then send a blank as required by the API
    -			next;
    -		}
    -			
    -		my $length;my $sequence;
    -		if ($seq){
    -			$length = $seq->length;$sequence = $seq->seq;  # if it exists, get the length and sequence
    -		} else {
    -			$response .= simpleResponse("");  # if we got nada, then send a blank as required
    -			next;
    -		}
    -
    -		my $gi = $seq->primary_id;		  # e.g. 163483
    -		my $acc = $seq->accession;        # e.g. A123434
    -		my $kw = $seq->species->binomial; # e.g. mus musculus
    -		my $moltype = $seq->alphabet;     #  'dna', 'rna', 'protein'
    -		my $taxon = $seq->species->ncbi_taxid;  # e.g. 1234
    -		
    -		my $ObjectType="GenericSequence";           # set it as the generic as default
    -		if ($moltype eq 'dna'){$ObjectType = "DNASequence"}  # set to DNA
    -		elsif ($moltype eq 'rna'){$ObjectType = "RNASequence"} # set to RNA
    -		elsif ($moltype eq 'protein'){$ObjectType = "AminoAcidSequence"}  # set to Protein
    -		
    -		if ($length){  # and construct the response; luckily, all of these objects have exactly the same structure :-)
    -			my $tempresponse .= "
    -		
    -			";
    -			if ($taxon){ $tempresponse .=""}
    -			if ($kw){$tempresponse .=""}
    -			if ($acc && !($namespace_LSID eq $GB_Acc_LSID)){$tempresponse .=""}
    -			if ($gi && !($namespace_LSID eq $GB_gi_LSID)){$tempresponse .=""}
    -			$tempresponse .="
    -			$length
    -			$sequence
    -		";
    -			$response .= simpleResponse($tempresponse);
    -		} else {
    -			$response .= simpleResponse("");  # if we failed to get a sequence length, then something weird happened, so just ignore it
    -		}
    -	}
    -    my $fullresponse =  responseHeader() . $response . responseFooter();  # add the headers and footers
    -    my $SOAPResponse = SOAP::Data->type('base64' => $fullresponse);  # base 64 encode it (optional)
    -    return $SOAPResponse;	
    -}
    -
    -
    -sub GenbankRecordRetrieve {
    -	use Bio::SeqIO;
    -	use IO::String;
    -    my ($self, $data) = @_;
    -    my $response; # prepare a variable to hold the responses
    -
    -	# Step 1 - validate the namespaces you plan to accept as input
    -	my ($GB_Acc_LSID, $GB_gi_LSID, $EMBL_LSID) = validateNamespaces('NCBI_Acc', 'NCBI_gi', 'EMBL');
    -	unless ($GB_Acc_LSID && $GB_gi_LSID && $EMBL_LSID){  # unless we could get the known namespace LSID's we should bail because somethign is very very wrong!
    -		print STDERR "the namespace NCBI_Acc, NCBI_gi, or EMBL_LSID that we are expecting does not exist in the MOBY namespace ontology\n";
    -		return SOAP::Data->type('base64' => responseHeader() . responseFooter());  # base 64 encode it (optional)
    -	}
    -
    -	# Step 2 - get your input objects
    -	# in this case, we have registered as accepting
    -	# only simple inputs (not collections), therefore
    -	# we can insist on that constraint.
    -	my @inputs = getInputArticles($data); # returns ([SimpleDOM], [SimpleDOM],...), each represents a unique query input
    -	foreach my $node(@inputs){
    -		# do a bit of simple validation
    -		# the next 12 lines or so are ~cut-n-paste for every service
    -		unless (isSimpleArticle($node)){ 		# we only allow Simple inputs to this service, ignore anything else
    -			$response .= simpleResponse("");	# because we have to send one response per input, send a blank if it fails
    -			next;
    -		}
    -		my $namespace_LSID = getSimpleArticleNamespaceURI($node);  # get the LSID of the namespace for this input object
    -		unless (($namespace_LSID eq $GB_Acc_LSID) || ($namespace_LSID eq $GB_gi_LSID) || $namespace_LSID eq $EMBL_LSID){ # validate the namespace
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if bad namespace
    -			next;
    -		}
    -		my ($ID)= getSimpleArticleIDs($namespace_LSID, [$node]);  # get the ID within this namespace
    -		unless (defined $ID){  # send a blank if we failed to get an id, 
    -			$response .= simpleResponse("");  # because we have to send one response per input, send a blank if there is no id (?!?)
    -			next;
    -		}
    -
    -		# Now, do the analysis
    -		use Bio::DB::GenBank;
    -		use Bio::DB::EMBL;
    -		my $gb = new Bio::DB::GenBank(-retrievaltype => 'io_string');  # now that we have a namespace and ID, we are ready to retrieve
    -		my $emb = new Bio::DB::EMBL(-retrievaltype => 'io_string');
    -		my $seq;
    -		if ($namespace_LSID eq $GB_Acc_LSID){  # if the namespace is a genbank Accession thebn
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the accession
    -		} elsif ($namespace_LSID  eq $GB_gi_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_gi($ID);  # get the sequence object for the gi
    -		} elsif ($namespace_LSID  eq $EMBL_LSID) { # if the namespace is a genbank gi
    -			$seq = $gb->get_Seq_by_acc($ID);  # get the sequence object for the gi
    -		} else {
    -			$response .= simpleResponse("");  # if it is neither,then send a blank as required by the API
    -			next;
    -		}
    -
    -		my $string;
    -		my $stringio = IO::String->new($string);
    -		my $out = Bio::SeqIO->new('-fh' => $stringio,
    -							   '-format' => 'genbank');
    -		# output goes into $string
    -		$out->write_seq($seq);
    -		$response .= simpleResponse(""); # append this queryResponse to the list
    -	}
    -    my $fullresponse =  responseHeader() . $response . responseFooter();  # add the headers and footers around all queryResponses
    -    my $SOAPResponse = SOAP::Data->type('base64' => $fullresponse);  # base 64 encode it (optional)
    -    return $SOAPResponse;	# and yer done!
    -}
    -
     
     #################################################
     #################################################
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 18:22:02 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 13:22:02 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312111822.hBBIM2nY004412@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 13:22:02 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv4393/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    fixed the CRIB XML tag - it is CrossReference not CrossReferences.  This also pointed me to an error in the API documentation which is also now fixed and consistent throughout
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.46,1.47
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.46
    retrieving revision 1.47
    diff -u -r1.46 -r1.47
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:08:14	1.46
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:22:02	1.47
    @@ -284,9 +284,9 @@
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			} else {
    @@ -295,9 +295,9 @@
     				my $gb = SHoundGetGenBankff($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			}
    @@ -359,12 +359,12 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($identifier);
     
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n";
    +				my $tempresponse = "\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
    -				$tempresponse .="\n".($SEQ->length)."
    +				$tempresponse .="\n".($SEQ->length)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
     			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    @@ -373,13 +373,13 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n\n";
    +				my $tempresponse = "\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
    @@ -389,13 +389,13 @@
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
    -				my $tempresponse = "\n\n";
    +				my $tempresponse = "\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse,"", $qID);
    @@ -441,12 +441,12 @@
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$identifier'>\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
    -				$tempresponse .="\n".($SEQ->length)."
    +				$tempresponse .="\n".($SEQ->length)."
     												 ".($SEQ->seq)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    @@ -457,13 +457,13 @@
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
     					 ";
    @@ -475,13 +475,13 @@
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $SEQ;
     				my ($acc, $kw, $taxon) = _getXrefs($SEQ);
     				my $objType = $objtype{$SEQ->alphabet};
    -				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
    +				my $tempresponse = "<$objType namespace='NCBI_gi' id='$gi'>\n\n";
     				if ($taxon){ $tempresponse .="\n"}
     				if ($kw){$tempresponse .="\n"}
     				if ($acc){$tempresponse .="\n"}
     				$tempresponse .="\n";
     				$tempresponse .="
    -					
    +					
     					 ".($SEQ->length)."
     					 ".($SEQ->seq)."
     					 ";
    @@ -532,9 +532,9 @@
     				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			} else {
    @@ -543,9 +543,9 @@
     				my $gb = SHoundGetFasta($gi);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("
    -					
    +					
     						
    -					
    +					
     					",
     					"", $qID);
     			}
    
    
    
    From mwilkinson at pub.open-bio.org  Thu Dec 11 22:30:53 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Thu, 11 Dec 2003 17:30:53 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312112230.hBBMUrFG005178@pub.open-bio.org>
    
    
    mwilkinson
    Thu Dec 11 17:30:53 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv5159/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    two more services dealing with taxon data
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.47,1.48
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.47
    retrieving revision 1.48
    diff -u -r1.47 -r1.48
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 18:22:02	1.47
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 22:30:53	1.48
    @@ -46,13 +46,13 @@
         my ($caller, $data) = @_;
         my $MOBY_RESPONSE;
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    -    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (scalar(@inputs));
     
         my @validNS = validateNamespaces("NCBI_Acc");  # ONLY do this if you are intending to be namespace aware!
     
         foreach (@inputs){
             my ($articleType, $qID, $input) = @{$_};
    -        unless ($articleType == SIMPLE){
    +        unless (($articleType == SIMPLE) && ($input)){
                 $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
                 next;
             } else {
    @@ -69,6 +69,97 @@
     ##################################################
     ##################################################
     
    +sub getTaxChildNodes {  # WORKS
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader("illuminae.com") . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= collectionResponse([], "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= collectionResponse([], "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $children = SHoundGetTaxChildNodes($identifier);
    +            $MOBY_RESPONSE .= collectionResponse([], "nothing_found", $qID) unless ($children);
    +			my @children = split ",", $children;
    +			my @simples;
    +			foreach my $taxon (@children){
    +				next unless $taxon;
    +				$taxon =~ s/\s//g;
    +	            push @simples, "";
    +			}
    +			$MOBY_RESPONSE .= collectionResponse(\@simples, "", $qID);
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +sub getTaxParent { # DOES NOT WORK - SHound call doesn't exist
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= simpleResponse("", "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $parent = SHoundGetTaxParent($identifier);
    +            $MOBY_RESPONSE .= simpleResponse("", "nothing_found", $qID) unless ($parent);
    +			$parent && ($MOBY_RESPONSE .= simpleResponse("", "", $qID));
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
    +
    +
    +sub getTaxNameFromTaxID{  # WORKS
    +    my ($caller, $data) = @_;
    +    my $MOBY_RESPONSE;
    +    my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    +    return SOAP::Data->type('base64' => responseHeader() . responseFooter()) unless (scalar(@inputs));
    +
    +    my ($validNS) = validateNamespaces("taxon");  # ONLY do this if you are intending to be namespace aware!
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . responseFooter)) unless $validNS;
    +
    +    foreach (@inputs){
    +        my ($articleType, $qID, $input) = @{$_};
    +        unless (($articleType == SIMPLE) && ($input) ){
    +            $MOBY_RESPONSE .= simpleResponse("", "", $qID) ;
    +            next;
    +        } else {
    +            my $namespace = getSimpleArticleNamespaceURI($input);
    +			my ($identifier) = getSimpleArticleIDs($input);  # note array output!
    +            $MOBY_RESPONSE .= simpleResponse("", "wrong_namespace", $qID) unless ($namespace eq $validNS);
    +			my $name = SHoundGetTaxNameFromTaxID($identifier);
    +            $MOBY_RESPONSE .= simpleResponse("", "nothing_found", $qID) unless ($name);
    +			$name && ($MOBY_RESPONSE .= simpleResponse("
    +													   
    +													   
    +													   $name", "", $qID));
    +        }
    +    }
    +	print STDERR responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter;
    +    return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
    +}
     
     sub getGoTerm {
         my ($caller, $message) = @_;
    
    
    
    From mwilkinson at pub.open-bio.org  Fri Dec 12 19:22:45 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri, 12 Dec 2003 14:22:45 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312121922.hBCJMikJ009022@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 12 14:22:44 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv9003/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    making GMOD moby server revealed a commonsubs error.  removed the deprecated services from my CGI client
    
    moby-live/Perl/MOBY CommonSubs.pm,1.34,1.35
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.34
    retrieving revision 1.35
    diff -u -r1.34 -r1.35
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/10 22:22:03	1.34
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/12 19:22:44	1.35
    @@ -397,7 +397,7 @@
             ";
         } elsif($data) {
             return "
    -        
    +        
                 $data
             
             ";
    
    
    
    From mwilkinson at pub.open-bio.org  Fri Dec 12 19:22:45 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri, 12 Dec 2003 14:22:45 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312121922.hBCJMjo6009041@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 12 14:22:44 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts
    In directory pub.open-bio.org:/tmp/cvs-serv9003/Perl/scripts
    
    Modified Files:
    	Services.cgi 
    Log Message:
    making GMOD moby server revealed a commonsubs error.  removed the deprecated services from my CGI client
    
    moby-live/Perl/scripts Services.cgi,1.4,1.5
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services.cgi,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -r1.4 -r1.5
    --- /home/repository/moby/moby-live/Perl/scripts/Services.cgi	2003/10/17 21:29:52	1.4
    +++ /home/repository/moby/moby-live/Perl/scripts/Services.cgi	2003/12/12 19:22:44	1.5
    @@ -2,8 +2,13 @@
     # _________________________________________________________________
     use SOAP::Transport::HTTP;
     use lib "/usr/local/apache/cgi-bin";
    +use lib "/usr/local/apache/cgi-bin/MOBY05";
    +use lib "/usr/local/apache/cgi-bin/BIO/go-dev/perl-api";
     use lib "/usr/local/apache/cgi-bin/BIO/moby-live/Perl";
    -use lib "/usr/local/apache/cgi-bin/BIO/core/Perl";
    +use lib '/usr/local/apache/cgi-bin/bioperl/core';
    +use lib '/usr/local/apache/cgi-bin/Services/';
    +use Bio::SeqIO::genbank;
    +use GO::AppHandle;
     use Services::LocalServices;
     use strict;
     
    @@ -12,13 +17,13 @@
     $x->dispatch_with({
     'http://biomoby.org/#getGoTerm' => 'Services::LocalServices',
     'http://biomoby.org/#getGoTermAssociations' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankAccVirtualSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankAccSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankGIVirtualSequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankGISequenceRetrieve' => 'Services::LocalServices',
    -'http://biomoby.org/#GenbankCompleteSequenceRetrieve' => 'Services::LocalServices',
     'http://biomoby.org/#RetrieveGOFromKeywords' => 'Services::LocalServices',
     'http://biomoby.org/#getDragonMutantImages' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankff' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankFasta' => 'Services::LocalServices',
    +'http://biomoby.org/#MOBYSHoundGetGenBankWhateverSequence' => 'Services::LocalServices',
    +'http://biomoby.org/#getTaxNameFromTaxID' => 'Services::LocalServices',
    +'http://biomoby.org/#getTaxChildNodes' => 'Services::LocalServices',
     
     });
     $x->handle;
    
    
    
    From mwilkinson at pub.open-bio.org  Tue Dec 16 20:46:40 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Tue, 16 Dec 2003 15:46:40 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312162046.hBGKke7h000685@pub.open-bio.org>
    
    
    mwilkinson
    Tue Dec 16 15:46:40 EST 2003
    Update of /home/repository/moby/moby-live/Perl/scripts/Services
    In directory pub.open-bio.org:/tmp/cvs-serv665/scripts/Services
    
    Modified Files:
    	LocalServices.pm 
    Log Message:
    corrected the SeqHound call for EMBL accession numbers  Added a new service that wraps the SeqHound SHoundGetTaxParent function to retrieve the taxonomic parents of a given taxon id.
    
    moby-live/Perl/scripts/Services LocalServices.pm,1.48,1.49
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
    retrieving revision 1.48
    retrieving revision 1.49
    diff -u -r1.48 -r1.49
    --- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/11 22:30:53	1.48
    +++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/12/16 20:46:40	1.49
    @@ -17,15 +17,31 @@
     use MIME::Base64;
     use XML::DOM;
     use MOBY::Client::OntologyServer;
    -use MOBY::CommonSubs qw(:all);  # this provides the
    -# subroutines:
    -#getSimpleArticleIDs
    -#getSimpleArticleNamespaceURI
    -#simpleResponse
    -#responseHeader
    -#responseFooter
    -#getInputArticles
    -#getNodeContentWithArticle
    +use MOBY::CommonSubs qw(:all);  # this provides the following vars and functions
    +    #getSimpleArticleIDs
    +    #getSimpleArticleNamespaceURI
    +    #simpleResponse
    +    #responseHeader
    +    #responseFooter
    +    #getInputArticles
    +    #getInputs
    +    #getInputID
    +    #getArticles
    +    #getCollectedSimples
    +    #getNodeContentWithArticle
    +    #extractRawContent
    +    #collectionResponse
    +    #validateNamespaces
    +    #validateThisNamespace
    +    #isSimpleArticle
    +    #isCollectionArticle
    +    #extractResponseArticles
    +    #getResponseArticles
    +    #getCrossReferences
    +    #genericServiceInputParser
    +    #COLLECTION
    +    #SIMPLE
    +
     my $debug = 1;
     
     use vars qw(@ISA);
    @@ -103,7 +119,7 @@
         return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));    
     }
     
    -sub getTaxParent { # DOES NOT WORK - SHound call doesn't exist
    +sub getTaxParent { # now it works.
         my ($caller, $data) = @_;
         my $MOBY_RESPONSE;
         my (@inputs)= genericServiceInputParser($data); # ([SIMPLE, $queryID, $simple],...)
    @@ -327,14 +343,6 @@
     #  ===============================================
     #  =    Genbank Retrieval Scripts                =
     #  =                                             =
    -#  = Note:  The two VirtualSequenceRetrieve's    =
    -#  =        and two SequenceRetrieves below could=
    -#  =        have been registered as two services =
    -#  =        instead of four, by simply           =
    -#  =        registering each under two different =
    -#  =        namespaces (Acc and gi) instead of   =
    -#  =        having a single service for each     =
    -#  =        namespace                            =
     #  ===============================================
     
     
    @@ -369,7 +377,7 @@
     				my $gb = SHoundGetGenBankff($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetGenBankff($gi);
    @@ -458,7 +466,7 @@
     				$tempresponse .="\n".($SEQ->length)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    @@ -541,7 +549,7 @@
     												 ".($SEQ->seq)."
     												 ";
     				$MOBY_RESPONSE .= simpleResponse($tempresponse, "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my ($SEQ, $length, $seq) = _makeSeqObj($gi);
    @@ -617,7 +625,7 @@
     				my $gb = SHoundGetFasta($identifier);
     	            (($MOBY_RESPONSE .= simpleResponse("", "No_genbank_record_found", $qID)) && next) unless $gb;
     				$MOBY_RESPONSE .= simpleResponse("", "", $qID);
    -			} elsif ($ns eq $validNS{'NCBI_Acc'}){  # THIS ONE DOESN'T WORK YET????
    +			} elsif (($ns eq $validNS{'NCBI_Acc'}) || ($ns eq $validNS{'EMBL'})){
     				my $gi = SHoundFindAcc($identifier);
     				(($MOBY_RESPONSE .= simpleResponse("", "No_gi_found_for_accession", $qID)) && next) unless $gi;
     				my $gb = SHoundGetFasta($gi);
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 17:05:03 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 12:05:03 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221705.hBMH53k3013451@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 12:05:03 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv13432/Perl/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    added some sanity checking to the authURI attribute of all register* calls.  Its still allows some insanity through, but not the most obviously sick ones
    
    moby-live/Perl/MOBY Central.pm,1.116,1.117
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.116
    retrieving revision 1.117
    diff -u -r1.116 -r1.117
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/02 01:08:24	1.116
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:05:03	1.117
    @@ -234,6 +234,8 @@
     		if ($term =~ /FAILED/){return &_error("Malformed XML;","");}
     		return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +
     	# validate that the final ontology will be valid by testing against existing relationships and such
     	while (my ($reltype, $obj) = each %{$relationships}){
     		my ($success, $message, $URI) = $RelOntologyServer->relationshipExists(term => $reltype, ontology => 'object'); # success = 1 if it does
    @@ -466,6 +468,8 @@
     		if ($term =~ /FAILED/){		return &_error("Malformed XML\n $term","");}
     		return &_error("Malformed XML\n may be missing required parameters serviceType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +
     	# validate that the final ontology will be valid
     
     	my ($exists, $exists_message, $existingURI) = $OntologyServer->serviceExists(term => $term); # success = 1 if it does
    @@ -678,6 +682,7 @@
     	unless (defined $term && defined $desc && defined $auth && defined $email){
     		return &_error("Malformed XML; may be missing required parameters namespaceType, Description, authURI or contactEmail","");
     	}
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
     
     	my ($exists, $exists_message, $URI) = $OntologyServer->namespaceExists(term => $term); # success = 1 if it does
     	(($exists==1) && return &_error("Namespace $term already exists", $URI));
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 17:21:16 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 12:21:16 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221721.hBMHLGvN013584@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 12:21:16 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv13565/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    Doh!  I broke it.  Should be fixed now
    
    moby-live/Perl/MOBY Central.pm,1.117,1.118
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.117
    retrieving revision 1.118
    diff -u -r1.117 -r1.118
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:05:03	1.117
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:21:16	1.118
    @@ -234,7 +234,7 @@
     		if ($term =~ /FAILED/){return &_error("Malformed XML;","");}
     		return &_error("Malformed XML; may be missing required parameters objectType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	# validate that the final ontology will be valid by testing against existing relationships and such
     	while (my ($reltype, $obj) = each %{$relationships}){
    @@ -468,7 +468,7 @@
     		if ($term =~ /FAILED/){		return &_error("Malformed XML\n $term","");}
     		return &_error("Malformed XML\n may be missing required parameters serviceType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	# validate that the final ontology will be valid
     
    @@ -682,7 +682,7 @@
     	unless (defined $term && defined $desc && defined $auth && defined $email){
     		return &_error("Malformed XML; may be missing required parameters namespaceType, Description, authURI or contactEmail","");
     	}
    -	return &_error("Malformed authURI - must not have an http:// prefix","") if $AuthURI =~ '[/:]';
    +	return &_error("Malformed authURI - must not have an http:// prefix","") if $auth =~ '[/:]';
     
     	my ($exists, $exists_message, $URI) = $OntologyServer->namespaceExists(term => $term); # success = 1 if it does
     	(($exists==1) && return &_error("Namespace $term already exists", $URI));
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 19:57:04 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 14:57:04 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221957.hBMJv4gk014200@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 14:57:04 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv14181/Perl/MOBY
    
    Modified Files:
    	CommonSubs.pm 
    Log Message:
    be kind, allow them to send a listref to validateThisNamespace if they do so by accident.
    
    moby-live/Perl/MOBY CommonSubs.pm,1.35,1.36
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
    retrieving revision 1.35
    retrieving revision 1.36
    diff -u -r1.35 -r1.36
    --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/12 19:22:44	1.35
    +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/22 19:57:04	1.36
    @@ -937,6 +937,8 @@
     
     sub validateThisNamespace {
         my ($ns, @namespaces) = @_;
    +    return 1 unless scalar @namespaces; # if you don't give me a list, I assume everything is valid...
    +    if (ref($namespaces[1]) =~ /ARRAY/){@namespaces = @{$namespaces[1]}}  # if you send me an arrayref I should be kind... DWIM!
         foreach (@namespaces){
             next unless $_;
             return 1 if $ns eq $_;
    
    
    
    From mwilkinson at pub.open-bio.org  Mon Dec 22 19:59:14 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Mon, 22 Dec 2003 14:59:14 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312221959.hBMJxEO6014268@pub.open-bio.org>
    
    
    mwilkinson
    Mon Dec 22 14:59:13 EST 2003
    Update of /home/repository/moby/moby-live/Perl
    In directory pub.open-bio.org:/tmp/cvs-serv14249
    
    Added Files:
    	README 
    Log Message:
    putting README back into the Perl folder
    
    moby-live/Perl README,1.2,1.3
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/README,v
    retrieving revision 1.2
    retrieving revision 1.3
    diff -u -r1.2 -r1.3
    
    
    
    From tyotirkjwegi at vilcrfnh.beautytipmakeup.info  Mon Dec 22 22:26:09 2003
    From: tyotirkjwegi at vilcrfnh.beautytipmakeup.info (Wgec Sd)
    Date: Mon, 22 Dec 2003 15:26:09 -0700
    Subject: [MOBY-guts] Headline NEWS - Face Looks 20 years Younger
    In-Reply-To: <09X6.VxKH-PDCB$KRxVxKH.xAP.X00YW5>
    References: <09X6.VxKH-PDCB$KRxVxKH.xAP.X00YW5>
    Message-ID: 
    
    An HTML attachment was scrubbed...
    URL: 
    
    From mwilkinson at pub.open-bio.org  Fri Dec 26 22:01:31 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Fri, 26 Dec 2003 17:01:31 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312262201.hBQM1VtN026461@pub.open-bio.org>
    
    
    mwilkinson
    Fri Dec 26 17:01:31 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv26442/Perl/MOBY/Client
    
    Modified Files:
    	Central.pm 
    Log Message:
    duh!  If you pass identical objects to the ISA routine, CLEARLY it should return TRUE!!
    
    moby-live/Perl/MOBY/Client Central.pm,1.64,1.65
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.64
    retrieving revision 1.65
    diff -u -r1.64 -r1.65
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/02 00:57:15	1.64
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/26 22:01:31	1.65
    @@ -1383,6 +1383,7 @@
     
     sub ISA {
     	my ($self, $class1, $class2) = @_;
    +	return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2"));
     	my $OS = MOBY::Client::OntologyServer->new;
     	my ($s, $d, $lsid1) = $OS->objectExists(term => $class1);
     	return 0 unless $s;
    
    
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 13:55:20 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat, 27 Dec 2003 08:55:20 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271355.hBRDtKVf028530@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 08:55:20 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv28511/Perl/MOBY/Client
    
    Modified Files:
    	Central.pm 
    Log Message:
    serious performance issues revealed by the new Gbrowse moby client program.  The ISA call of MOB::Clien:Central requires two CGI calls, a SOAP call, which itself results in two CGI calls, and a myriad of independent database calls to traverse the ontology.  It ended up being >1 second per call,which was unacceptable for many situations where you just need a quick answer to a 'what the heck is this' question.  Started client-side caching of the ontology and LSID terms in Client::Central to speed things up.  It is now only slow the first time, and <.05 seconds per call thereafter.  It does show how critical the need is to start storing the ontology in memory on the server side, though.
    
    moby-live/Perl/MOBY/Client Central.pm,1.65,1.66
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
    retrieving revision 1.65
    retrieving revision 1.66
    diff -u -r1.65 -r1.66
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/26 22:01:31	1.65
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2003/12/27 13:55:20	1.66
    @@ -1385,13 +1385,27 @@
     	my ($self, $class1, $class2) = @_;
     	return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2"));
     	my $OS = MOBY::Client::OntologyServer->new;
    -	my ($s, $d, $lsid1) = $OS->objectExists(term => $class1);
    -	return 0 unless $s;
    -	my ($s2, $d2, $lsid2) = $OS->objectExists(term => $class2);
    -	return 0 unless $s2;
    -	my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1);
    -	my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
    -	foreach (@$lsids){
    +	my ($lsid1, $lsid2);
    +	unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){
    +		my ($s, $d, $lsid) = $OS->objectExists(term => $class1);
    +		$self->{LSID_CACHE}->{$class1} = $lsid;
    +		$lsid1 = $lsid;
    +		return 0 unless $s;
    +	}
    +	unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){
    +		my ($s, $d, $lsid) = $OS->objectExists(term => $class2);
    +		$self->{LSID_CACHE}->{$class2} = $lsid;
    +		$lsid2 = $lsid;
    +		return 0 unless $s;
    +	}
    +	my @lsids;
    +	unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){
    +		my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']);
    +		my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'};
    +		@lsids = @$lsids;
    +	}
    +	$self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids];
    +	foreach (@lsids){
     		return 1 if $_ eq $lsid2;
     	}
     	return 0;
    
    
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 15:12:32 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat, 27 Dec 2003 10:12:32 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271512.hBRFCWeV028733@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 10:12:31 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY
    In directory pub.open-bio.org:/tmp/cvs-serv28714/Perl/MOBY
    
    Modified Files:
    	Central.pm 
    Log Message:
    Gbrowse client reveals another MOBY Central bug.  Searching for services where you provide an invalid namespace as a parameter should NOT find ALL services, it should find NO services.
    
    moby-live/Perl/MOBY Central.pm,1.118,1.119
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
    retrieving revision 1.118
    retrieving revision 1.119
    diff -u -r1.118 -r1.119
    --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/22 17:21:16	1.118
    +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/27 15:12:31	1.119
    @@ -1849,7 +1849,7 @@
     			next unless ($_->getNodeType == TEXT_NODE);
     			my $name = $_->toString; chomp $name;
     			my ($success, $message, $URI) = $OS->namespaceExists(term => $name);
    -			($URI) && push @namespaces, $URI;
    +			$URI?(push @namespaces, $URI):(push @namespaces, "__MOBY__INVALID__NAMESPACE__");
     		}
     	}
     	return ($objectURI, \@namespaces);
    
    
    
    From mwilkinson at pub.open-bio.org  Sat Dec 27 17:41:32 2003
    From: mwilkinson at pub.open-bio.org (Mark Wilkinson)
    Date: Sat, 27 Dec 2003 12:41:32 -0500
    Subject: [MOBY-guts] biomoby commit
    Message-ID: <200312271741.hBRHfWiQ029662@pub.open-bio.org>
    
    
    mwilkinson
    Sat Dec 27 12:41:32 EST 2003
    Update of /home/repository/moby/moby-live/Perl/MOBY/Client
    In directory pub.open-bio.org:/tmp/cvs-serv29639/Perl/MOBY/Client
    
    Modified Files:
    	Central.html Central.pm 
    Log Message:
    more tweaks for the Gbrowse project.  Create getter/setter methods for the LSID and ISA caches in MOBY::Client::Central so that they can be called from outside of the module itself.  This will allow us to build external tools that play with these caches.  This may not seem useful at the moment since we only have CGI based clients, so the cache is erased every time we make a call, but once we have a standalone client it will be very useful
    
    moby-live/Perl/MOBY/Client Central.html,1.13,1.14 Central.pm,1.66,1.67
    ===================================================================
    RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v
    retrieving revision 1.13
    retrieving revision 1.14
    diff -u -r1.13 -r1.14
    --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/02 00:57:15	1.13
    +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html	2003/12/27 17:41:32	1.14
    @@ -2,7 +2,7 @@
     
     
     MOBY::Client::Central - a client side wrapper for MOBY Central
    -
    +
     
     
     
    @@ -20,8 +20,8 @@
     	
     
     
    @@ -135,7 +137,7 @@
                     at all, and everything should work
     

    -

    registerObject a.k.a registerObjectClass

    +

    registerObject a.k.a registerObjectClass

      Title     :    registerObject ; registerObjectClass
      Usage     :    $REG = $MOBY->registerObject(%args)
    @@ -154,7 +156,7 @@
                             [Object1, articleName]]}

    -

    deregisterObject a.k.a. deregisterObjectClass

    +

    deregisterObject a.k.a. deregisterObjectClass

      Title     :    deregisterObject ; deregisterObjectClass
      Usage     :    $REG = $MOBY->deregisterObject(%args)
    @@ -430,6 +432,27 @@
      Function  :    DUMP the mysql for the current MOBY Central database
      Returns   :    text
      Args      :    $reg - name of MOBY Central you want to use if not default
    +

    +

    +

    LSID_CACHE

    +
    + Title     :    LSID_CACHE
    + Usage     :    $lsid = $MOBY->LSID_CACHE($term, $lsid)
    + Function  :    get/set LSID from the cache
    + Returns   :    lsid as a scalar
    + Args      :    the term for which you have/want an lsid,
    +                and optionally the lsid to set.
    +

    +

    +

    ISA_CACHE

    +
    + Title     :    ISA_CACHE
    + Usage     :    $lsid = $MOBY->ISA_CACHE($term, \@isas)
    + Function  :    get/set the ISA relationships in the cache
    + Returns   :    listref of ISA relationships.  The resulting
    +                list is IN ORDER from term to root.
    + Args      :    the term for which you have/want the ISA parentage,
    +                and optionally the parentage listref to set.
    =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 13:55:20 1.66 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 17:41:32 1.67 @@ -213,6 +213,7 @@ } } + sub new { my ($caller, %args) = @_; @@ -1342,6 +1343,7 @@ } + sub _relationshipsPayload{ my ($payload) = @_; return undef unless $payload; @@ -1388,23 +1390,23 @@ my ($lsid1, $lsid2); unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){ my ($s, $d, $lsid) = $OS->objectExists(term => $class1); - $self->{LSID_CACHE}->{$class1} = $lsid; + $self->LSID_CACHE($class1, $lsid); $lsid1 = $lsid; return 0 unless $s; } unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){ my ($s, $d, $lsid) = $OS->objectExists(term => $class2); - $self->{LSID_CACHE}->{$class2} = $lsid; + $self->LSID_CACHE($class2, $lsid); $lsid2 = $lsid; return 0 unless $s; } my @lsids; - unless ($self->{"ISA_CACHE"}->{"$lsid1"} && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ + unless ($self->ISA_CACHE($lsid1) && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']); my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'}; @lsids = @$lsids; } - $self->{"ISA_CACHE"}->{"$lsid1"} = [@lsids]; + $self->ISA_CACHE($lsid1, [@lsids]); foreach (@lsids){ return 1 if $_ eq $lsid2; } @@ -1507,6 +1509,61 @@ return \@Services; } + +=head2 LSID_CACHE + + Title : LSID_CACHE + Usage : $lsid = $MOBY->LSID_CACHE($term, $lsid) + Function : get/set LSID from the cache + Returns : lsid as a scalar + Args : the term for which you have/want an lsid, + and optionally the lsid to set. + +=cut + + +sub LSID_CACHE { + my ($self, $term, $lsid) = @_; + if ($term && $lsid){ + $self->{LSID_CACHE}->{$term} = $lsid; + return $self->{LSID_CACHE}->{$term}; + } elsif ($term){ + return $self->{LSID_CACHE}->{$term}; + } else { + return undef + } +} + + +=head2 ISA_CACHE + + Title : ISA_CACHE + Usage : $lsid = $MOBY->ISA_CACHE($term, \@isas) + Function : get/set the ISA relationships in the cache + Returns : listref of ISA relationships. The resulting + list is IN ORDER from term to root. + Args : the term for which you have/want the ISA parentage, + and optionally the parentage listref to set. + +=cut + +sub ISA_CACHE { + my ($self, $term, $isas) = @_; + return [] if $isas && !(ref($isas)=~/ARRAY/); + if ($term && $isas){ + while (scalar(@$isas)){ + $self->{ISA_CACHE}->{$term} = [@$isas]; + $term = shift(@$isas); + } + return $self->{ISA_CACHE}->{$term}; + } elsif ($term){ + return $self->{ISA_CACHE}->{$term}; + } else { + return [] + } +} + + sub parseRegXML { # # $id From mwilkinson at pub.open-bio.org Sat Dec 27 20:11:49 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat, 27 Dec 2003 15:11:49 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272011.hBRKBnPp029986@pub.open-bio.org> mwilkinson Sat Dec 27 15:11:49 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY/Client In directory pub.open-bio.org:/tmp/cvs-serv29963/Perl/MOBY/Client Modified Files: Central.pm Central.html Log Message: Gbrowse client modifications and additions. Caching is clearly an issue for speed purposes so there are some nice caching routines now in MOBY::Client::Central, as well as accessor methods to play with the cache. moby-live/Perl/MOBY/Client Central.pm,1.67,1.68 Central.html,1.14,1.15 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 17:41:32 1.67 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm 2003/12/27 20:11:48 1.68 @@ -1377,8 +1377,8 @@ Function : a pre-canned use of the Relationships function to quickly get an answer to whether class1 ISA class2 Returns : Boolean - Args : $class1 - an Object ontology term - $class2 - an Object ontology term + Args : $class1 - an Object ontology term or LSID + $class2 - an Object ontology term or LSID =cut @@ -1386,27 +1386,17 @@ sub ISA { my ($self, $class1, $class2) = @_; return 1 if (($class1 eq $class2) || ("moby:$class1" eq $class2) || ($class1 eq "moby:$class2")); - my $OS = MOBY::Client::OntologyServer->new; - my ($lsid1, $lsid2); - unless ($lsid1 = $self->{LSID_CACHE}->{$class1}){ - my ($s, $d, $lsid) = $OS->objectExists(term => $class1); - $self->LSID_CACHE($class1, $lsid); - $lsid1 = $lsid; - return 0 unless $s; - } - unless ($lsid2 = $self->{LSID_CACHE}->{$class2}){ - my ($s, $d, $lsid) = $OS->objectExists(term => $class2); - $self->LSID_CACHE($class2, $lsid); - $lsid2 = $lsid; - return 0 unless $s; - } + my $lsid1 = $self->ObjLSID($class1); + my $lsid2 = $self->ObjLSID($class2); + return 0 unless $lsid1 && $lsid2; my @lsids; - unless ($self->ISA_CACHE($lsid1) && (@lsids = @{$self->{"ISA_CACHE"}->{"$lsid1"}})){ + unless (@lsids = $self->ISA_CACHE($lsid1)){ my $resp = $self->Relationships(objectType => $lsid1, expandRelationship => 1, Relationships => ['ISA']); my $lsids = $resp->{'urn:lsid:biomoby.org:objectrelation:isa'}; @lsids = @$lsids; + $self->ISA_CACHE($lsid1, [@lsids]); + $self->ISA_CACHE($class1, [@lsids]); } - $self->ISA_CACHE($lsid1, [@lsids]); foreach (@lsids){ return 1 if $_ eq $lsid2; } @@ -1509,6 +1499,29 @@ return \@Services; } +# my ($e, $m, $lsid) = $OS->objectExists(term => $_); + +=head2 ObjLSID + +=cut + +sub ObjLSID { + my ($self, $term) = @_; + return undef unless $term; + if (my $lsid = $self->LSID_CACHE($term)){ + return $lsid; + } else { + my $os = MOBY::Client::OntologyServer->new; + my ($s, $m, $lsid) = $os->objectExists(term => $term); + if ($lsid){ + $self->LSID_CACHE($term, $lsid); # link both the term + $self->LSID_CACHE($lsid, $lsid); # and the lsid to itself + return $lsid + } else { + return undef + } + } +} =head2 LSID_CACHE @@ -1537,29 +1550,32 @@ =head2 ISA_CACHE - Title : ISA_CACHE - Usage : $lsid = $MOBY->ISA_CACHE($term, \@isas) - Function : get/set the ISA relationships in the cache - Returns : listref of ISA relationships. The resulting - list is IN ORDER from term to root. - Args : the term for which you have/want the ISA parentage, - and optionally the parentage listref to set. + Title : ISA_CACHE + Usage : @lsids = $MOBY->ISA_CACHE($lsid, \@isas) + Function : get/set the ISA relationships in the cache + Returns : list of ISA relationships. The ISA list + is IN ORDER from, excluding the term itself, to + root Object. Base Object returns an empty list. + Args : The LSID for which you have/want the ISA parentage, + and optionally the parentage listref to set. + Note : WHAT COMES BACK ARE LSIDs!!! =cut sub ISA_CACHE { - my ($self, $term, $isas) = @_; - return [] if $isas && !(ref($isas)=~/ARRAY/); + my ($self, $desiredterm, $isas) = @_; + my $term = $desiredterm; + return (undef) if $isas && !(ref($isas)=~/ARRAY/); if ($term && $isas){ - while (scalar(@$isas)){ + $self->{ISA_CACHE}->{$desiredterm} = [@$isas]; + while (my $term = shift(@$isas)){ $self->{ISA_CACHE}->{$term} = [@$isas]; - $term = shift(@$isas); } - return $self->{ISA_CACHE}->{$term}; - } elsif ($term){ - return $self->{ISA_CACHE}->{$term}; + return @{$self->{ISA_CACHE}->{$desiredterm}}; + } elsif ($term && $self->{ISA_CACHE}->{$desiredterm}){ + return @{$self->{ISA_CACHE}->{$desiredterm}}; } else { - return [] + return (); } } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/27 17:41:32 1.14 +++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.html 2003/12/27 20:11:49 1.15 @@ -41,6 +41,7 @@
  • Relationships
  • ISA
  • DUMP
  • +
  • ObjLSID
  • LSID_CACHE
  • ISA_CACHE
  • @@ -421,8 +422,8 @@ Function : a pre-canned use of the Relationships function to quickly get an answer to whether class1 ISA class2 Returns : Boolean - Args : $class1 - an Object ontology term - $class2 - an Object ontology term + Args : $class1 - an Object ontology term or LSID + $class2 - an Object ontology term or LSID

    DUMP

    @@ -434,6 +435,9 @@ Args : $reg - name of MOBY Central you want to use if not default

    +

    ObjLSID

    +

    +

    LSID_CACHE

      Title     :    LSID_CACHE
    @@ -446,13 +450,15 @@
     

    ISA_CACHE

    - Title     :    ISA_CACHE
    - Usage     :    $lsid = $MOBY->ISA_CACHE($term, \@isas)
    - Function  :    get/set the ISA relationships in the cache
    - Returns   :    listref of ISA relationships.  The resulting
    -                list is IN ORDER from term to root.
    - Args      :    the term for which you have/want the ISA parentage,
    -                and optionally the parentage listref to set.
    + Title : ISA_CACHE + Usage : @lsids = $MOBY->ISA_CACHE($lsid, \@isas) + Function : get/set the ISA relationships in the cache + Returns : list of ISA relationships. The ISA list + is IN ORDER from, excluding the term itself, to + root Object. Base Object returns an empty list. + Args : The LSID for which you have/want the ISA parentage, + and optionally the parentage listref to set. + Note : WHAT COMES BACK ARE LSIDs!!!
    From mwilkinson at pub.open-bio.org Sat Dec 27 20:15:45 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat, 27 Dec 2003 15:15:45 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272015.hBRKFjpJ030037@pub.open-bio.org> mwilkinson Sat Dec 27 15:15:45 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv30014/Perl/MOBY Modified Files: CommonSubs.pm CommonSubs.html Log Message: Gbrowse client needed a new utility routine in CommonSubs. This will take a list of 'known' Object ontology nodes and check it against the parentage of an in-hand object type, returning to you the term from your list that is DEEPEST in the ontology in the ISA parentage of your in-hand object. Why? (you might ask) Well, because when you want to assign renderers to objects you want the most complex renderer possible to deal with your in-hand object, so if you have rendrers for a variety of base object types, you want to chose the one that is best able to deal with whatever you have in-hand, thus you want the node closest to your object type moby-live/Perl/MOBY CommonSubs.pm,1.36,1.37 CommonSubs.html,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/22 19:57:04 1.36 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:15:45 1.37 @@ -175,6 +175,7 @@ getResponseArticles getCrossReferences genericServiceInputParser + whichDeepestParentObject COLLECTION SIMPLE BE_NICE @@ -202,6 +203,7 @@ getResponseArticles getCrossReferences genericServiceInputParser + whichDeepestParentObject COLLECTION SIMPLE BE_NICE @@ -1071,6 +1073,43 @@ return @XREFS; } + + +=head2 whichDeepestParentObject + + name : whichDeepestParentObject + function : select the parent node from nodeList that is + closest to the querynode + usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + args : $CENTRAL - your MOBY::Client::Central object + $queryNode - the node I am interested in + \@nodelist - the list of nodes that I know about + returns : an ontology term as a scalar, or undef if there + is no parent of this node in the nodelist + +=cut + + +sub whichDeepestParentObject { + use MOBY::Client::OntologyServer; + my ($CENTRAL, $queryTerm, $termlist) = @_; + return undef unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); + my %nodeLSIDs; + foreach (@$termlist){ # get list of known LSIDs + my $lsid = $CENTRAL->ObjLSID($_); + $nodeLSIDs{$lsid}=1; + } + my $queryLSID = $CENTRAL->ObjLSID($queryTerm); + return undef unless keys(%nodeLSIDs); + my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already + return undef unless $isa; # this should return true or we are in BIIIG trouble! + my @lsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root + while (my $thisnode = shift @lsids){ # @isas are lsid's + return $thisnode if $nodeLSIDs{$thisnode}; + } + return undef +} + sub _makeXrefType { my ($xref) = @_; my $ns = $xref->getAttributeNode('namespace'); =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/11/08 17:21:31 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:15:45 1.7 @@ -4,7 +4,7 @@ MOBY::CommonSubs.pm - a set of exportable subroutines that are useful in clients and services to deal with the input/output from MOBY Services - + @@ -41,9 +41,12 @@
  • isSimpleArticle
  • isCollectionArticle
  • getNodeContentWithArticle
  • +
  • extractRawContent
  • validateNamespaces
  • -
  • getResponseArticles (a.k.a. extractResponseArticles)
  • +
  • validateThisNamespace
  • +
  • getResponseArticles (a.k.a. extractResponseArticles)
  • getCrossReferences
  • +
  • whichDeepestParentObject
  • @@ -181,17 +184,19 @@ name : getSimpleArticleIDs function : to get the IDs of simple articles that are in the given namespace usage : my @ids = getSimpleArticleIDs("NCBI_gi", \@SimpleArticles); - args : (in order) - $Namespace - (required) a namespace stringfrom the MOBY namespace ontology + my @ids = getSimpleArticleIDs(\@SimpleArticles); + args : $Namespace - (optional) a namespace stringfrom the MOBY namespace ontology, or undef if you don't care \@Simples - (required) a listref of Simple XML::DOM nodes i.e. the XML::DOM representing an XML structure like this: <Simple> <Object namespace="NCBI_gi" id="163483"/> </Simple> - note : it will return *only* the ids that are in the given namespace - but since you are required to return an output for every input - (even if it is invalid) this routine will return undef for - those articles that are not in that namespace + note : If you provide a namespace, it will return *only* the ids that are in the given namespace, + but will return 'undef' for any articles in the WRONG namespace so that you get an + equivalent number of outputs to inputs. + + Note that if you call this with a single argument, this is assumed to + be \@Articles, so you will get ALL id's regardless of namespace!

    getSimpleArticleNamespaceURI

    @@ -417,6 +422,16 @@ }

    +

    extractRawContent

    +
    + name     : extractRawContent
    + function : pass me an article (Simple, or Collection) and I'll give you the
    +            content AS A STRING - i.e. the raw XML of the contained MOBY Object(s)
    + usage    : extractRawContent($simple)
    + input    : the one element of the output from getArticles
    + returns  : string
    +

    +

    validateNamespaces

      name     : validateNamespaces
    @@ -427,7 +442,16 @@
                 presumptive namespaces; undef for each namespace that was invalid

    -

    getResponseArticles (a.k.a. extractResponseArticles)

    +

    validateThisNamespace

    +
    + name     : validateThisNamespace
    + function : checks a given namespace against a list of valid namespaces
    + usage    : $valid = validateThisNamespace($ns, @validNS);
    + args     : ordered list of the namespace of interest and the list of valid NS's
    + returns  : boolean
    +

    +

    +

    getResponseArticles (a.k.a. extractResponseArticles)

      name     : getResponseArticles
      function : get the DOM nodes corresponding to individual
    @@ -461,6 +485,19 @@
               }
           }
        }
    +

    +

    +

    whichDeepestParentObject

    +
    + name     : whichDeepestParentObject
    + function : select the parent node from nodeList that is
    +            closest to the querynode
    + usage    : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList)
    + args     : $CENTRAL - your MOBY::Client::Central object
    +            $queryNode - the node I am interested in
    +            \@nodelist - the list of nodes that I know about
    + returns  : an ontology term as a scalar, or undef if there
    +            is no parent of this node in the nodelist
    From mwilkinson at pub.open-bio.org Sat Dec 27 20:24:52 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sat, 27 Dec 2003 15:24:52 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312272024.hBRKOqJS030126@pub.open-bio.org> mwilkinson Sat Dec 27 15:24:52 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv30103/Perl/MOBY Modified Files: CommonSubs.html CommonSubs.pm Log Message: changed my mind and decided to return both the object name as well as its LSID, since the latter is a bit arcane sometimes. moby-live/Perl/MOBY CommonSubs.html,1.7,1.8 CommonSubs.pm,1.37,1.38 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:15:45 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.html 2003/12/27 20:24:52 1.8 @@ -492,10 +492,10 @@ name : whichDeepestParentObject function : select the parent node from nodeList that is closest to the querynode - usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList) args : $CENTRAL - your MOBY::Client::Central object - $queryNode - the node I am interested in - \@nodelist - the list of nodes that I know about + $queryTerm - the object type I am interested in + \@termlist - the list of object types that I know about returns : an ontology term as a scalar, or undef if there is no parent of this node in the nodelist =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:15:45 1.37 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:24:52 1.38 @@ -1080,10 +1080,10 @@ name : whichDeepestParentObject function : select the parent node from nodeList that is closest to the querynode - usage : whichDeepestParentObject($CENTRAL, $queryNode, \@nodeList) + usage : ($term, $lsid) = whichDeepestParentObject($CENTRAL, $queryTerm, \@termList) args : $CENTRAL - your MOBY::Client::Central object - $queryNode - the node I am interested in - \@nodelist - the list of nodes that I know about + $queryTerm - the object type I am interested in + \@termlist - the list of object types that I know about returns : an ontology term as a scalar, or undef if there is no parent of this node in the nodelist @@ -1093,21 +1093,21 @@ sub whichDeepestParentObject { use MOBY::Client::OntologyServer; my ($CENTRAL, $queryTerm, $termlist) = @_; - return undef unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); + return (undef,undef) unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); my %nodeLSIDs; foreach (@$termlist){ # get list of known LSIDs my $lsid = $CENTRAL->ObjLSID($_); - $nodeLSIDs{$lsid}=1; + $nodeLSIDs{$lsid}=$_; } my $queryLSID = $CENTRAL->ObjLSID($queryTerm); - return undef unless keys(%nodeLSIDs); + return (undef, undef) unless keys(%nodeLSIDs); my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already - return undef unless $isa; # this should return true or we are in BIIIG trouble! - my @lsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root - while (my $thisnode = shift @lsids){ # @isas are lsid's - return $thisnode if $nodeLSIDs{$thisnode}; + return (undef, undef) unless $isa; # this should return true or we are in BIIIG trouble! + my @ISAlsids = $CENTRAL->ISA_CACHE($queryTerm); # returns **LSIDs** in order, so we can shift our way back to root + while (my $thislsid = shift @ISAlsids){ # @isas are lsid's + return ($nodeLSIDs{$thislsid},$thislsid) if $nodeLSIDs{$thislsid}; } - return undef + return (undef, undef); } sub _makeXrefType { From mwilkinson at pub.open-bio.org Sun Dec 28 20:41:59 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sun, 28 Dec 2003 15:41:59 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312282041.hBSKfx4X009349@pub.open-bio.org> mwilkinson Sun Dec 28 15:41:59 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv9318/MOBY Modified Files: Central.pm CommonSubs.pm OntologyServer.pm simple_input.pm Log Message: making MOBY Central case-sensitive for LSIDs. I might have missed a few places. please let me know if you find any. moby-live/Perl/MOBY Central.pm,1.119,1.120 CommonSubs.pm,1.38,1.39 OntologyServer.pm,1.30,1.31 simple_input.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/27 15:12:31 1.119 +++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/12/28 20:41:59 1.120 @@ -758,7 +758,7 @@ my $dbh = MOBY::central_db_connection->new->dbh; - my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where namespace_type_uris like '%$existingURI%'"); + my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where INSTR(namespace_type_uris,'$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -768,7 +768,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where INSTR(namespace_type_uris,'$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -778,7 +778,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where INSTR(namespace_type_uris, '$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -788,7 +788,7 @@ } } - $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where namespace_type_uris like '%$existingURI%'"); + $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where INSTR(namespace_type_uris, '$existingURI')"); $sth->execute; while (my ($id, $ns) = $sth->fetchrow_array()){ my @nss = split ",", $ns; @@ -1699,7 +1699,7 @@ my $nsquery; foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's - $nsquery .=" OR namespace_type_uris like '%$ns%' "; + $nsquery .=" OR INSTR(namespace_type_uris, '$ns') "; } if ($nsquery){ $nsquery =~ s/OR//; # just the first @@ -1754,7 +1754,7 @@ my $nsquery; foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's - $nsquery .=" OR namespace_type_uris like '%$ns%' "; + $nsquery .=" OR INSTR(namespace_type_uris, '$ns') "; } if ($nsquery){ $nsquery =~ s/^\sOR//; # just the first =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/27 20:24:52 1.38 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/28 20:41:59 1.39 @@ -1074,7 +1074,6 @@ } - =head2 whichDeepestParentObject name : whichDeepestParentObject @@ -1084,8 +1083,12 @@ args : $CENTRAL - your MOBY::Client::Central object $queryTerm - the object type I am interested in \@termlist - the list of object types that I know about - returns : an ontology term as a scalar, or undef if there - is no parent of this node in the nodelist + returns : an ontology term and LSID as a scalar, or undef if there + is no parent of this node in the nodelist. + (note that it will only return the term if you give it + term names in the @termList. If you give it + LSID's in the termList, then both the parameters + returned will be LSID's - it doesn't back-translate...) =cut =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/02 00:23:23 1.30 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/28 20:41:59 1.31 @@ -179,7 +179,7 @@ } if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_lsid = ?"); + $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where INSTR(object_lsid, ?)"); } else { $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_type = ?"); } @@ -326,7 +326,7 @@ return (0, "requires both term and ontology arguments\n",'') unless (defined($term) && defined($ont)); my $sth; if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_lsid = ? and ontology=?"); + $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where INSTR(relationship_lsid,?) and ontology=?"); } else { $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_type = ? and ontology=?"); } @@ -433,7 +433,7 @@ my $sth; if ($term =~ /^urn\:lsid/){ - $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_lsid = ?"); + $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where INSTR(service_lsid, ?)"); } else { $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_type = ?"); } @@ -545,7 +545,7 @@ } if ($term =~ /^urn:lsid:biomoby.org:namespacetype/){ - $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_lsid = ?"); + $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where INSTR(namespace_lsid, ?)"); } else { $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_type = ?"); } @@ -691,7 +691,7 @@ sub getObjectCommonName { my ($self, $URI) = @_; return undef unless $URI =~ /urn\:lsid/; - my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_id = ?}, undef, $URI); + my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_lsid = ?}, undef, $URI); return $name?$name:$URI; } @@ -702,7 +702,7 @@ sub getNamespaceCommonName { my ($self, $URI) = @_; return undef unless $URI =~ /urn\:lsid/; - my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_id = ?}, undef, $URI); + my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_lsid = ?}, undef, $URI); return $name?$name:$URI; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm 2003/05/07 19:20:27 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm 2003/12/28 20:41:59 1.2 @@ -14,7 +14,7 @@ =head1 SYNOPSIS - use MOBY::authority; + use MOBY::simple_input; my $Instance = MOBY::simple_input->new( object_type => "Sequence", namespaces => ["genbank/gi", "genbank/Acc"], From mwilkinson at pub.open-bio.org Mon Dec 29 02:43:43 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Sun, 28 Dec 2003 21:43:43 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312290243.hBT2hhlC010292@pub.open-bio.org> mwilkinson Sun Dec 28 21:43:43 EST 2003 Update of /home/repository/moby/moby-live In directory pub.open-bio.org:/tmp/cvs-serv10273 Modified Files: README Log Message: just testing the new cron on biomoby.org moby-live README,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/README,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/README 2003/02/19 21:12:16 1.3 +++ /home/repository/moby/moby-live/README 2003/12/29 02:43:43 1.4 @@ -1,3 +1,4 @@ +test README # # Revision History From mwilkinson at pub.open-bio.org Tue Dec 30 20:03:54 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue, 30 Dec 2003 15:03:54 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312302003.hBUK3sN1016258@pub.open-bio.org> mwilkinson Tue Dec 30 15:03:54 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16239/Perl/MOBY Modified Files: OntologyServer.pm Log Message: changing the case of the LSID's buggered up the Relationships call of the OntologyServer. I noticed this when the Gbrowse MOBY browser stopped working. moby-live/Perl/MOBY OntologyServer.pm,1.31,1.32 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/28 20:41:59 1.31 +++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm 2003/12/30 20:03:54 1.32 @@ -801,13 +801,13 @@ $term = $self->getObjectURI($term); } my %results; - while (($term ne 'urn:lsid:biomoby.org:objectclass:object') && ($term ne 'urn:lsid:biomoby.org:servicetype:service')){ + while (($term ne 'urn:lsid:biomoby.org:objectclass:Object') && ($term ne 'urn:lsid:biomoby.org:servicetype:Service')){ my $defs = $self->_doRelationshipsQuery($ontology, $term, $relationship, $direction); my $lsid; my $rel; foreach (@{$defs}){ $lsid = $_->[0]; $rel = $_->[1]; - $debug && _LOG("\t\tADDING RELATIONSHIP $_ : $lsid to $rel\n"); + $debug && _LOG("\t\tADDING RELATIONSHIP $_ : $lsid to $rel\n"); push @{$results{$rel}}, $lsid; } last unless ($expand); From mwilkinson at pub.open-bio.org Tue Dec 30 20:21:31 2003 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Tue, 30 Dec 2003 15:21:31 -0500 Subject: [MOBY-guts] biomoby commit Message-ID: <200312302021.hBUKLVww016376@pub.open-bio.org> mwilkinson Tue Dec 30 15:21:31 EST 2003 Update of /home/repository/moby/moby-live/Perl/MOBY In directory pub.open-bio.org:/tmp/cvs-serv16357/Perl/MOBY Modified Files: CommonSubs.pm Log Message: whichDeepestParentObject should return right away if it finds an object in the list you provided it. Before this would actualy return Object if you gave it the exact object type as part of the search moby-live/Perl/MOBY CommonSubs.pm,1.39,1.40 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/28 20:41:59 1.39 +++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm 2003/12/30 20:21:30 1.40 @@ -1098,11 +1098,12 @@ my ($CENTRAL, $queryTerm, $termlist) = @_; return (undef,undef) unless ($CENTRAL && $queryTerm && $termlist && (ref($termlist) =~ /ARRAY/)); my %nodeLSIDs; + my $queryLSID = $CENTRAL->ObjLSID($queryTerm); foreach (@$termlist){ # get list of known LSIDs my $lsid = $CENTRAL->ObjLSID($_); - $nodeLSIDs{$lsid}=$_; + return ($_, $lsid) if ($lsid eq $queryLSID); # of course, if we find it in the list, then return it right away! + $nodeLSIDs{$lsid}=$_; } - my $queryLSID = $CENTRAL->ObjLSID($queryTerm); return (undef, undef) unless keys(%nodeLSIDs); my $isa = $CENTRAL->ISA($queryTerm, 'Object'); # set the complete parentage in the cache if it isn't already return (undef, undef) unless $isa; # this should return true or we are in BIIIG trouble!