[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Wed Aug 3 11:30:30 UTC 2005


mwilkinson
Wed Aug  3 07:30:30 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Client
In directory pub.open-bio.org:/tmp/cvs-serv3820/MOBY/Client

Modified Files:
	Central.pm 
Log Message:
fixed the client and the test suite to ensure that collections are no longer able to contain multiple simples, as per API 8.86

moby-live/Perl/MOBY/Client Central.pm,1.110,1.111
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2005/07/31 15:18:54	1.110
+++ /home/repository/moby/moby-live/Perl/MOBY/Client/Central.pm	2005/08/03 11:30:30	1.111
@@ -874,27 +874,29 @@
 #					[articleName1,[objType1 => \@namespaces]], # Simple
 #                    [articleName2,       [[objType2 => \@namespaces]]], # collection of one object type
 #                    [articleName3,[[objType3 => \@namespaces],
-#								  [objType4 => \@namespaces]]] # collection of multiple object types
-#                 ]
+#		                    [objType4 => \@namespaces]]] # collection of multiple object types (THIS IS NOW ILLEGAL!)
+#                    ]
 			foreach my $article (@ALLARTICLES) {
 				my ( $articleName, $def ) = @{$article};
 				$articleName ||= "";
 				my @Objects;    #
-				unless ( ref($def) =~ /array/i ) {
-					return $self->errorRegXML(
-"invalid structure of $inout objects, expected arrayref for article $articleName"
-					);
+				unless ( (ref($def) =~ /array/i)) { # $def = [objType => \@ns]  or $def=[[objType => \@ns]]
+					return $self->errorRegXML("invalid structure of $inout objects, expected SINGLE arrayref for article $articleName as required by the 0.86 API");
 				}
 				my @objectdefs;
-				if ( ( ref $def->[0] ) =~ /array/i ) {    # collection
+				if ( ( ref $def->[0] ) =~ /array/i ) {    # collection $def->[0] = [objType => \@ns]
 					    # def= [[objType2 => [ns3, ns4...]], ...]
 					$message .= "<Collection articleName='$articleName'>\n";
-					@objectdefs = @{$def};
-				}
-				else {    # Nipple
-					@objectdefs = ($def);
-
-					# def = [objType1 => [ns1, ns2...]],
+					if (scalar(@{$def->[0]} > 2)){
+					  return $self->errorRegXML("invalid structure of $inout objects.  Collections may not have more than one Simple content type as per API version 0.86");
+					}
+                                        @objectdefs = @{$def};
+					if (scalar(@objectdefs) > 1){
+					  return $self->errorRegXML("invalid structure of $inout objects.  Collections may not have more than one Simple content type as per API version 0.86");
+					}
+				} else {    # Simple $def->[0] = objType
+				  # def = [objType1 => [ns1, ns2...]],
+				  @objectdefs = ($def);
 				}
 				foreach my $objectdef (@objectdefs) {
 					if ( ( ref( $def->[0] ) ) =~ /array/i ) {




More information about the MOBY-guts mailing list