[MOBY-guts] biomoby commit
Dirk Haase
d.haase at dev.open-bio.org
Tue Jan 30 14:57:47 UTC 2007
d.haase
Tue Jan 30 09:57:47 EST 2007
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby
In directory dev.open-bio.org:/tmp/cvs-serv2011
Modified Files:
queryapi.pm
Log Message:
Added interfaces for new methods 'get_all_relationships' and 'get_details_for_id_list'
moby-live/Perl/MOBY/Adaptor/moby queryapi.pm,1.31,1.32
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2005/11/20 15:45:35 1.31
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi.pm 2007/01/30 14:57:47 1.32
@@ -1308,11 +1308,75 @@
die "get_relationship not implemented in adaptor\n";
}
+=head2 get_all_relationships
+
+ Title : get_all_relationships
+ Usage : my $un = $API->get_all_relationships(%args)
+ Function : Execute a query for all relationships represented in $ontology_term2term
+ Args : direction => String - direction in the ontology (either 'root' or 'leaves')
+ ontology => String - name of the table ontology
+ Returns : reference to hash with the following structure:
+ $resultHash->{String relationship_type}->{Integer key_entity_id} = <VALUE>
+ The structure of <VALUE> depends on relationship_type and direction:
+ HAS/HASA :
+ <VALUE> = @([Integer value_entity_id, String articleName, Integer assertion_id])
+ ISA, leaves :
+ <VALUE> = @(Integer value_entity_id)
+ ISA, root :
+ <VALUE> = Integer value_entity_id
+ Notes : The hash is built 'direction-aware', that is for
+ - root : key_entity_id = ${ontology}1_id, value_entity_id = ${ontology}2_id
+ - leaves: key_entity_id = ${ontology}2_id, value_entity_id = ${ontology}1_id
+ The structure of the result hash is a bit complex because it is specifically
+ designed for usage by MOBY::OntolgyServer::Relationships
+ The result hash contains the entire table ${ontology}_term2term in order to
+ reduce DB interaction in the ontology exploration
+
+=cut
+
+# Get all relationships in the queried database in one go. The
+# complete table ${ontology}_term2term is transferred into a hash
+# whose reference is finally returned. Important: note that the hash
+# is built 'direction aware', that is for objects 'object1_id' is used
+# as key when direction is 'root' and 'object2_id' as value. Vice
+# versa for the 'leaves' direction. Likewise for services.
+# Returns a hash reference.
+sub get_all_relationships{
+ die "get_all_relationships not implemented in adaptor\n";
+}
+
+=head2 get_deails_for_id_list
+
+ Title : get_deails_for_id_list
+ Usage : my $un = $API->get_all_relationships($ontology, $field_list, $id_list)
+ Function : Retrieve details specified in @$field_list from $ontology for ids in @$id_list
+ Args : $ontology => String - name of the table ontology
+ $field_list => Reference to array of Strings representing table fields in $ontology
+ $id_list => Reference to array of Integers representing ${ontology}_ids
+ Returns : reference to hash with the following structure:
+ $resultHash->{Integer ${ontology}_id}->{String field_name} = field_value
+ Notes : This function is generic with respect to which details (fields) are retrieved, but
+ is restricted to those tables whose name is identical to the ontology name (i.e.
+ currently 'object', 'service', 'namespace' and 'relationship')
+ Makes use of the 'select ... from ... where ... in (<LIST>)' statement syntax
+ in order to reduce the number of DB interactions
+ Used in MOBY::OntologyServer::Relationships, but maybe useful for other purposes...
+
+=cut
+
+# retrieve details for a number of entities from table $ontology
+# represented by a list of ${ontology}_id's;
+# used in MOBY::OntologyServer::Relationships
+sub get_details_for_id_list {
+ die "get_details_for_id_list not implemented in adaptor\n";
+}
+
+
# Not quite sure what this does...
sub _checkURI {
die "_checkURI not implemented in adaptor\n";
}
-
+
sub _dump {
my ($self) = @_;
foreach my $attrname ( $self->_standard_keys ) {
More information about the MOBY-guts
mailing list