[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Wed Aug 17 19:30:19 UTC 2005


mwilkinson
Wed Aug 17 15:30:19 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv13880/MOBY/Adaptor/moby/queryapi

Modified Files:
	mysql.pm 
Log Message:
this code attempts to traverse a newly created object to ensure that no articleNames appear at the same level of XML in the final object.  It is curently untested so caveat emptor

moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.69,1.70
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/29 19:33:41	1.69
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/08/17 19:30:18	1.70
@@ -1322,6 +1322,11 @@
 	my $ontology = $args{'ontology'};
 	my $relationship = $args{'relationship'};
 
+	if ($relationship){ # need it as an lsid
+	    my $result = $self->query_relationship(type => $relationship, ontology => $ontology);
+	    my $row = shift @$result;
+	    $relationship = $row->{relationship_lsid};
+	}	    
 	my $type = $args{'term'};
 	return 0 unless $type;
 	my $lsid;
@@ -1335,11 +1340,13 @@
 	    $lsid = $row->{object_lsid};
 	}
 	my $defs;
-	
+	my $extra_columns;
+	$extra_columns = ", relationship_type ";
+	if ($ontology eq "object"){$extra_columns .=", object2_articlename ";}
 	if ( $direction eq 'root' ) {
 		unless ( defined $relationship ) {
 			$defs = $self->dbh->selectall_arrayref( "
-            select distinct s2.${ontology}_lsid, relationship_type from
+            select distinct s2.${ontology}_lsid $extra_columns from
                 ${ontology}_term2term as t2t,
                 $ontology as s1,
                 $ontology as s2  
@@ -1349,7 +1356,7 @@
                 s1.${ontology}_lsid = ?", undef, $lsid );    # ")
 		} else {
 			$defs = $self->dbh->selectall_arrayref( "
-            select distinct s2.${ontology}_lsid, relationship_type from
+            select distinct s2.${ontology}_lsid $extra_columns from
                 ${ontology}_term2term as t2t,
                 $ontology as s1,
                 $ontology as s2  
@@ -1362,7 +1369,7 @@
 	} else {
 		unless ( defined $relationship ) {
 			$defs = $self->dbh->selectall_arrayref( "
-            select distinct s2.${ontology}_lsid, relationship_type from
+            select distinct s2.${ontology}_lsid $extra_columns from
                 ${ontology}_term2term as t2t,
                 $ontology as s1,
                 $ontology as s2  
@@ -1372,7 +1379,7 @@
                 s2.${ontology}_lsid = ?", undef, $lsid);                   # ")
 		} else {
 			$defs = $self->dbh->selectall_arrayref( "
-            select distinct s2.${ontology}_lsid, relationship_type from
+            select distinct s2.${ontology}_lsid $extra_columns from
                 ${ontology}_term2term as t2t,
                 $ontology as s1,
                 $ontology as s2  




More information about the MOBY-guts mailing list