[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Wed Jan 28 14:42:21 UTC 2009


kawas
Wed Jan 28 09:42:21 EST 2009
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies
In directory dev.open-bio.org:/tmp/cvs-serv16212/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies

Modified Files:
	Services.pm 
Log Message:
added a loop to go over the array of unit tests
moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies Services.pm,1.9,1.10
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Services.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Services.pm	2008/11/24 14:38:32	1.9
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Services.pm	2009/01/28 14:42:21	1.10
@@ -20,6 +20,8 @@
 
 use XML::LibXML;
 
+use LS::ID;
+
 use MOBY::Client::Central;
 use MOBY::Config;
 
@@ -29,7 +31,6 @@
 use MOBY::RDF::Predicates::OMG_LSID;
 use MOBY::RDF::Predicates::RDF;
 use MOBY::RDF::Predicates::RDFS;
-
 use MOBY::RDF::Utils;
 
 use Data::Dumper;
@@ -486,29 +487,44 @@
 							 )
 						 )
 		);
+		# add the service type		
 		$model->addStmt(
 				 new RDF::Core::Statement(
 					 $bnode,
 					 $resource->new( MOBY::RDF::Predicates::RDF->type ),
-					 new RDF::Core::Resource( $self->{service_uri} . $SI->type )
+					 new RDF::Core::Resource($self->{service_uri} . $SI->type )
 				 )
 		);
 
 		# add unit test data here ...
-		if ( $SI->unitTest ) {
-			my $unit_test = $SI->unitTest;
-			$bnode =
-			  new RDF::Core::Resource(
-									   $self->{instance_uri},
-									   md5_hex(
-											 "$service_authority/$service_name/"
-											   . MOBY::RDF::Predicates::FETA
-											   ->unitTest
-									   )
-			  );
+		if ( $SI->unitTests ) {
+			my $unitTests = $SI->unitTests;
+			my $utils = new MOBY::RDF::Utils;
+			foreach my $unit_test (@$unitTests) {
+				$bnode =
+				  new RDF::Core::Resource(
+						  $self->{instance_uri},
+						  md5_hex(
+							  "$service_authority/$service_name/"
+								. (
+									  $unit_test->example_input
+									? $utils->trim($unit_test->example_input)
+									: ""
+								)
+								. (
+									  $unit_test->expected_output
+									? $utils->trim($unit_test->expected_output)
+									: ""
+								)
+								. ( $unit_test->regex ? $utils->trim($unit_test->regex) : "" )
+								. ( $unit_test->xpath ? $utils->trim($unit_test->xpath) : "" )
+								."/"
+								. MOBY::RDF::Predicates::FETA->unitTest
+						  )
+				  );
 
-			# add the type
-			$model->addStmt(
+				# add the type
+				$model->addStmt(
 						 new RDF::Core::Statement(
 							 $bnode,
 							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
@@ -516,21 +532,23 @@
 										   MOBY::RDF::Predicates::FETA->unitTest
 							 )
 						 )
-			);
+				);
 
-			# add the example input if defined
-			$model->addStmt(
-				new RDF::Core::Statement(
-					$bnode,
-					$resource->new( MOBY::RDF::Predicates::FETA->exampleInput ),
-					new RDF::Core::Literal( $unit_test->example_input )
-				)
-			  )
-			  if $unit_test->example_input
-				  and $unit_test->example_input ne '';
+				# add the example input if defined
+				$model->addStmt(
+						 new RDF::Core::Statement(
+							 $bnode,
+							 $resource->new(
+									   MOBY::RDF::Predicates::FETA->exampleInput
+							 ),
+							 new RDF::Core::Literal( $unit_test->example_input )
+						 )
+				  )
+				  if $unit_test->example_input
+					  and $unit_test->example_input ne '';
 
-			# add the valid output xml if defined
-			$model->addStmt(
+				# add the valid output xml if defined
+				$model->addStmt(
 					   new RDF::Core::Statement(
 						   $bnode,
 						   $resource->new(
@@ -538,39 +556,46 @@
 						   ),
 						   new RDF::Core::Literal( $unit_test->expected_output )
 					   )
-			  )
-			  if $unit_test->expected_output
-				  and $unit_test->expected_output ne '';
+				  )
+				  if $unit_test->expected_output
+					  and $unit_test->expected_output ne '';
 
-			# add the valid regex if defined
-			$model->addStmt(
-				  new RDF::Core::Statement(
-					  $bnode,
-					  $resource->new( MOBY::RDF::Predicates::FETA->validREGEX ),
-					  new RDF::Core::Literal( $unit_test->regex )
+				# add the valid regex if defined
+				$model->addStmt(
+								 new RDF::Core::Statement(
+									 $bnode,
+									 $resource->new(
+										 MOBY::RDF::Predicates::FETA->validREGEX
+									 ),
+									 new RDF::Core::Literal( $unit_test->regex )
+								 )
 				  )
-			  )
-			  if $unit_test->regex
-				  and $unit_test->regex ne '';
+				  if $unit_test->regex
+					  and $unit_test->regex ne '';
 
-			# add the valid xpath expression if defined
-			$model->addStmt(
-				  new RDF::Core::Statement(
-					  $bnode,
-					  $resource->new( MOBY::RDF::Predicates::FETA->validXPath ),
-					  new RDF::Core::Literal( $unit_test->xpath )
+				# add the valid xpath expression if defined
+				$model->addStmt(
+								 new RDF::Core::Statement(
+									 $bnode,
+									 $resource->new(
+										 MOBY::RDF::Predicates::FETA->validXPath
+									 ),
+									 new RDF::Core::Literal( $unit_test->xpath )
+								 )
 				  )
-			  )
-			  if $unit_test->xpath
-				  and $unit_test->xpath ne '';
+				  if $unit_test->xpath
+					  and $unit_test->xpath ne '';
 
-			$model->addStmt(
-				new RDF::Core::Statement(
-					$operation,
-					$resource->new( MOBY::RDF::Predicates::FETA->hasUnitTest ),
-					$bnode
-				)
-			);
+				$model->addStmt(
+								new RDF::Core::Statement(
+									$operation,
+									$resource->new(
+										MOBY::RDF::Predicates::FETA->hasUnitTest
+									),
+									$bnode
+								)
+				);
+			}
 		}
 
 		my $inputs = $SI->input;
@@ -616,7 +641,7 @@
 							 )
 						 )
 				);
-
+							
 				my $oType =
 				  new RDF::Core::Resource(
 					   $self->{instance_uri},
@@ -637,13 +662,14 @@
 									 $oType
 								 )
 				);
+								
 				$model->addStmt(
 					new RDF::Core::Statement(
 						$oType,
 						$resource->new( MOBY::RDF::Predicates::RDF->type ),
 						new RDF::Core::Resource(
-										  $self->{datatype_uri} . $_->objectType
-						  )    #TODO check for lsid
+							$self->{datatype_uri} . $_->objectType
+						)#TODO check for lsids
 					)
 				);
 
@@ -713,7 +739,7 @@
 							$resource->new( MOBY::RDF::Predicates::RDF->type ),
 							new RDF::Core::Resource(
 													 $self->{namespace_uri} . $n
-							  )    #TODO check for lsids
+							  )  #TODO check for lsids
 						)
 					);
 				}
@@ -797,7 +823,7 @@
 							$resource->new( MOBY::RDF::Predicates::RDF->type ),
 							new RDF::Core::Resource(
 									   $self->{datatype_uri} . $simp->objectType
-							  )    #TODO check for lsid
+							  )#TODO check for lsids
 						)
 					);
 					my $namespaces = $simp->namespaces;
@@ -845,7 +871,7 @@
 								),
 								new RDF::Core::Resource(
 													 $self->{namespace_uri} . $n
-								  )    #TODO check for lsids
+								  )#TODO check for lsids
 							)
 						);
 					}
@@ -1050,7 +1076,7 @@
 						$resource->new( MOBY::RDF::Predicates::RDF->type ),
 						new RDF::Core::Resource(
 										  $self->{datatype_uri} . $_->objectType
-						  )    #TODO check for lsid
+						  )#TODO check for lsids
 					)
 				);
 
@@ -1120,7 +1146,7 @@
 							$resource->new( MOBY::RDF::Predicates::RDF->type ),
 							new RDF::Core::Resource(
 													 $self->{namespace_uri} . $n
-							  )    #TODO check for lsids
+							  )#TODO check for lsids
 						)
 					);
 				}
@@ -1204,7 +1230,7 @@
 							$resource->new( MOBY::RDF::Predicates::RDF->type ),
 							new RDF::Core::Resource(
 									   $self->{datatype_uri} . $simp->objectType
-							  )    #TODO check for lsid
+							  )#TODO check for lsids
 						)
 					);
 					my $namespaces = $simp->namespaces;
@@ -1252,7 +1278,7 @@
 								),
 								new RDF::Core::Resource(
 													 $self->{namespace_uri} . $n
-								  )    #TODO check for lsids
+								  )#TODO check for lsids
 							)
 						);
 					}




More information about the MOBY-guts mailing list