[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Tue Dec 2 00:23:23 UTC 2003


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 @@
 </li>
 <li><strong><a name="item_only_input_secondary_articles_are_defined_during_r">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.</a></strong><br />
 </li>
+<li><strong><a name="item_service_categories%3a">Service Categories:</a></strong><br />
+</li>
+<ul>
+<li><strong><a name="item_structure">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).</a></strong><br />
+</li>
+<li><strong><a name="item_soap_%2d_for_other_soap_services_that_do_not_use_t">soap - for other SOAP services that do not use the MOBY messaging format. The other elements in the registration should be interpreted as follows:</a></strong><br />
+</li>
+<ul>
+<li><strong><a name="item_organization">authURI - a URI representing your organization (e.g. yourdomain.com); no http-prefix, and no trailing path information is allowed.</a></strong><br />
+</li>
+<li><strong><a name="item_servicename_%2d_an_arbitrary%2c_but_unique%2c_name">serviceName - an arbitrary, but unique, name for your service within your authURI namespace</a></strong><br />
+</li>
+<li><strong><a name="item_url_%2d_the_url_from_which_a_wsdl_document_describ">URL - the URL from which a WSDL document describing your service can be retrieved by an HTTP GET call.</a></strong><br />
+</li>
+<li><strong><a name="item_comments_about_input_and_output%3a">Comments about Input and Output:</a></strong><br />
+</li>
+<ul>
+<li><strong><a name="item_in_%22moby%22_services%2c_the_input_and_output_mes">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.</a></strong><br />
+</li>
+<li><strong><a name="item_for_%22soap%22_services%2c_there_is_additional_fle">For ``soap'' services, there is additional flexibility:</a></strong><br />
+</li>
+<ul>
+<li><strong><a name="item_similar_to_a_%22moby%22_service%2c_your_%22soap%22">Similar to a ``moby'' service, your ``soap'' service must consume/produce named data types.  These are represented as LSID's</a></strong><br />
+</li>
+<li><strong><a name="item_you_do_not_need_to_register_these_data_types_in_mo">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!</a></strong><br />
+</li>
+<li><strong><a name="item_or">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</a></strong><br />
+</li>
+<ul>
+<li><strong><a name="item_you_may_register%2c_for_example%2c_a_service_that_">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</a></strong><br />
+</li>
+<li><strong>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</strong><br />
+</li>
+<li><strong><a name="item_note%3a_nether_of_the_cases_above_are_considered_m">NOTE: Nether of the cases above are considered MOBY services, and are therefore described in the category of ``soap'' service</a></strong><br />
+</li>
+</ul>
+</ul>
+<li><strong><a name="item_secondaryarticles_%2d_not_applicable%3b_should_be_">secondaryArticles  - not applicable; should be left out of message.</a></strong><br />
+</li>
+</ul>
+</ul>
+</ul>
 </ul>
 <pre>
  Input XML :</pre>
 <pre>
       &lt;registerService&gt;
-         &lt;Category&gt;moby&lt;/Category&gt; &lt;!-- one of 'moby', 'cgi', 'soap' ; currently only 'moby' services are fully supported --&gt;
+         &lt;Category&gt;moby&lt;/Category&gt; &lt;!-- one of 'moby', 'cgi', 'wsdl' ; currently only 'moby' and 'wsdl' services are fully supported --&gt;
          &lt;serviceName&gt;YourServiceNameHere&lt;/serviceName&gt;
          &lt;serviceType&gt;TypeOntologyTerm&lt;/serviceType&gt;
          &lt;authURI&gt;your.URI.here&lt;/authURI&gt;

===================================================================
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?




More information about the MOBY-guts mailing list