[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Fri Jul 22 17:12:13 UTC 2005


mwilkinson
Fri Jul 22 13:12:13 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv390/MOBY/Adaptor/moby/queryapi

Modified Files:
	mysql.pm 
Log Message:
the logic for findig existing services was still wonky.  This simplifies it and should fix it.  Also fixed the documentation for the MOBY::Client::ServiceInstance object as per this mornings email

moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.21,1.22
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/21 16:37:35	1.21
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/22 17:12:13	1.22
@@ -625,9 +625,23 @@
 # where is lsid?
 
 sub query_service_instance {
-	my ($self, @args) = @_;	
+	my ($self, %args) = @_;	
 	my $dbh = $self->dbh;
-
+    	
+	my $authority_id;
+	if ($args{'authority_uri'}){ # need to transform URI to a row ID
+	    my $result = $self->query_authority({authority_uri => $args{'authority_uri'}});
+	    return 0 unless @$result[0];
+	    my $authority_id = @$result[0]->{authority_id};
+	    return 0 unless $authority_id;
+	}	
+	delete $args{'authority_uri'};  # this can't be passed into the search since it doens't exist in the table
+	my @args;
+	while (my ($k, $v) = each %args){
+	    push @args, ({$k => $v},"and"); # format for the add_condition subroutine
+	}
+	pop @args; # get rid of last "and"
+	
 	my $statement = "select
           service_instance_id,
           category,




More information about the MOBY-guts mailing list