[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Thu Aug 23 17:48:29 UTC 2007


kawas
Thu Aug 23 13:48:28 EDT 2007
Update of /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies
In directory dev.open-bio.org:/tmp/cvs-serv27425/RDF/Ontologies

Modified Files:
	Services.pm 
Log Message:
added the isAlive information
moby-live/Perl/MOBY/RDF/Ontologies Services.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm	2007/07/19 19:38:11	1.3
+++ /home/repository/moby/moby-live/Perl/MOBY/RDF/Ontologies/Services.pm	2007/08/23 17:48:28	1.4
@@ -16,6 +16,8 @@
 use RDF::Core::Model::Serializer;
 use RDF::Core::NodeFactory;
 
+use XML::LibXML;
+
 use MOBY::Client::Central;
 
 use MOBY::RDF::Predicates::DC_PROTEGE;
@@ -90,6 +92,7 @@
 	$self->{uri}       = $CONF->{mobycentral}->{resourceURL} || 'http://biomoby.org/RESOURCES/MOBY-S/ServiceInstances#';
 	$self->{uri} = $self->{uri} . "#" unless $self->{uri} =~ m/^.*(\#{1})$/;
 
+	$self->{is_alive_path} = $CONF->{mobycentral}->{service_tester_path};
 	# done
 	return $self;
 }
@@ -207,13 +210,34 @@
 		);
 
 		# TODO get this value!
-#		$model->addStmt(
-#			new RDF::Core::Statement(
-#				$resource,
-#				$resource->new( MOBY::RDF::Predicates::FETA->isAlive ),
-#				new RDF::Core::Literal("true")
-#			)
-#		);
+		if ($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 @nodelist = $doc->getElementsByTagName("service");
+			for my $node (@nodelist) {
+				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)
+				)
+			);
+		} 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')
+				)
+			);
+		}
 
 		# add the authoring statements
 		my $bnode = $node_factory->newResource;




More information about the MOBY-guts mailing list