[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Tue Apr 20 18:49:45 UTC 2004


mwilkinson
Tue Apr 20 14:49:45 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv14302

Modified Files:
	OntologyServer.pm 
Log Message:
moving toward LSID compabitibility for the ontology server.

moby-live/Perl/MOBY OntologyServer.pm,1.33,1.34
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2004/02/18 22:23:55	1.33
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2004/04/20 18:49:45	1.34
@@ -164,6 +164,10 @@
 
 =head2 objectExists
 
+ moby:newterm will return (0, $message, $MOBYLSID)
+ newterm will return (0, $message, $MOBYLSID
+ oldterm will return (1, $message, undef)
+ newLSID will return (0, $desc, $lsid)
 =cut
 
 
@@ -174,9 +178,9 @@
     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/ && !($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 = ?");
@@ -184,14 +188,31 @@
         $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_type = ?");
     }
     $sth->execute($term);
-    my ($id, $type, $desc, $auth, $email) = $sth->fetchrow_array;
-    if ($id){
-        return (1,$desc,$id);
-    } else {
-        return (0, "Object Type $term does not exist in the biomoby.org Object Class system\n",'');
-    }
+    my ($lsid, $type, $desc, $auth, $email) = $sth->fetchrow_array;
+    if ($lsid){  # if it is in there, then it has been discovered regardless of being foreign or not
+        return (1,$desc,$lsid);
+    } elsif (_isForeignLSID($term)){  # if not in our ontology, but is a foreign LSID, then pass it back verbatim
+        return (0, "LSID $term does not exist in the biomoby.org Object Class system\n", $term);
+	} else { # under all other circumstances (i.e. not a term, or a non-existent biomoby LSID) then fail
+		return (0, "Object type $term does not exist in the biomoby.org Object Class system\n", '');
+	}
 }
 
+
+sub _isMOBYLSID {
+	my ($lsid) = @_;
+	return 1 if $lsid =~ /^urn\:lsid\:biomoby.org/;
+	return 0
+}
+
+
+sub _isForeignLSID {
+	my ($lsid) = @_;
+	return 0 if $lsid =~ /^urn\:lsid\:biomoby.org/;
+	return 1
+}
+
+
 =head2 createObject
 
 =cut




More information about the MOBY-guts mailing list