[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Tue Jun 10 22:30:11 UTC 2003


mwilkinson
Tue Jun 10 18:30:11 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv1638

Modified Files:
	Central.pm OntologyServer.pm 
Log Message:
but in the discovery of services by output fixed.  Added an (as yet untested) example of a MOBY Service that takes GO Accessions and returns GO Term objects.  I am testing it on my local server right now and will deploy it publicly and  make a comment about it on-list if it works

moby-live/Perl/MOBY Central.pm,1.73,1.74 OntologyServer.pm,1.13,1.14
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/06/10 17:12:52	1.73
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/06/10 22:30:11	1.74
@@ -1701,12 +1701,14 @@
 	if (scalar @{$findme{inputObjects}}){
 		++$criterion_count;
 		my $obj = (shift @{$findme{inputObjects}});
-		my @si_ids = &_searchForServicesWithArticle($dbh, "input", $obj,'');
+		my @si_ids;
+		@si_ids = &_searchForServicesWithArticle($dbh, "input", $obj,'') if defined $obj;
 		my %instances;
 		# we need to do a join, without doing a join...
 		if (scalar @si_ids){
 			map {$instances{$_}=1} @si_ids; # get an id of the good services from the first object
 			while (my $obj = shift(@{$findme{inputObjects}})){  # iterate through the rest of the objects
+				next unless $obj;
 				my @new_ids = &_searchForServicesWithArticle($dbh, "input", $obj,'');  # get their service ids
 				my @good_ids;my %good_ids;
 				foreach my $id(@new_ids){  # check the new id set against the set we know is already valid
@@ -1724,13 +1726,15 @@
 	}
 	if (scalar @{$findme{outputObjects}}){
 		++$criterion_count;
-		my $obj = (shift @{$findme{inputObjects}});
-		my @si_ids = &_searchForServicesWithArticle($dbh, "output", $obj,'');
+		my $obj = (shift @{$findme{outputObjects}});
+		my @si_ids;
+		@si_ids = &_searchForServicesWithArticle($dbh, "output", $obj,'') if defined $obj;
 		my %instances;
 		# we need to do a join, without doing a join...
 		if (scalar @si_ids){
 			map {$instances{$_}=1} @si_ids; # get an id of the good services from the first object
-			while (my $obj = shift(@{$findme{inputObjects}})){  # iterate through the rest of the objects
+			while (my $obj = shift(@{$findme{outputObjects}})){  # iterate through the rest of the objects
+				next unless $obj;
 				my @new_ids = &_searchForServicesWithArticle($dbh, "output", $obj,'');  # get their service ids
 				my @good_ids;my %good_ids;
 				foreach my $id(@new_ids){  # check the new id set against the set we know is already valid
@@ -1752,7 +1756,7 @@
 		next unless $freq == $criterion_count;  # has to have matched every criterion
 		push @final, $id;
 	}
-	return &_serviceListResponse($dbh, @final);
+return &_serviceListResponse($dbh, @final);
 
 }
 

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/06/10 17:34:12	1.13
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/06/10 22:30:11	1.14
@@ -137,14 +137,18 @@
 
 	my $host = $self->host?$self->host:$ENV{MOBY_CENTRAL_URL}; chomp $host;
 	my $username = $self->username?$self->username:$ENV{MOBY_CENTRAL_DBUSER}; chomp $username;
-	my $password = $self->password?$self->password:$ENV{MOBY_CENTRAL_DBPASS}; chomp $password;
+	my $password = $self->password?$self->password:$ENV{MOBY_CENTRAL_DBPASS}; chomp $password; $password =~ s/\s//g;
     my $port = $self->port?$self->port:$ENV{MOBY_CENTRAL_DBPORT}; chomp $port;
     
     my ($dsn) = "DBI:mysql:".($self->database).":".($host).":".($port);
 
     my $dbh;
 #	$debug && &_LOG("connecting to db with params ",$self->database, $self->username, $self->password,"\n");
-    $dbh = DBI->connect($dsn, $username, $password, {RaiseError => 1}) or die "can't connect to database";
+    if (defined $password){
+        $dbh = DBI->connect($dsn, $username, $password, {RaiseError => 1}) or die "can't connect to database";
+    } else {
+        $dbh = DBI->connect($dsn, $username, undef, {RaiseError => 1}) or die "can't connect to database";
+    }
 #	$debug && &_LOG("CONNECTED!\n");
     if ($dbh){
         $self->dbh($dbh);




More information about the MOBY-guts mailing list