[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Fri May 9 13:42:24 UTC 2003


mwilkinson
Fri May  9 09:42:24 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv7423/Perl/MOBY

Modified Files:
	Central.pm OntologyServer.pm 
Log Message:
retrieveRelationshipTypes added to mobycentral
moby-live/Perl/MOBY Central.pm,1.52,1.53 OntologyServer.pm,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/05/09 13:26:15	1.52
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/05/09 13:42:24	1.53
@@ -2618,6 +2618,44 @@
 }
 
 
+
+=head2 retrieveRelationshipTypes
+
+ Title     :	retrieveRelationshipTypes
+ Usage     :	$types = $MOBY->retrieveRelationshipTypes()
+ Function  :	get the list of all registered relationship types in the ontology
+ Returns   :	XML (see below)
+ Args      :	none
+ XML       :
+	<relationshipTypes>
+	   <relationshipType relationship="ontologyterm" authority="biomoby.org">
+		  <Description><![CDATA[free text description here]]></Description>
+	   </relationshipType>
+		...
+		...
+	</relationshipTypes>
+
+=cut
+
+
+
+sub retrieveRelationshipTypes {
+	my ($pkg) = @_;
+	my $OS = MOBY::OntologyServer->new(ontology => 'relationship');
+	my %types = %{$OS->getRelationshipTypes()};
+	my $types = "<relationshipTypes>\n";
+	while (my ($serv, $authdesc) = each %types){
+		my $auth = $authdesc->[0];
+		my $desc = $authdesc->[1];
+		$types .= "<relationshipType relationship='$name' authority='$auth'>\n<Description><![CDATA[$desc]]></Description>\n</relationshipType>\n";
+	}
+	$types .= "</relationshipTypes>\n";
+    return $types;	
+}
+
+
+
+
 =head2 retrieveObjectNames
 
  Title     :	retrieveObjectNames

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/05/09 13:06:24	1.5
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/05/09 13:42:24	1.6
@@ -453,10 +453,10 @@
 sub getRelationshipTypes {
     my ($self, %args) = @_;
     my $ontology = $args{'ontology'};
-    my $ids = $self->dbh->selectall_arrayref(q{select relationship_type, description from relationship where ontology = ?}, undef, $ontology);
+    my $defs = $self->dbh->selectall_arrayref(q{select relationship_type, authority, description from relationship where ontology = ?}, undef, $ontology);
     my %result;
-    foreach (@{$ids}){
-        $result{$_->[0]} = $_->[1];    
+    foreach (@{$defs}){
+        $result{$_->[0]} = [$_->[1], $_->[2]];    
     }
     return \%result;
 }




More information about the MOBY-guts mailing list