[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Wed Jun 25 16:13:03 UTC 2008


kawas
Wed Jun 25 12:13:02 EDT 2008
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies
In directory dev.open-bio.org:/tmp/cvs-serv18603/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies

Modified Files:
	Services.pm 
Log Message:
changes:
there are no longer any bnodes. all bnodes are now unique (hopefully; we use a MD5 checksum to create the URI so there is a small probability that the uris generated may not be unique once in a very blue moon) URIs 
moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies Services.pm,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Services.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Services.pm	2008/06/19 22:38:10	1.5
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Services.pm	2008/06/25 16:13:02	1.6
@@ -16,6 +16,8 @@
 use RDF::Core::Model::Serializer;
 use RDF::Core::NodeFactory;
 
+use Digest::MD5;
+
 use XML::LibXML;
 
 use MOBY::Client::Central;
@@ -43,6 +45,8 @@
 
 =head1 SYNOPSIS
 
+	use MOBY::RDF::Ontologies::Services;
+
 	my $x = MOBY::RDF::Ontologies::Services->new;
 
 	# get pretty printed RDF/XML for one service
@@ -257,7 +261,14 @@
 	my $model        = new RDF::Core::Model( Storage => $storage );
 	my $node_factory = new RDF::Core::NodeFactory();
 
+	# used to create bnode IDs
+	my $digest = new Digest::MD5;
+
 	foreach my $SI (@$services) {
+		# used for computing checksums
+		my $service_name = $SI->name;
+		my $service_authority = $SI->authority;
+
 		my $resource =
 		  new RDF::Core::Resource( $self->{instance_uri},
 								   $SI->authority . "," . $SI->name );
@@ -355,7 +366,10 @@
 			} unless $addIsAlive  =~ /no/i;
 		};
 		# add the authoring statements
-		my $bnode = $node_factory->newResource;
+		my $bnode = new RDF::Core::Resource(
+			$self->{instance_uri}, 
+			$digest->md5_hex("$service_authority/$service_name/" . MOBY::RDF::Predicates::FETA->providedBy )
+		); #$node_factory->newResource;
 		$model->addStmt(
 				  new RDF::Core::Statement(
 					  $resource,
@@ -387,17 +401,20 @@
 			 )
 		);
 		$model->addStmt(
-						 new RDF::Core::Statement(
-							 $bnode,
-							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
-							 new RDF::Core::Resource(
-									   MOBY::RDF::Predicates::FETA->organisation
-							 )
-						 )
+			new RDF::Core::Statement(
+				$bnode,
+				$resource->new( MOBY::RDF::Predicates::RDF->type ),
+					new RDF::Core::Resource(
+						MOBY::RDF::Predicates::FETA->organisation
+				)
+			)
 		);
 
 		# add parameter statements
-		my $operation = $node_factory->newResource;
+		my $operation = new RDF::Core::Resource(
+			$self->{instance_uri}, 
+			$digest->md5_hex("$service_authority/$service_name/" . MOBY::RDF::Predicates::FETA->hasOperation)
+		); # $node_factory->newResource;
 		$model->addStmt(
 				new RDF::Core::Statement(
 					$resource,
@@ -422,7 +439,10 @@
 										MOBY::RDF::Predicates::FETA->operation )
 						 )
 		);
-		$bnode = $node_factory->newResource;
+		$bnode = new RDF::Core::Resource(
+			$self->{instance_uri}, 
+			$digest->md5_hex("$service_authority/$service_name/" . MOBY::RDF::Predicates::FETA->performsTask)
+		); # $node_factory->newResource;
 		$model->addStmt(
 				new RDF::Core::Statement(
 					$operation,
@@ -451,7 +471,15 @@
 
 		my $inputs = $SI->input;
 		foreach (@$inputs) {
-			my $inputParameter = $node_factory->newResource;
+			my $inputParameter = new RDF::Core::Resource(
+				$self->{instance_uri}, 
+				$digest->md5_hex(
+					"$service_authority/$service_name/" 
+					. ($_->isSimple ? "isSimple/" : "isCollection/") 
+					. MOBY::RDF::Predicates::FETA->inputParameter 
+					. "/" 
+					. $_->articleName)
+			); # $node_factory->newResource;
 			$model->addStmt(
 							 new RDF::Core::Statement(
 								 $operation,
@@ -481,7 +509,18 @@
 						 )
 				);
 
-				my $oType = $node_factory->newResource;
+				my $oType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->inputParameter
+						. "/"
+						. $_->articleName
+						. "/"
+						. $_->objectType
+					)
+				); # $node_factory->newResource;
 				$model->addStmt(
 								 new RDF::Core::Statement(
 									 $inputParameter,
@@ -502,7 +541,16 @@
 					)
 				);
 
-				my $pType = $node_factory->newResource;
+				my $pType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->hasParameterType
+						. "/"
+						. $_->articleName
+					)
+				); # $node_factory->newResource;
 				$model->addStmt(
 						   new RDF::Core::Statement(
 							   $inputParameter,
@@ -523,7 +571,17 @@
 				);
 				my $namespaces = $_->namespaces;
 				foreach my $n (@$namespaces) {
-					my $inNamespaces = $node_factory->newResource;
+					my $inNamespaces = new RDF::Core::Resource(
+						$self->{instance_uri}, 
+						$digest->md5_hex(
+							"$service_authority/$service_name/" 
+							. ($_->isSimple ? "isSimple/" : "isCollection/") 
+							. MOBY::RDF::Predicates::FETA->inputParameter 
+							. "/" 
+							. $_->articleName
+							. "/" 
+							. $n)
+						); # $node_factory->newResource;
 					$model->addStmt(
 							   new RDF::Core::Statement(
 								   $inputParameter,
@@ -574,7 +632,16 @@
 						 )
 				);
 
-				my $pType = $node_factory->newResource;
+				my $pType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->hasParameterType
+						. "/"
+						. $_->articleName
+					)
+				); # $node_factory->newResource;
 				$model->addStmt(
 						   new RDF::Core::Statement(
 							   $inputParameter,
@@ -596,7 +663,18 @@
 
 				my $simples = $_->Simples;
 				foreach my $simp (@$simples) {
-					my $oType = $node_factory->newResource;
+					my $oType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->inputParameter
+						. "/"
+						. $_->articleName
+						. "/"
+						. $simp->objectType
+					)
+				); # $node_factory->newResource;
 					$model->addStmt(
 								 new RDF::Core::Statement(
 									 $inputParameter,
@@ -618,7 +696,17 @@
 					);
 					my $namespaces = $simp->namespaces;
 					foreach my $n (@$namespaces) {
-						my $inNamespaces = $node_factory->newResource;
+						my $inNamespaces = new RDF::Core::Resource(
+						$self->{instance_uri}, 
+						$digest->md5_hex(
+							"$service_authority/$service_name/" 
+							. ($_->isSimple ? "isSimple/" : "isCollection/") 
+							. MOBY::RDF::Predicates::FETA->inputParameter 
+							. "/" 
+							. $_->articleName
+							. "/" 
+							. $n)
+						); # $node_factory->newResource;
 						$model->addStmt(
 							   new RDF::Core::Statement(
 								   $inputParameter,
@@ -661,7 +749,15 @@
 
 		foreach (@$secondaries) {
 			next unless $_->isSecondary;
-			my $inputParameter = $node_factory->newResource;
+			my $inputParameter =  new RDF::Core::Resource(
+				$self->{instance_uri}, 
+				$digest->md5_hex(
+					"$service_authority/$service_name/" 
+					. "isSecondaryInputParameter/"
+					. MOBY::RDF::Predicates::FETA->inputParameter 
+					. "/" 
+					. $_->articleName)
+			); #$node_factory->newResource;
 			$model->addStmt(
 							 new RDF::Core::Statement(
 								 $operation,
@@ -681,7 +777,16 @@
 						 )
 			);
 
-			my $pType = $node_factory->newResource;
+			my $pType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. "isSecondary/"
+						. MOBY::RDF::Predicates::FETA->hasParameterType
+						. "/"
+						. $_->articleName
+					)
+				); # $node_factory->newResource;
 			$model->addStmt(
 						   new RDF::Core::Statement(
 							   $inputParameter,
@@ -770,7 +875,15 @@
 
 		my $outputs = $SI->output;
 		foreach (@$outputs) {
-			my $outputParameter = $node_factory->newResource;
+			my $outputParameter = new RDF::Core::Resource(
+				$self->{instance_uri}, 
+				$digest->md5_hex(
+					"$service_authority/$service_name/" 
+					. ($_->isSimple ? "isSimple/" : "isCollection/") 
+					. MOBY::RDF::Predicates::FETA->outputParameter 
+					. "/" 
+					. $_->articleName)
+			); # $node_factory->newResource;
 			$model->addStmt(
 							new RDF::Core::Statement(
 								$operation,
@@ -800,7 +913,18 @@
 						 )
 				);
 
-				my $oType = $node_factory->newResource;
+				my $oType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->outputParameter
+						. "/"
+						. $_->articleName
+						. "/"
+						. $_->objectType
+					)
+				); # $node_factory->newResource;
 				$model->addStmt(
 								 new RDF::Core::Statement(
 									 $outputParameter,
@@ -821,7 +945,16 @@
 					)
 				);
 
-				my $pType = $node_factory->newResource;
+				my $pType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->hasParameterType
+						. "/"
+						. $_->articleName
+					)
+				); # $node_factory->newResource;
 				$model->addStmt(
 						   new RDF::Core::Statement(
 							   $outputParameter,
@@ -842,7 +975,17 @@
 				);
 				my $namespaces = $_->namespaces;
 				foreach my $n (@$namespaces) {
-					my $inNamespaces = $node_factory->newResource;
+					my $inNamespaces = new RDF::Core::Resource(
+						$self->{instance_uri}, 
+						$digest->md5_hex(
+							"$service_authority/$service_name/" 
+							. ($_->isSimple ? "isSimple/" : "isCollection/") 
+							. MOBY::RDF::Predicates::FETA->outputParameter 
+							. "/" 
+							. $_->articleName
+							. "/" 
+							. $n)
+						); # $node_factory->newResource;
 					$model->addStmt(
 							   new RDF::Core::Statement(
 								   $outputParameter,
@@ -893,7 +1036,16 @@
 						 )
 				);
 
-				my $pType = $node_factory->newResource;
+				my $pType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->hasParameterType
+						. "/"
+						. $_->articleName
+					)
+				); # $node_factory->newResource;
 				$model->addStmt(
 						   new RDF::Core::Statement(
 							   $outputParameter,
@@ -915,7 +1067,18 @@
 
 				my $simples = $_->Simples;
 				foreach my $simp (@$simples) {
-					my $oType = $node_factory->newResource;
+					my $oType = new RDF::Core::Resource(
+					$self->{instance_uri}, 
+					$digest->md5_hex(
+						"$service_authority/$service_name/" 
+						. ($_->isSimple ? "isSimple/" : "isCollection/" )
+						. MOBY::RDF::Predicates::FETA->outputParameter
+						. "/"
+						. $_->articleName
+						. "/"
+						. $simp->objectType
+					)
+				); # $node_factory->newResource;
 					$model->addStmt(
 								 new RDF::Core::Statement(
 									 $outputParameter,
@@ -937,7 +1100,17 @@
 					);
 					my $namespaces = $simp->namespaces;
 					foreach my $n (@$namespaces) {
-						my $inNamespaces = $node_factory->newResource;
+						my $inNamespaces = new RDF::Core::Resource(
+						$self->{instance_uri}, 
+						$digest->md5_hex(
+							"$service_authority/$service_name/" 
+							. ($_->isSimple ? "isSimple/" : "isCollection/") 
+							. MOBY::RDF::Predicates::FETA->outputParameter 
+							. "/" 
+							. $_->articleName
+							. "/" 
+							. $n)
+						); # $node_factory->newResource;
 						$model->addStmt(
 							   new RDF::Core::Statement(
 								   $outputParameter,




More information about the MOBY-guts mailing list