[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Thu Aug 26 20:52:28 UTC 2004


mwilkinson
Thu Aug 26 16:52:28 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv4627/MOBY

Modified Files:
	Central.pm 
Log Message:
interpret empty XML nodes in the findService message as undef, rather than spaces

moby-live/Perl/MOBY Central.pm,1.139,1.140
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2004/08/18 23:40:03	1.139
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2004/08/26 20:52:28	1.140
@@ -1597,7 +1597,7 @@
 			++$valid_service_ids{$_->[0]}; # increment that particular id's count by one
 		}
 	}
-	if ($findme{serviceType}){
+	if ($findme{serviceType}){  # must have something more than empty content
 		my $OS = MOBY::OntologyServer->new(ontology => 'service');
 		$findme{serviceType} =~ s/^moby\://;
 		my ($exists, $message, $URI) = $OS->serviceExists(term =>$findme{serviceType});
@@ -1899,12 +1899,19 @@
 	return undef unless ($obj eq 'findService');
 	
 	my $serviceType = &_nodeTextContent($Object, "serviceType");
+    $serviceType && ($serviceType =~ s/\s+//g);
 	my $servicename = &_nodeTextContent($Object, "serviceName");
+    $servicename && ($servicename =~ s/\s+//g);
 	my $authoritative = &_nodeTextContent($Object, "authoritative");
+    $authoritative && ($authoritative =~ s/\s+//g);
 	my $Category = &_nodeTextContent($Object, "Category");
+    $Category && ($Category =~ s/\s+//g);
 	my $AuthURI = &_nodeTextContent($Object, "authURI");
+    $AuthURI && ($AuthURI =~ s/\s+//g);
 	my $expandObjects = &_nodeTextContent($Object, "expandObjects");
+    $expandObjects && ($expandObjects =~ s/\s+//g);
 	my $expandServices = &_nodeTextContent($Object, "expandServices");
+    $expandServices && ($expandServices =~ s/\s+//g);
 	my @kw = &_nodeArrayContent($Object, "keywords");
 	my $INPUTS = &_nodeRawContent($Object, "Input"); # returns array ref
 	my $OUTPUTS = &_nodeRawContent($Object, "Output"); # returns array ref
@@ -2919,13 +2926,14 @@
 		$sth_simple_in->execute($_);
 		while (my ($objURI, $nsURI, $article) = $sth_simple_in->fetchrow_array()){
 			my $objName = $OSobj->getObjectCommonName($objURI);
+            $nsURI ||="";
 			my @nsURIs = split ",", $nsURI;
 			$article ||="";
 			$output .="\t\t<Simple articleName='$article'>\n";
 			$output .="\t\t\t<objectType>$objName</objectType>\n";
 			foreach my $ns(@nsURIs){
 				my $NSname = $OSns->getNamespaceCommonName($ns);
-				$output .="\t\t\t<Namespace>$NSname</Namespace>\n";
+				$output .="\t\t\t<Namespace>$NSname</Namespace>\n" if $NSname;
 			}
 			$output .="\t\t</Simple>\n";
 		}
@@ -2935,13 +2943,14 @@
 			$sth_collection_in->execute($collid);
 			while (my ($objURI, $nsURI, $article) = $sth_collection_in->fetchrow_array()){
 				my $objName = $OSobj->getObjectCommonName($objURI);
+                $nsURI ||="";
 				my @nsURIs = split ",", $nsURI;
 				$article ||="";
 				$output .="\t\t\t<Simple articleName='$article'>\n";
 				$output .="\t\t\t\t<objectType>$objName</objectType>\n";
 				foreach my $ns(@nsURIs){
 					my $NSname = $OSns->getNamespaceCommonName($ns);
-					$output .="\t\t\t\t<Namespace>$NSname</Namespace>\n";
+					$output .="\t\t\t\t<Namespace>$NSname</Namespace>\n" if $NSname;
 				}
 				$output .="\t\t\t</Simple>\n";
 			}
@@ -2954,13 +2963,14 @@
 		$sth_simple_out->execute($_);
 		while (my ($objURI, $nsURI, $article) = $sth_simple_out->fetchrow_array()){
 			my $objName = $OSobj->getObjectCommonName($objURI);
+            $nsURI ||="";
 			my @nsURIs = split ",", $nsURI;
 			$article ||="";
 			$output .="\t\t<Simple articleName='$article'>\n";
 			$output .="\t\t\t<objectType>$objName</objectType>\n";
 			foreach my $ns(@nsURIs){
 				my $NSname = $OSns->getNamespaceCommonName($ns);
-				$output .="\t\t\t<Namespace>$NSname</Namespace>\n";
+				$output .="\t\t\t<Namespace>$NSname</Namespace>\n" if $NSname;
 			}
 			$output .="\t\t</Simple>\n";
 		}
@@ -2970,12 +2980,14 @@
 			$sth_collection_out->execute($collid);
 			while (my ($objURI, $nsURI, $article) = $sth_collection_out->fetchrow_array()){
 				my $objName = $OSobj->getObjectCommonName($objURI);
-				my @nsURIs = split ",", $nsURI;			
+                $nsURI ||="";
+				my @nsURIs = split ",", $nsURI;
+                $article ||="";
 				$output .="\t\t\t<Simple articleName='$article'>\n";
 				$output .="\t\t\t\t<objectType>$objName</objectType>\n";
 				foreach my $ns(@nsURIs){
 					my $NSname = $OSns->getNamespaceCommonName($ns);
-					$output .="\t\t\t\t<Namespace>$NSname</Namespace>\n";
+					$output .="\t\t\t\t<Namespace>$NSname</Namespace>\n" if $NSname;
 				}
 				$output .="\t\t\t</Simple>\n";
 			}
@@ -2986,6 +2998,11 @@
 		$output .="\t<secondaryArticles>\n";
 		$sth_secondary_in->execute($_);
 		while (my ($default_value, $maximum_value, $minimum_value, $enum_value, $datatype, $article_name) = $sth_secondary_in->fetchrow_array()){
+            $article_name ||="";
+            $datatype ||="";
+            $default_value ||="";
+            $maximum_value ||="";
+            $minimum_value ||="";
 			$output .= "\t\t\t<Parameter articleName='$article_name'>\n";
 			$output .= "\t\t\t\t<datatype>$datatype</datatype>\n";
 			$output .="\t\t\t\t<default>$default_value</default>\n";




More information about the MOBY-guts mailing list