[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Sun Dec 28 20:41:59 UTC 2003


mwilkinson
Sun Dec 28 15:41:59 EST 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv9318/MOBY

Modified Files:
	Central.pm CommonSubs.pm OntologyServer.pm simple_input.pm 
Log Message:
making MOBY Central case-sensitive for LSIDs.  I might have missed a few places.  please let me know if you find any.

moby-live/Perl/MOBY Central.pm,1.119,1.120 CommonSubs.pm,1.38,1.39 OntologyServer.pm,1.30,1.31 simple_input.pm,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/27 15:12:31	1.119
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2003/12/28 20:41:59	1.120
@@ -758,7 +758,7 @@
 
 	my $dbh = MOBY::central_db_connection->new->dbh;
 
-	my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where namespace_type_uris like '%$existingURI%'");
+	my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where INSTR(namespace_type_uris,'$existingURI')");
 	$sth->execute;
 	while (my ($id, $ns) = $sth->fetchrow_array()){
 		my @nss = split ",", $ns;
@@ -768,7 +768,7 @@
 		}
 	}
 
-	$sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where namespace_type_uris like '%$existingURI%'");
+	$sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where INSTR(namespace_type_uris,'$existingURI')");
 	$sth->execute;
 	while (my ($id, $ns) = $sth->fetchrow_array()){
 		my @nss = split ",", $ns;
@@ -778,7 +778,7 @@
 		}
 	}
 
-	$sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where namespace_type_uris like '%$existingURI%'");
+	$sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input natural join simple_input where INSTR(namespace_type_uris, '$existingURI')");
 	$sth->execute;
 	while (my ($id, $ns) = $sth->fetchrow_array()){
 		my @nss = split ",", $ns;
@@ -788,7 +788,7 @@
 		}
 	}
 
-	$sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where namespace_type_uris like '%$existingURI%'");
+	$sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output natural join simple_output where INSTR(namespace_type_uris, '$existingURI')");
 	$sth->execute;
 	while (my ($id, $ns) = $sth->fetchrow_array()){
 		my @nss = split ",", $ns;
@@ -1699,7 +1699,7 @@
 
 	my $nsquery;
 	foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's
-			$nsquery .=" OR namespace_type_uris like '%$ns%' ";
+			$nsquery .=" OR INSTR(namespace_type_uris, '$ns') ";
 	}
 	if ($nsquery){
 		$nsquery =~ s/OR//; # just the first
@@ -1754,7 +1754,7 @@
 		
 		my $nsquery;
 		foreach my $ns(@{$namespaceURIs}){ # namespaces are already URI's
-			$nsquery .=" OR namespace_type_uris like '%$ns%' ";
+			$nsquery .=" OR INSTR(namespace_type_uris, '$ns') ";
 		}
 		if ($nsquery){
 			$nsquery =~ s/^\sOR//; # just the first

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/27 20:24:52	1.38
+++ /home/repository/moby/moby-live/Perl/MOBY/CommonSubs.pm	2003/12/28 20:41:59	1.39
@@ -1074,7 +1074,6 @@
 }
 
 
-
 =head2 whichDeepestParentObject
 
  name     : whichDeepestParentObject
@@ -1084,8 +1083,12 @@
  args     : $CENTRAL - your MOBY::Client::Central object
             $queryTerm - the object type I am interested in
             \@termlist - the list of object types that I know about
- returns  : an ontology term as a scalar, or undef if there
-            is no parent of this node in the nodelist
+ returns  : an ontology term and LSID as a scalar, or undef if there
+            is no parent of this node in the nodelist.
+            (note that it will only return the term if you give it
+             term names in the @termList.  If you give it
+             LSID's in the termList, then both the parameters
+             returned will be LSID's - it doesn't back-translate...)
 
 =cut
 

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/12/02 00:23:23	1.30
+++ /home/repository/moby/moby-live/Perl/MOBY/OntologyServer.pm	2003/12/28 20:41:59	1.31
@@ -179,7 +179,7 @@
     }
 
     if ($term =~ /^urn\:lsid/){
-        $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_lsid = ?");
+        $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where INSTR(object_lsid, ?)");
     } else {
         $sth = $self->dbh->prepare("select object_lsid, object_type, description, authority, contact_email from object where object_type = ?");
     }
@@ -326,7 +326,7 @@
     return (0, "requires both term and ontology arguments\n",'') unless (defined($term) && defined($ont));
     my $sth;    
     if ($term =~ /^urn\:lsid/){
-        $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_lsid = ? and ontology=?");
+        $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where INSTR(relationship_lsid,?) and ontology=?");
     } else {
         $sth = $self->dbh->prepare("select relationship_lsid, relationship_type, description, authority, contact_email from relationship where relationship_type = ? and ontology=?");
     }
@@ -433,7 +433,7 @@
 
     my $sth;
     if ($term =~ /^urn\:lsid/){
-        $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_lsid = ?");
+        $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where INSTR(service_lsid,  ?)");
     } else {
         $sth = $self->dbh->prepare("select service_id, service_type, service_lsid, description, authority, contact_email from service where service_type = ?");
     }
@@ -545,7 +545,7 @@
     }
         
     if ($term =~ /^urn:lsid:biomoby.org:namespacetype/){
-        $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_lsid = ?");
+        $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where INSTR(namespace_lsid, ?)");
     } else {
         $sth = $self->dbh->prepare("select namespace_id, namespace_type, namespace_lsid,description, authority, contact_email from namespace where namespace_type = ?");
     }
@@ -691,7 +691,7 @@
 sub getObjectCommonName {
     my ($self, $URI) = @_;
     return undef unless $URI =~ /urn\:lsid/;
-    my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_id = ?}, undef, $URI);
+    my ($name) = $self->dbh->selectrow_array(q{select object_type from object where object_lsid = ?}, undef, $URI);
     return $name?$name:$URI;
 }
 
@@ -702,7 +702,7 @@
 sub getNamespaceCommonName {
     my ($self, $URI) = @_;
     return undef unless $URI =~ /urn\:lsid/;
-    my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_id = ?}, undef, $URI);
+    my ($name) = $self->dbh->selectrow_array(q{select namespace_type from namespace where namespace_lsid = ?}, undef, $URI);
     return $name?$name:$URI;
 }
 

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm	2003/05/07 19:20:27	1.1
+++ /home/repository/moby/moby-live/Perl/MOBY/simple_input.pm	2003/12/28 20:41:59	1.2
@@ -14,7 +14,7 @@
 
 =head1 SYNOPSIS
 
- use MOBY::authority;
+ use MOBY::simple_input;
  my $Instance = MOBY::simple_input->new(
           object_type => "Sequence",
           namespaces => ["genbank/gi", "genbank/Acc"],




More information about the MOBY-guts mailing list