[MOBY-guts] biomoby commit
Dirk Haase
d.haase at dev.open-bio.org
Tue Jan 30 14:34:18 UTC 2007
d.haase
Tue Jan 30 09:34:17 EST 2007
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory dev.open-bio.org:/tmp/cvs-serv1599
Modified Files:
Central.pm
Log Message:
Changed Relationships such that it can process both directions ('root' and 'leaves'). 'leaves' direction was not possible yet.
moby-live/Perl/MOBY Central.pm,1.275,1.276
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -r1.275 -r1.276
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 00:42:45 1.275
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2007/01/30 14:34:17 1.276
@@ -2928,14 +2928,22 @@
Returns : output XML (see below)
Args : Input XML (see below).
Notes : expandRelationships behaviour
- - for ISA relationships means traverse to root
- - for HAS and HASA means traverse ISA to root and
- grab all HAS or HASA's along the way
+ - for ISA relationships means traverse to root/leaves
+ - for HAS and HASA means traverse ISA to root/leaves and
+ for each node in the ISA hierarchy return the HAS/HASA
+ relationship partners, where 'root' matches container objects
+ and 'leaves' matches contained objects.
+ Example: suppose a relationship "objA HAS objB",
+ a) if query is objectType=>objA, direction=>'root', relationship=>'HAS',
+ then objB is in result set
+ b) if query is objectType=>objB, direction=>'leaves', relationship=>'HAS',
+ then objA is in result set
input XML :
<Relationships>
<objectType>$term</objectType>
<expandRelationship>1|0</expandRelationship>
+ <direction>root|leaves</direction>
<relationshipType>$relationship_term</relationshipType>
... more relationship types
...
@@ -2944,6 +2952,7 @@
<Relationships>
<serviceType>$term</serviceType>
<expandRelationship>1|0</expandRelationship>
+ <direction>root|leaves</direction>
<relationshipType>$relationship_term</relationshipType>
... more relationship types
...
@@ -2988,9 +2997,20 @@
my $expand_relationship = &_nodeTextContent( $doc, 'expandRelationship' );
$expand_relationship =~ s/\s//g;
$expand_relationship ||= 0;
+
+
+ # find out direction:
+ my $direction = &_nodeTextContent( $doc, "direction" );
+ $direction = 'root' unless $direction; # make root default to stay compatible
+ # it has to be either 'leaves' or 'root'
+ $direction = ($direction eq 'leaves') ? 'leaves' : 'root';
+
+
my %reltypes;
my $relationship;
+
+
for ( my $n = 1 ; $n <= $l ; ++$n ) {
my @child = $x->get_node($n)->childNodes;
foreach (@child) {
@@ -3027,7 +3047,7 @@
term => $term,
expand => $expand_relationship,
relationship => $relationship,
- direction => 'root'
+ direction => $direction,
)}); # %relationships_found = $rels{relationship_lsid} = [lsid, lsid,lsid]
}
More information about the MOBY-guts
mailing list