[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Wed Nov 28 20:01:23 UTC 2007


kawas
Wed Nov 28 15:01:23 EST 2007
Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies
In directory dev.open-bio.org:/tmp/cvs-serv28067/RDF/Ontologies

Modified Files:
	Services.pm 
Log Message:
added parameters to the constructor.
also, when getting all services, modified behaviour to make multiple api calls rather than one findservice call.
moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/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/RDF/Ontologies/Services.pm	2007/11/26 22:49:03	1.5
+++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm	2007/11/28 20:01:23	1.6
@@ -19,6 +19,7 @@
 use XML::LibXML;
 
 use MOBY::Client::Central;
+use MOBY::Config;
 
 use MOBY::RDF::Predicates::DC_PROTEGE;
 use MOBY::RDF::Predicates::FETA;
@@ -81,18 +82,26 @@
 # new
 #-----------------------------------------------------------------
 sub new {
-	my ($class) = @_;
+	my ( $class, %args ) = @_;
 
-#TODO - Extract the URIs for Namespaces/ServiceTypes/Objects/ServiceInstances from the moby config file
-# create an object
+	# create an object
 	my $self = bless {}, ref($class) || $class;
-	
+
 	# save some information retrieved from mobycentral.config
-    my $CONF  = MOBY::Config->new;
-	$self->{uri}       = $CONF->{mobycentral}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#';
+	my $CONF = MOBY::Config->new;
+	$self->{uri} = $CONF->{mobycentral}->{resourceURL}
+	  || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#' unless (defined $args{uri} and $args{uri});
+
+	# save the endpoint/namespace/uri if passed in
+	$self->{endpoint}  = $args{endpoint} if $args{endpoint};
+	$self->{namespace} = $args{endpoint} if $args{namespace};
+	$self->{uri}       = $args{uri}      if $args{uri} and defined $args{uri};         
+
+	# add a # at the end of the uri if it isnt there already
 	$self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/;
 
 	$self->{is_alive_path} = $CONF->{mobycentral}->{service_tester_path};
+
 	# done
 	return $self;
 }
@@ -120,20 +129,32 @@
 	my $prettyPrint = $hash->{prettyPrint} ? $hash->{prettyPrint} : 'yes';
 	my $services = [];
 	my $RegObject;
-	
-	if ($name ne '' or $authURI ne '') {
-		my $moby = MOBY::Client::Central->new();
+
+	# use the passed in endpoint if applicable
+	my $moby = MOBY::Client::Central->new(
+					 Registries => {
+						 mobycentral => {
+							 URL => $self->{endpoint},
+							 URI => 'http://mobycentral.cbr.nrc.ca/MOBY/Central'
+						 }
+					 }
+	  )
+	  if $self->{endpoint};
+
+	# otherwise use default one
+	$moby = MOBY::Client::Central->new() unless $self->{endpoint};
+
+	if ( $name ne '' or $authURI ne '' ) {
 		( $services, $RegObject ) =
-	  		$moby->findService( authURI => $authURI, serviceName => $name );
-	  
+		  $moby->findService( authURI => $authURI, serviceName => $name );
+
 	} else {
-		my $moby = MOBY::Client::Central->new();
-        my ( @URIS ) = $moby->retrieveServiceProviders();
-        foreach my $provider (@URIS) {
-                my ( $instances, $RegObject ) =
-                        $moby->findService( authURI => $provider );
-                push @$services, @$instances;
-        }
+		my (@URIS) = $moby->retrieveServiceProviders();
+		foreach my $provider (@URIS) {
+			my ( $instances, $RegObject ) =
+			  $moby->findService( authURI => $provider );
+			push @$services, @$instances;
+		}
 
 	}
 	my $xml = $self->_createRDFModel( \@$services );
@@ -160,26 +181,26 @@
 	my $storage      = new RDF::Core::Storage::Memory;
 	my $model        = new RDF::Core::Model( Storage => $storage );
 	my $node_factory = new RDF::Core::NodeFactory();
-	
+
 	foreach my $SI (@$services) {
 		my $resource =
 		  new RDF::Core::Resource( $self->{uri},
-			$SI->authority . "," . $SI->name );
+								   $SI->authority . "," . $SI->name );
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new( MOBY::RDF::Predicates::RDF->type ),
-				new RDF::Core::Resource(
-					MOBY::RDF::Predicates::FETA->serviceDescription
-				)
-			)
+						 new RDF::Core::Statement(
+							 $resource,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+								 MOBY::RDF::Predicates::FETA->serviceDescription
+							 )
+						 )
 		);
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new( MOBY::RDF::Predicates::DC_PROTEGE->format ),
-				new RDF::Core::Literal( $SI->category )
-			)
+				new RDF::Core::Statement(
+					$resource,
+					$resource->new( MOBY::RDF::Predicates::DC_PROTEGE->format ),
+					new RDF::Core::Literal( $SI->category )
+				)
 		);
 		$model->addStmt(
 			new RDF::Core::Statement(
@@ -189,257 +210,260 @@
 			)
 		);
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new( MOBY::RDF::Predicates::FETA->locationURI ),
-				new RDF::Core::Literal( $SI->URL )
-			)
-		);
-		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new(
-					MOBY::RDF::Predicates::FETA->hasServiceDescriptionText
-				),
-				new RDF::Core::Literal( $SI->description )
-			)
-		);
-		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new(
-					MOBY::RDF::Predicates::FETA->hasServiceDescriptionLocation
-				),
-				new RDF::Core::Literal( $SI->signatureURL )
-			)
+				 new RDF::Core::Statement(
+					 $resource,
+					 $resource->new( MOBY::RDF::Predicates::FETA->locationURI ),
+					 new RDF::Core::Literal( $SI->URL )
+				 )
+		);
+		$model->addStmt(
+				  new RDF::Core::Statement(
+					  $resource,
+					  $resource->new(
+						  MOBY::RDF::Predicates::FETA->hasServiceDescriptionText
+					  ),
+					  new RDF::Core::Literal( $SI->description )
+				  )
+		);
+		$model->addStmt(
+			  new RDF::Core::Statement(
+				  $resource,
+				  $resource->new(
+					  MOBY::RDF::Predicates::FETA->hasServiceDescriptionLocation
+				  ),
+				  new RDF::Core::Literal( $SI->signatureURL )
+			  )
 		);
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new(
-					MOBY::RDF::Predicates::FETA->hasServiceNameText
-				),
-				new RDF::Core::Literal( $SI->name )
-			)
+						 new RDF::Core::Statement(
+							 $resource,
+							 $resource->new(
+								 MOBY::RDF::Predicates::FETA->hasServiceNameText
+							 ),
+							 new RDF::Core::Literal( $SI->name )
+						 )
 		);
 
 		# TODO get this value!
-		if ($self->{is_alive_path}) {
+		if ( -e $self->{is_alive_path} ) {
 			my $parser = XML::LibXML->new();
-			my $doc = $parser->parse_file($self->{is_alive_path} . '/isAliveStats.xml');
-			my $value = "true";
-			my $id = $SI->authority . "," .  $SI->name;
+			my $doc    =
+			  $parser->parse_file(
+								 $self->{is_alive_path} . '/isAliveStats.xml' );
+			my $value    = "true";
+			my $id       = $SI->authority . "," . $SI->name;
 			my @nodelist = $doc->getElementsByTagName("service");
 			for my $node (@nodelist) {
-				next unless ($node->getAttribute( 'id' ) eq $id );
+				next unless ( $node->getAttribute('id') eq $id );
 				$value = $node->textContent;
 				last;
 			}
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$resource,
-					$resource->new( MOBY::RDF::Predicates::FETA->isAlive ),
-					new RDF::Core::Literal($value)
-				)
+					 new RDF::Core::Statement(
+						 $resource,
+						 $resource->new( MOBY::RDF::Predicates::FETA->isAlive ),
+						 new RDF::Core::Literal($value)
+					 )
 			);
 		} else {
+
 			# by default, state the service is alive ...
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$resource,
-					$resource->new( MOBY::RDF::Predicates::FETA->isAlive ),
-					new RDF::Core::Literal('true')
-				)
+					 new RDF::Core::Statement(
+						 $resource,
+						 $resource->new( MOBY::RDF::Predicates::FETA->isAlive ),
+						 new RDF::Core::Literal('true')
+					 )
 			);
 		}
 
 		# add the authoring statements
 		my $bnode = $node_factory->newResource;
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new( MOBY::RDF::Predicates::FETA->providedBy ),
-				$bnode
-			)
-		);
-		$model->addStmt(
-			new RDF::Core::Statement(
-				$bnode,
-				$resource->new( MOBY::RDF::Predicates::FETA->authoritative ),
-				new RDF::Core::Literal(
-					$SI->authoritative == 0 ? "false" : "true"
-				)
-			)
-		);
-		$model->addStmt(
-			new RDF::Core::Statement(
-				$bnode,
-				$resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ),
-				new RDF::Core::Literal( $SI->contactEmail )
-			)
-		);
-		$model->addStmt(
-			new RDF::Core::Statement(
-				$bnode,
-				$resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ),
-				new RDF::Core::Literal( $SI->authority )
-			)
-		);
-		$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(
+					  $resource,
+					  $resource->new( MOBY::RDF::Predicates::FETA->providedBy ),
+					  $bnode
+				  )
+		);
+		$model->addStmt(
+			   new RDF::Core::Statement(
+				   $bnode,
+				   $resource->new( MOBY::RDF::Predicates::FETA->authoritative ),
+				   new RDF::Core::Literal(
+									  $SI->authoritative == 0 ? "false" : "true"
+				   )
+			   )
+		);
+		$model->addStmt(
+			   new RDF::Core::Statement(
+				   $bnode,
+				   $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->creator ),
+				   new RDF::Core::Literal( $SI->contactEmail )
+			   )
+		);
+		$model->addStmt(
+			 new RDF::Core::Statement(
+				 $bnode,
+				 $resource->new( MOBY::RDF::Predicates::DC_PROTEGE->publisher ),
+				 new RDF::Core::Literal( $SI->authority )
+			 )
+		);
+		$model->addStmt(
+						 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;
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$resource,
-				$resource->new( MOBY::RDF::Predicates::FETA->hasOperation ),
-				$operation
-			)
-		);
-		$model->addStmt(
-			new RDF::Core::Statement(
-				$operation,
-				$resource->new(
-					MOBY::RDF::Predicates::FETA->hasOperationNameText
-				),
-				new RDF::Core::Literal( $SI->name )
-			)
+				new RDF::Core::Statement(
+					$resource,
+					$resource->new( MOBY::RDF::Predicates::FETA->hasOperation ),
+					$operation
+				)
 		);
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$operation,
-				$resource->new( MOBY::RDF::Predicates::RDF->type ),
-				new RDF::Core::Resource(
-					MOBY::RDF::Predicates::FETA->operation )
-			)
+					   new RDF::Core::Statement(
+						   $operation,
+						   $resource->new(
+							   MOBY::RDF::Predicates::FETA->hasOperationNameText
+						   ),
+						   new RDF::Core::Literal( $SI->name )
+					   )
+		);
+		$model->addStmt(
+						 new RDF::Core::Statement(
+							 $operation,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+										MOBY::RDF::Predicates::FETA->operation )
+						 )
 		);
 		$bnode = $node_factory->newResource;
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$operation,
-				$resource->new( MOBY::RDF::Predicates::FETA->performsTask ),
-				$bnode
-			)
-		);
-		$model->addStmt(
-			new RDF::Core::Statement(
-				$bnode,
-				$resource->new( MOBY::RDF::Predicates::RDF->type ),
-				new RDF::Core::Resource(
-					MOBY::RDF::Predicates::FETA->operationTask
+				new RDF::Core::Statement(
+					$operation,
+					$resource->new( MOBY::RDF::Predicates::FETA->performsTask ),
+					$bnode
 				)
-			)
 		);
 		$model->addStmt(
-			new RDF::Core::Statement(
-				$bnode,
-				$resource->new( MOBY::RDF::Predicates::RDF->type ),
-				new RDF::Core::Resource(
-					"http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type
-				)
-			)
+						 new RDF::Core::Statement(
+							 $bnode,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+									  MOBY::RDF::Predicates::FETA->operationTask
+							 )
+						 )
+		);
+		$model->addStmt(
+			 new RDF::Core::Statement(
+				 $bnode,
+				 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+				 new RDF::Core::Resource(
+					 "http://biomoby.org/RESOURCES/MOBY-S/Services#" . $SI->type
+				 )
+			 )
 		);
 
 		my $inputs = $SI->input;
 		foreach (@$inputs) {
 			my $inputParameter = $node_factory->newResource;
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$operation,
-					$resource->new(
-						MOBY::RDF::Predicates::FETA->inputParameter
-					),
-					$inputParameter
-				)
+							 new RDF::Core::Statement(
+								 $operation,
+								 $resource->new(
+									 MOBY::RDF::Predicates::FETA->inputParameter
+								 ),
+								 $inputParameter
+							 )
 			);
 			if ( $_->isSimple ) {
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$inputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterNameText
-						),
-						new RDF::Core::Literal( $_->articleName )
-					)
-				);
-				$model->addStmt(
-					new RDF::Core::Statement(
-						$inputParameter,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->parameter
-						)
-					)
+					   new RDF::Core::Statement(
+						   $inputParameter,
+						   $resource->new(
+							   MOBY::RDF::Predicates::FETA->hasParameterNameText
+						   ),
+						   new RDF::Core::Literal( $_->articleName )
+					   )
+				);
+				$model->addStmt(
+						 new RDF::Core::Statement(
+							 $inputParameter,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+										  MOBY::RDF::Predicates::FETA->parameter
+							 )
+						 )
 				);
 
 				my $oType = $node_factory->newResource;
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$inputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->objectType
-						),
-						$oType
-					)
+								 new RDF::Core::Statement(
+									 $inputParameter,
+									 $resource->new(
+										 MOBY::RDF::Predicates::FETA->objectType
+									 ),
+									 $oType
+								 )
 				);
 				$model->addStmt(
 					new RDF::Core::Statement(
 						$oType,
 						$resource->new( MOBY::RDF::Predicates::RDF->type ),
 						new RDF::Core::Resource(
-							"http://biomoby.org/RESOURCES/MOBY-S/Objects#"
-							  . $_->objectType
+								  "http://biomoby.org/RESOURCES/MOBY-S/Objects#"
+									. $_->objectType
 						  )    #TODO check for lsid
 					)
 				);
 
 				my $pType = $node_factory->newResource;
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$inputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterType
-						),
-						$pType
-					)
-				);
-				$model->addStmt(
-					new RDF::Core::Statement(
-						$pType,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->simpleParameter
-						)
-					)
+						   new RDF::Core::Statement(
+							   $inputParameter,
+							   $resource->new(
+								   MOBY::RDF::Predicates::FETA->hasParameterType
+							   ),
+							   $pType
+						   )
+				);
+				$model->addStmt(
+						 new RDF::Core::Statement(
+							 $pType,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+									MOBY::RDF::Predicates::FETA->simpleParameter
+							 )
+						 )
 				);
 				my $namespaces = $_->namespaces;
 				foreach my $n (@$namespaces) {
 					my $inNamespaces = $node_factory->newResource;
 					$model->addStmt(
-						new RDF::Core::Statement(
-							$inputParameter,
-							$resource->new(
-								MOBY::RDF::Predicates::FETA->inNamespaces
-							),
-							$inNamespaces
-						)
+							   new RDF::Core::Statement(
+								   $inputParameter,
+								   $resource->new(
+									   MOBY::RDF::Predicates::FETA->inNamespaces
+								   ),
+								   $inNamespaces
+							   )
 					);
 					$model->addStmt(
-						new RDF::Core::Statement(
-							$inNamespaces,
-							$resource->new( MOBY::RDF::Predicates::RDF->type ),
-							new RDF::Core::Resource(
-								MOBY::RDF::Predicates::FETA->parameterNamespace
-							)
-						)
+						 new RDF::Core::Statement(
+							 $inNamespaces,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+								 MOBY::RDF::Predicates::FETA->parameterNamespace
+							 )
+						 )
 					);
 					$model->addStmt(
 						new RDF::Core::Statement(
@@ -452,67 +476,66 @@
 						)
 					);
 				}
-			}
-			elsif ( $_->isCollection ) {
+			} elsif ( $_->isCollection ) {
 
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$inputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterNameText
-						),
-						new RDF::Core::Literal( $_->articleName )
-					)
-				);
-				$model->addStmt(
-					new RDF::Core::Statement(
-						$inputParameter,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->parameter
-						)
-					)
+					   new RDF::Core::Statement(
+						   $inputParameter,
+						   $resource->new(
+							   MOBY::RDF::Predicates::FETA->hasParameterNameText
+						   ),
+						   new RDF::Core::Literal( $_->articleName )
+					   )
+				);
+				$model->addStmt(
+						 new RDF::Core::Statement(
+							 $inputParameter,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+										  MOBY::RDF::Predicates::FETA->parameter
+							 )
+						 )
 				);
 
 				my $pType = $node_factory->newResource;
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$inputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterType
-						),
-						$pType
-					)
+						   new RDF::Core::Statement(
+							   $inputParameter,
+							   $resource->new(
+								   MOBY::RDF::Predicates::FETA->hasParameterType
+							   ),
+							   $pType
+						   )
 				);
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$pType,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->collectionParameter
+						new RDF::Core::Statement(
+							$pType,
+							$resource->new( MOBY::RDF::Predicates::RDF->type ),
+							new RDF::Core::Resource(
+								MOBY::RDF::Predicates::FETA->collectionParameter
+							)
 						)
-					)
 				);
 
 				my $simples = $_->Simples;
 				foreach my $simp (@$simples) {
 					my $oType = $node_factory->newResource;
 					$model->addStmt(
-						new RDF::Core::Statement(
-							$inputParameter,
-							$resource->new(
-								MOBY::RDF::Predicates::FETA->objectType
-							),
-							$oType
-						)
+								 new RDF::Core::Statement(
+									 $inputParameter,
+									 $resource->new(
+										 MOBY::RDF::Predicates::FETA->objectType
+									 ),
+									 $oType
+								 )
 					);
 					$model->addStmt(
 						new RDF::Core::Statement(
 							$oType,
 							$resource->new( MOBY::RDF::Predicates::RDF->type ),
 							new RDF::Core::Resource(
-								"http://biomoby.org/RESOURCES/MOBY-S/Objects#"
-								  . $simp->objectType
+								  "http://biomoby.org/RESOURCES/MOBY-S/Objects#"
+									. $simp->objectType
 							  )    #TODO check for lsid
 						)
 					);
@@ -520,31 +543,31 @@
 					foreach my $n (@$namespaces) {
 						my $inNamespaces = $node_factory->newResource;
 						$model->addStmt(
-							new RDF::Core::Statement(
-								$inputParameter,
-								$resource->new(
-									MOBY::RDF::Predicates::FETA->inNamespaces
-								),
-								$inNamespaces
-							)
+							   new RDF::Core::Statement(
+								   $inputParameter,
+								   $resource->new(
+									   MOBY::RDF::Predicates::FETA->inNamespaces
+								   ),
+								   $inNamespaces
+							   )
 						);
 						$model->addStmt(
-							new RDF::Core::Statement(
-								$inNamespaces,
-								$resource->new(
-									MOBY::RDF::Predicates::RDF->type
-								),
-								new RDF::Core::Resource(
-									MOBY::RDF::Predicates::FETA
-									  ->parameterNamespace
-								)
-							)
+										new RDF::Core::Statement(
+											$inNamespaces,
+											$resource->new(
+												MOBY::RDF::Predicates::RDF->type
+											),
+											new RDF::Core::Resource(
+													 MOBY::RDF::Predicates::FETA
+													   ->parameterNamespace
+											)
+										)
 						);
 						$model->addStmt(
 							new RDF::Core::Statement(
 								$inNamespaces,
 								$resource->new(
-									MOBY::RDF::Predicates::RDF->type
+												MOBY::RDF::Predicates::RDF->type
 								),
 								new RDF::Core::Resource(
 "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"
@@ -563,69 +586,69 @@
 			next unless $_->isSecondary;
 			my $inputParameter = $node_factory->newResource;
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$operation,
-					$resource->new(
-						MOBY::RDF::Predicates::FETA->inputParameter
-					),
-					$inputParameter
-				)
-			);
-			$model->addStmt(
-				new RDF::Core::Statement(
-					$inputParameter,
-					$resource->new( MOBY::RDF::Predicates::RDF->type ),
-					new RDF::Core::Resource(
-						MOBY::RDF::Predicates::FETA->parameter
-					)
-				)
+							 new RDF::Core::Statement(
+								 $operation,
+								 $resource->new(
+									 MOBY::RDF::Predicates::FETA->inputParameter
+								 ),
+								 $inputParameter
+							 )
+			);
+			$model->addStmt(
+						 new RDF::Core::Statement(
+							 $inputParameter,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+										  MOBY::RDF::Predicates::FETA->parameter
+							 )
+						 )
 			);
 
 			my $pType = $node_factory->newResource;
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$inputParameter,
-					$resource->new(
-						MOBY::RDF::Predicates::FETA->hasParameterType
-					),
-					$pType
-				)
-			);
-			$model->addStmt(
-				new RDF::Core::Statement(
-					$pType,
-					$resource->new( MOBY::RDF::Predicates::RDF->type ),
-					new RDF::Core::Resource(
-						MOBY::RDF::Predicates::FETA->secondaryParameter
-					)
-				)
+						   new RDF::Core::Statement(
+							   $inputParameter,
+							   $resource->new(
+								   MOBY::RDF::Predicates::FETA->hasParameterType
+							   ),
+							   $pType
+						   )
+			);
+			$model->addStmt(
+						 new RDF::Core::Statement(
+							 $pType,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+								 MOBY::RDF::Predicates::FETA->secondaryParameter
+							 )
+						 )
 			);
 
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$inputParameter,
-					$resource->new(
-						MOBY::RDF::Predicates::FETA->hasParameterNameText
-					),
-					new RDF::Core::Literal( $_->articleName )
-				)
+					   new RDF::Core::Statement(
+						   $inputParameter,
+						   $resource->new(
+							   MOBY::RDF::Predicates::FETA->hasParameterNameText
+						   ),
+						   new RDF::Core::Literal( $_->articleName )
+					   )
 			);
 
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$inputParameter,
-					$resource->new( MOBY::RDF::Predicates::FETA->min ),
-					new RDF::Core::Literal( $_->min )
-				)
+						 new RDF::Core::Statement(
+							 $inputParameter,
+							 $resource->new( MOBY::RDF::Predicates::FETA->min ),
+							 new RDF::Core::Literal( $_->min )
+						 )
 			  )
 			  if defined( $_->min );
 
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$inputParameter,
-					$resource->new( MOBY::RDF::Predicates::FETA->max ),
-					new RDF::Core::Literal( $_->max )
-				)
+						 new RDF::Core::Statement(
+							 $inputParameter,
+							 $resource->new( MOBY::RDF::Predicates::FETA->max ),
+							 new RDF::Core::Literal( $_->max )
+						 )
 			  )
 			  if defined( $_->max );
 
@@ -640,30 +663,30 @@
 			);
 
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$inputParameter,
-					$resource->new(
-						MOBY::RDF::Predicates::FETA->hasDefaultValue
-					),
-					new RDF::Core::Literal( $_->default )
-				)
+							new RDF::Core::Statement(
+								$inputParameter,
+								$resource->new(
+									MOBY::RDF::Predicates::FETA->hasDefaultValue
+								),
+								new RDF::Core::Literal( $_->default )
+							)
 			  )
 			  if defined( $_->default );
 
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$inputParameter,
-					$resource->new( MOBY::RDF::Predicates::FETA->datatype ),
-					new RDF::Core::Literal( $_->datatype )
-				)
-			);
-			foreach my $e ( @{ $_->enum } ) {
-				$model->addStmt(
 					new RDF::Core::Statement(
 						$inputParameter,
-						$resource->new( MOBY::RDF::Predicates::FETA->enum ),
-						new RDF::Core::Literal($e)
+						$resource->new( MOBY::RDF::Predicates::FETA->datatype ),
+						new RDF::Core::Literal( $_->datatype )
 					)
+			);
+			foreach my $e ( @{ $_->enum } ) {
+				$model->addStmt(
+						new RDF::Core::Statement(
+							$inputParameter,
+							$resource->new( MOBY::RDF::Predicates::FETA->enum ),
+							new RDF::Core::Literal($e)
+						)
 				);
 			}
 		}
@@ -672,94 +695,94 @@
 		foreach (@$outputs) {
 			my $outputParameter = $node_factory->newResource;
 			$model->addStmt(
-				new RDF::Core::Statement(
-					$operation,
-					$resource->new(
-						MOBY::RDF::Predicates::FETA->outputParameter
-					),
-					$outputParameter
-				)
+							new RDF::Core::Statement(
+								$operation,
+								$resource->new(
+									MOBY::RDF::Predicates::FETA->outputParameter
+								),
+								$outputParameter
+							)
 			);
 			if ( $_->isSimple ) {
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$outputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterNameText
-						),
-						new RDF::Core::Literal( $_->articleName )
-					)
-				);
-				$model->addStmt(
-					new RDF::Core::Statement(
-						$outputParameter,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->parameter
-						)
-					)
+					   new RDF::Core::Statement(
+						   $outputParameter,
+						   $resource->new(
+							   MOBY::RDF::Predicates::FETA->hasParameterNameText
+						   ),
+						   new RDF::Core::Literal( $_->articleName )
+					   )
+				);
+				$model->addStmt(
+						 new RDF::Core::Statement(
+							 $outputParameter,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+										  MOBY::RDF::Predicates::FETA->parameter
+							 )
+						 )
 				);
 
 				my $oType = $node_factory->newResource;
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$outputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->objectType
-						),
-						$oType
-					)
+								 new RDF::Core::Statement(
+									 $outputParameter,
+									 $resource->new(
+										 MOBY::RDF::Predicates::FETA->objectType
+									 ),
+									 $oType
+								 )
 				);
 				$model->addStmt(
 					new RDF::Core::Statement(
 						$oType,
 						$resource->new( MOBY::RDF::Predicates::RDF->type ),
 						new RDF::Core::Resource(
-							"http://biomoby.org/RESOURCES/MOBY-S/Objects#"
-							  . $_->objectType
+								  "http://biomoby.org/RESOURCES/MOBY-S/Objects#"
+									. $_->objectType
 						  )    #TODO check for lsid
 					)
 				);
 
 				my $pType = $node_factory->newResource;
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$outputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterType
-						),
-						$pType
-					)
-				);
-				$model->addStmt(
-					new RDF::Core::Statement(
-						$pType,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->simpleParameter
-						)
-					)
+						   new RDF::Core::Statement(
+							   $outputParameter,
+							   $resource->new(
+								   MOBY::RDF::Predicates::FETA->hasParameterType
+							   ),
+							   $pType
+						   )
+				);
+				$model->addStmt(
+						 new RDF::Core::Statement(
+							 $pType,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+									MOBY::RDF::Predicates::FETA->simpleParameter
+							 )
+						 )
 				);
 				my $namespaces = $_->namespaces;
 				foreach my $n (@$namespaces) {
 					my $inNamespaces = $node_factory->newResource;
 					$model->addStmt(
-						new RDF::Core::Statement(
-							$outputParameter,
-							$resource->new(
-								MOBY::RDF::Predicates::FETA->inNamespaces
-							),
-							$inNamespaces
-						)
+							   new RDF::Core::Statement(
+								   $outputParameter,
+								   $resource->new(
+									   MOBY::RDF::Predicates::FETA->inNamespaces
+								   ),
+								   $inNamespaces
+							   )
 					);
 					$model->addStmt(
-						new RDF::Core::Statement(
-							$inNamespaces,
-							$resource->new( MOBY::RDF::Predicates::RDF->type ),
-							new RDF::Core::Resource(
-								MOBY::RDF::Predicates::FETA->parameterNamespace
-							)
-						)
+						 new RDF::Core::Statement(
+							 $inNamespaces,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+								 MOBY::RDF::Predicates::FETA->parameterNamespace
+							 )
+						 )
 					);
 					$model->addStmt(
 						new RDF::Core::Statement(
@@ -772,67 +795,66 @@
 						)
 					);
 				}
-			}
-			elsif ( $_->isCollection ) {
+			} elsif ( $_->isCollection ) {
 
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$outputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterNameText
-						),
-						new RDF::Core::Literal( $_->articleName )
-					)
-				);
-				$model->addStmt(
-					new RDF::Core::Statement(
-						$outputParameter,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->parameter
-						)
-					)
+					   new RDF::Core::Statement(
+						   $outputParameter,
+						   $resource->new(
+							   MOBY::RDF::Predicates::FETA->hasParameterNameText
+						   ),
+						   new RDF::Core::Literal( $_->articleName )
+					   )
+				);
+				$model->addStmt(
+						 new RDF::Core::Statement(
+							 $outputParameter,
+							 $resource->new( MOBY::RDF::Predicates::RDF->type ),
+							 new RDF::Core::Resource(
+										  MOBY::RDF::Predicates::FETA->parameter
+							 )
+						 )
 				);
 
 				my $pType = $node_factory->newResource;
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$outputParameter,
-						$resource->new(
-							MOBY::RDF::Predicates::FETA->hasParameterType
-						),
-						$pType
-					)
+						   new RDF::Core::Statement(
+							   $outputParameter,
+							   $resource->new(
+								   MOBY::RDF::Predicates::FETA->hasParameterType
+							   ),
+							   $pType
+						   )
 				);
 				$model->addStmt(
-					new RDF::Core::Statement(
-						$pType,
-						$resource->new( MOBY::RDF::Predicates::RDF->type ),
-						new RDF::Core::Resource(
-							MOBY::RDF::Predicates::FETA->collectionParameter
+						new RDF::Core::Statement(
+							$pType,
+							$resource->new( MOBY::RDF::Predicates::RDF->type ),
+							new RDF::Core::Resource(
+								MOBY::RDF::Predicates::FETA->collectionParameter
+							)
 						)
-					)
 				);
 
 				my $simples = $_->Simples;
 				foreach my $simp (@$simples) {
 					my $oType = $node_factory->newResource;
 					$model->addStmt(
-						new RDF::Core::Statement(
-							$outputParameter,
-							$resource->new(
-								MOBY::RDF::Predicates::FETA->objectType
-							),
-							$oType
-						)
+								 new RDF::Core::Statement(
+									 $outputParameter,
+									 $resource->new(
+										 MOBY::RDF::Predicates::FETA->objectType
+									 ),
+									 $oType
+								 )
 					);
 					$model->addStmt(
 						new RDF::Core::Statement(
 							$oType,
 							$resource->new( MOBY::RDF::Predicates::RDF->type ),
 							new RDF::Core::Resource(
-								"http://biomoby.org/RESOURCES/MOBY-S/Objects#"
-								  . $simp->objectType
+								  "http://biomoby.org/RESOURCES/MOBY-S/Objects#"
+									. $simp->objectType
 							  )    #TODO check for lsid
 						)
 					);
@@ -840,31 +862,31 @@
 					foreach my $n (@$namespaces) {
 						my $inNamespaces = $node_factory->newResource;
 						$model->addStmt(
-							new RDF::Core::Statement(
-								$outputParameter,
-								$resource->new(
-									MOBY::RDF::Predicates::FETA->inNamespaces
-								),
-								$inNamespaces
-							)
+							   new RDF::Core::Statement(
+								   $outputParameter,
+								   $resource->new(
+									   MOBY::RDF::Predicates::FETA->inNamespaces
+								   ),
+								   $inNamespaces
+							   )
 						);
 						$model->addStmt(
-							new RDF::Core::Statement(
-								$inNamespaces,
-								$resource->new(
-									MOBY::RDF::Predicates::RDF->type
-								),
-								new RDF::Core::Resource(
-									MOBY::RDF::Predicates::FETA
-									  ->parameterNamespace
-								)
-							)
+										new RDF::Core::Statement(
+											$inNamespaces,
+											$resource->new(
+												MOBY::RDF::Predicates::RDF->type
+											),
+											new RDF::Core::Resource(
+													 MOBY::RDF::Predicates::FETA
+													   ->parameterNamespace
+											)
+										)
 						);
 						$model->addStmt(
 							new RDF::Core::Statement(
 								$inNamespaces,
 								$resource->new(
-									MOBY::RDF::Predicates::RDF->type
+												MOBY::RDF::Predicates::RDF->type
 								),
 								new RDF::Core::Resource(
 "http://biomoby.org/RESOURCES/MOBY-S/Namespaces#"
@@ -877,11 +899,11 @@
 			}
 		}
 	}
-	my $xml        = '';
+	my $xml = '';
 	my $serializer = new RDF::Core::Model::Serializer(
-		Model   => $model,
-		Output  => \$xml,
-		BaseURI => 'URI://BASE/',
+													   Model   => $model,
+													   Output  => \$xml,
+													   BaseURI => 'URI://BASE/',
 	);
 	$serializer->serialize;
 	return $xml;




More information about the MOBY-guts mailing list