[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Tue Aug 30 15:03:28 UTC 2005


mwilkinson
Tue Aug 30 11:03:28 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv22526/MOBY

Modified Files:
	Central.pm 
Log Message:
ensure that only ISA relationships are traversed by the Relationships routine for the moment and see if it breaks anything; the behaviour of traversing any other relationship is currently undefined, so the routine shouldn't be used for anything else, though that doesn't mean that it isn't :-)

moby-live/Perl/MOBY Central.pm,1.209,1.210
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -r1.209 -r1.210
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2005/08/30 14:52:15	1.209
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2005/08/30 15:03:28	1.210
@@ -2861,7 +2861,10 @@
  Args      :	Input XML (see below).  relationshipTypes are optional.
                 If included, it will limit the response to only those
                 relationship types, otherwise you get all by default.
+		
                 NOTE:  the expandRelationships flag in the official API is not yet implemented.
+		NOTE:  THIS CURRENTLY ONLY FUNCTIONS PROPERLY FOR ISA RELATIONSHIPS since the
+		expected behaviour with HAS and HASA relationships isn't yet defined.
 
  input XML :
 	<Relationships>
@@ -2912,7 +2915,7 @@
 	my $ontology;
 	my $Parser              = XML::LibXML->new();
 	my $doc                 = $Parser->parse_string($payload);
-	my $x                   = $doc->getElementsByTagName("relationshipType");
+	my $x                   = $doc->getElementsByTagName("relationshipType");  # this is ignored - it is always ISA
 	my $l                   = $x->size();
 	my $exp                 = $doc->getElementsByTagName("expandRelationship");
 	my $expl                = $exp->size();
@@ -2920,6 +2923,7 @@
 	$expand_relationship =~ s/\s//g;
 	$expand_relationship ||= 0;
 	my %reltypes;
+	my $relationship;
 
 	for ( my $n = 1 ; $n <= $l ; ++$n ) {
 		my @child = $x->get_node($n)->childNodes;
@@ -2928,6 +2932,7 @@
 			my $name .= $_->toString;
 			$name =~ s/\s//g;
 			$reltypes{$name} = 1;
+			$relationship = $name;   # THIS WILL ALWYAS BE ISA
 		}
 	}
 	my $term = &_nodeTextContent( $doc, "objectType" );
@@ -2939,15 +2944,19 @@
 	$ontology ||= "service"; # if we have now succeeded and haven't already taken the ontology then it must be the service ontology
 	$debug && &_LOG("Ontology was $ontology; Term was $term\n");
 	my $OS = MOBY::OntologyServer->new( ontology => $ontology );
+
+# WE WOULD PREFER TO LOOP OVER EACH KEY IN %RELTYPE HERE, BUT HARD CODED TO JUST ISA
+
 	my %rels = %{ $OS->Relationships(
 					 term => $term,
 					 expand => $expand_relationship,
-					 relationship => 'urn:lsid:biomoby.org:objectrelation:isa',
+					 relationship => $relationship,  # ISA always
 					 direction => 'root'
 					 )};    # %rels = $rels{relationship} = [lsid, lsid,lsid]
 	my $response = "<Relationships>\n";
 	my $OSrel    = MOBY::OntologyServer->new( ontology => 'relationship' );
 
+# this routine is kinda stupid now...
 	foreach ( keys %reltypes ) {    # for each of our desired types
 		my $rellsid = $OSrel->getRelationshipURI( $ontology, $_ );    # get the LSID
 		delete $reltypes{$_};    # remove the non-LSID version from the hash
@@ -2964,7 +2973,10 @@
 		next unless $rels{$rellsid};
 		my @lsids_articles = @{$rels{$rellsid}};
 		next unless scalar @lsids_articles;
-		$response .= "<Relationship relationshipType='$_' lsid='$rellsid'>\n";
+
+#  THE ISA RELATIONSHIP IS NOW HARD!
+
+		$response .= "<Relationship relationshipType='$relationship' lsid='$rellsid'>\n";
 		foreach my $lsid_article ( @lsids_articles ) {
 			my ($lsid, $articleName) = @$lsid_article;
 			# ugh... I have to cheat here because the term is not returned from the Ontology Server




More information about the MOBY-guts mailing list