[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Fri May 9 14:36:41 UTC 2003
mwilkinson
Fri May 9 10:36:41 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv8331/Perl/MOBY
Modified Files:
Central.pm
Log Message:
retrieve relationship types
moby-live/Perl/MOBY Central.pm,1.63,1.64
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/05/09 14:27:13 1.63
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/05/09 14:36:40 1.64
@@ -2629,11 +2629,13 @@
=head2 retrieveRelationshipTypes
Title : retrieveRelationshipTypes
- Usage : $types = $MOBY->retrieveRelationshipTypes()
- Function : get the list of all registered relationship types in the ontology
+ Usage : $types = $MOBY->retrieveRelationshipTypes($xml)
+ Function : get the list of all registered relationship types in the given ontology
Returns : XML (see below)
- Args : none
- XML :
+ Args : input XML (ontologies are 'object', 'service', 'namespace', 'relationship')
+
+ Input XML : <Ontology>OntologyName</Ontology>
+ Output XML:
<relationshipTypes>
<relationshipType relationship="ontologyterm" authority="biomoby.org">
<Description><![CDATA[free text description here]]></Description>
@@ -2647,9 +2649,23 @@
sub retrieveRelationshipTypes {
- my ($pkg) = @_;
+ my ($pkg, $payload) = @_;
+ my $Parser = new XML::DOM::Parser;
+ my $doc = $Parser->parse($payload);
+ my $DOM = $doc->getDocumentElement();
+
+ my $x = $DOM->getElementsByTagName("Ontology");
+ my $ontology; my @child;
+ if ($x->item(0)){@child = $x->item(0)->getChildNodes;}
+ foreach (@child){
+ $debug && &_LOG ($_->getNodeTypeName, "\t", $_->toString,"\n");
+ next unless ($_->getNodeType == TEXT_NODE);
+ my $name = $_->toString; chomp $name;
+ $ontology = $name;
+ }
+
my $OS = MOBY::OntologyServer->new(ontology => 'relationship');
- my %types = %{$OS->getRelationshipTypes()};
+ my %types = %{$OS->getRelationshipTypes(ontology => $ontology)};
my $types = "<relationshipTypes>\n";
while (my ($name, $authdesc) = each %types){
my $auth = $authdesc->[0];
More information about the MOBY-guts
mailing list