[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Wed Jun 16 01:15:30 UTC 2004


mwilkinson
Tue Jun 15 21:15:30 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv16447/MOBY/Client

Modified Files:
	Central.pm SecondaryArticle.pm 
Added Files:
	SimpleInput.pm 
Log Message:
all sorts of additions and changes.  Secondary parameters now work for me on two systems, so that problem should now be solved.  I am starting to rip out the SQL that is in MOBY Central into other modules, and it will eventually end up in a single mysql-specific module with an API to make it easier to code MOBY onto other data back-ends.  Various bug fixes here and there as well.

moby-live/Perl/MOBY/Client SimpleInput.pm,NONE,1.1 Central.pm,1.75,1.76 SecondaryArticle.pm,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2004/05/03 19:49:18	1.75
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2004/06/16 01:15:30	1.76
@@ -10,6 +10,7 @@
 use MOBY::Client::Registration;
 use MOBY::Client::SimpleArticle;
 use MOBY::Client::CollectionArticle;
+use MOBY::Client::SecondaryArticle;
 use MOBY::Client::OntologyServer;
 
 use vars qw($AUTOLOAD @ISA $MOBY_server $MOBY_uri);
@@ -722,8 +723,8 @@
 
 	if ($Category eq "moby" || $Category eq 'soap') {
 		my %SEC;
-		if ($a{'secondary'} && ref($a{'secondary'} =~ /hash/i)){
-			%SEC = %{$a{secondary}}
+		if ($a{'secondary'} && (ref($a{'secondary'}) =~ /hash/i)){
+			%SEC = %{$a{secondary}};
 		} elsif ($a{'secondary'} && !(ref($a{'secondary'}) =~ /hash/i)){
 			return $self->errorRegXML("invalid structure of secondary parameters.  Expected hashref.")
 		}
@@ -799,13 +800,14 @@
 			my $min = $data{min};
 			my $datatype = $data{datatype};
 			unless ($datatype){return $self->errorRegXML("a secondaryArticle must contain at least a datatype value in secondary article $param");}
+			unless (($datatype =~ /Integer/) || ($datatype =~ /Float/) || ($datatype =~ /String/) || ($datatype =~ /DateTime/)){return $self->errorRegXML("a secondaryArticle must have a datatype of Integer, Float, String, or DateTime");}
 			unless ((ref($data{enum})) =~ /array/i){return $self->errorRegXML("invalid structure of enum limits in secondary article $param; expected arrayref")}
 			my @enums = @{$data{enum}};
 			$message .="<Parameter articleName='$param'>\n";
 			$message .="<default>$default</default>\n";
 			$message .="<datatype>$datatype</datatype>\n";
-			$message .="<max></max>\n";
-			$message .="<min></min>\n";
+			$message .="<max>$max</max>\n";
+			$message .="<min>$min</min>\n";
 			foreach (@enums){
 				$message .="<enum>$_</enum>\n";
 			}

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/SecondaryArticle.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/MOBY/Client/SecondaryArticle.pm	2004/05/03 19:49:18	1.1
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/SecondaryArticle.pm	2004/06/16 01:15:30	1.2
@@ -185,7 +185,7 @@
 
     sub addEnum {
         my ($self, $enum) = @_;
-        return $self->{enum} unless $enum;
+        return $self->{enum} unless defined($enum);
         push @{$self->{enum}}, $enum;
         return $self->{enum};
     }
@@ -265,36 +265,46 @@
 
     my $objects = $dom->getElementsByTagName("datatype");
     if ($objects->item(0)){
+        my $data;
         foreach my $child($objects->item(0)->getChildNodes){ 
             next unless $child->getNodeType == TEXT_NODE;
-            $self->datatype($self->datatype . $child->toString);
+            $data .= $child->toString;
+            $data =~ s/\s//g;
         }
+        $self->datatype($data);
     }
-    $self->datatype($self->datatype =~ s/^\s//);
-    $self->datatype($self->datatype =~ s/\s$//);
     
     $objects = $dom->getElementsByTagName("default");
     if ($objects->item(0)){
+        my $def;
         foreach my $child($objects->item(0)->getChildNodes){ 
             next unless $child->getNodeType == TEXT_NODE;
-            $self->default($self->default . $child->toString);
+            $def .= $child->toString;
+            $def =~ s/\s//g;
         }
+        $self->default($def);
     }
     
     $objects = $dom->getElementsByTagName("max");
     if ($objects->item(0)){
+        my $max;
         foreach my $child($objects->item(0)->getChildNodes){ 
             next unless $child->getNodeType == TEXT_NODE;
-            $self->max($self->max . $child->toString);
+            $max .= $child->toString;
+            $max =~ s/\s//g;
         }
+        $self->max($max);
     }
     
     $objects = $dom->getElementsByTagName("min");
     if ($objects->item(0)){
+        my $min;
         foreach my $child($objects->item(0)->getChildNodes){ 
             next unless $child->getNodeType == TEXT_NODE;
-            $self->min($self->min . $child->toString);
+            $min .= $child->toString;
+            $min =~ s/\s//g;
         }
+        $self->min($min);
     }
     
     $objects = $dom->getElementsByTagName("enum");
@@ -303,7 +313,8 @@
             foreach my $child($objects->item($_)->getChildNodes){
                 my $val;
                 next unless $child->getNodeType == TEXT_NODE;
-                next unless $val = $child->toString;
+                $val = $child->toString;
+                next unless defined($val);
                 $val =~ s/^\s//; $val =~ s/\s$//;
                 $self->addEnum($val);
             }




More information about the MOBY-guts mailing list