[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Mon Jul 14 16:34:43 UTC 2003


mwilkinson
Mon Jul 14 12:34:43 EDT 2003
Update of /home/repository/moby/moby-live/Perl/scripts/Services
In directory pub.open-bio.org:/tmp/cvs-serv1004/Perl/scripts/Services

Modified Files:
	LocalServices.pm 
Log Message:
modifying my own MOBY Services to use the new CommonSubs library as a way of testing this library

moby-live/Perl/scripts/Services LocalServices.pm,1.14,1.15
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/07/10 21:57:27	1.14
+++ /home/repository/moby/moby-live/Perl/scripts/Services/LocalServices.pm	2003/07/14 16:34:43	1.15
@@ -9,6 +9,7 @@
 use MIME::Base64;
 use XML::DOM;
 use MOBY::Client::OntologyServer;
+use MOBY::CommonSubs qw(:all);
 
 use vars qw(@ISA);
 @ISA = qw(SOAP::Server::Parameters);   # uncomment this line if you want access to the SOM as the
@@ -19,16 +20,22 @@
     my $SOM = pop;  
     my ($self, $data) = @_;
     my $response; my @accessions;
+	# first, get the valid URI for the namespace that we accept
+	my $OS = MOBY::Client::OntologyServer->new;
+	my $VALID_NAMESPACE = $OS->namespaceExists(term => 'GO');
+	$VALID_NAMESPACE || die "Expected Namespace 'GO' does not exist in the MOBY namespace ontology!";
 
-	my @input_nodes = $self->_getSimpleChildNodes($data);
+	# now start analyzing the input data
+	my @input_nodes = getInputArticles($data);
 	foreach (@input_nodes){
-		my $content .= $_->toString;
-		unless (($content =~ /namespace\s*=\s*['"]GO.*?id\s*=\s*['"](GO:\d\d\d\d\d\d\d)/s) ||  # this would be  a lot easier to track if I used a real XML parser
-				($content =~ /namespace\s*=\s*['"]GO.*?id\s*=\s*['"](\d+)/s) ){  # we don't know yet what a GO id should look like "GO:0001823" or "0001823"
-			push @accessions, undef;  # we must return a respnse node for *every* input node, even if it is invalid
-									# and the response nodes must appear in the same order
+		my ($input) = @{$_}; # this service only allows one input per query, so take the first
+		my $ns = getSimpleArticleNamespaceURI($input);
+		push @accessions, undef unless $ns eq $VALID_NAMESPACE; # if we have been sent an invalid namespace, then stack an undef as a response
+		my ($id) = getSimpleArticleIDs($ns, [$input]);
+		if (defined $id){
+			push @accessions, $id;
 		} else {
-			push @accessions, $1;
+			push @accessions, undef;
 		}
     }
 




More information about the MOBY-guts mailing list