[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Thu Mar 6 23:18:32 UTC 2008


kawas
Thu Mar  6 18:18:32 EST 2008
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi
In directory dev.open-bio.org:/tmp/cvs-serv29880/Perl/MOBY-Server/share/cgi

Modified Files:
	RESOURCES 
Log Message:
added support for FULL
moby-live/Perl/MOBY-Server/share/cgi RESOURCES,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/RESOURCES,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/RESOURCES	2008/02/21 00:21:27	1.1
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/RESOURCES	2008/03/06 23:18:32	1.2
@@ -35,6 +35,8 @@
 use MOBY::RDF::Ontologies::Cache::ServiceTypeCache;
 use MOBY::Config;
 
+use XML::LibXML;
+
 # your cache dir
 my $dir = MOBY::Config->new->{mobycentral}->{rdf_cache} || "/tmp/";
 
@@ -119,15 +121,16 @@
 		} unless $x;
 	} unless $string;
 	do {
-		my $x = MOBY::RDF::Ontologies::Services->new;    
-		my $sname = substr ($string, index($string, ',')+1);
-        my $prov  = substr ($string, 1, index($string, ',')-1);
+		my $x     = MOBY::RDF::Ontologies::Services->new;
+		my $sname = substr( $string, index( $string, ',' ) + 1 );
+		my $prov  = substr( $string, 1, index( $string, ',' ) - 1 );
+
 		# get pretty printed RDF/XML for one service
 		$x = $x->findService(
-						   {
-							 serviceName => $sname,
-							 authURI     =>  $prov,
-						   }
+							  {
+								serviceName => $sname,
+								authURI     => $prov,
+							  }
 		);
 		print $form->header('text/xml'), $x if $x;
 	} if $string;
@@ -152,11 +155,86 @@
 		print $form->header('text/xml'), $rdf if $rdf;
 	} if $1;
 } elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/FULL$/ ) {
+	my $dom    = undef;
+	my $parser = XML::LibXML->new();
 
-	print $form->header('text/html');
-	$form->start_html( -title => 'unavailable', );
-	print h2( "not", "implemented" );
-	print end_html;
+	# print this right away, because this might take a long time ...
+	print $form->header('text/xml');
+	if ($useCache) {
+		my $x =
+		  MOBY::RDF::Ontologies::Cache::NamespaceCache->new( cache => "$dir", );
+		$x = $x->get_rdf();
+		do {
+			my $doc = $parser->parse_string($x);
+			$dom = $doc;
+
+		} if $x;
+		$x =
+		  MOBY::RDF::Ontologies::Cache::ServiceTypeCache->new( cache => "$dir",
+		  );
+		$x = $x->get_rdf();
+		do {
+			my $doc = $parser->parse_string($x);
+			_appendChildrenOfDOMToOtherDOM( $doc, \$dom ) if $dom;
+			$dom = $doc unless $dom;
+		} if $x;
+		$x = MOBY::RDF::Ontologies::Cache::ObjectCache->new( cache => "$dir", );
+		$x = $x->get_rdf();
+		do {
+			my $doc = $parser->parse_string($x);
+			_appendChildrenOfDOMToOtherDOM( $doc, \$dom ) if $dom;
+			$dom = $doc unless $dom;
+
+		} if $x;
+		$x =
+		  MOBY::RDF::Ontologies::Cache::ServiceCache->new( cache => "$dir", );
+		$x = $x->get_rdf();
+		do {
+			my $doc = $parser->parse_string($x);
+			_appendChildrenOfDOMToOtherDOM( $doc, \$dom ) if $dom;
+			$dom = $doc unless $dom;
+
+		} if $x;
+
+		# TODO append ServiceDescription too when complete
+		print $dom->toString if $dom;
+
+	} else {
+		my $x = MOBY::RDF::Ontologies::Namespaces->new;
+		$x = $x->createAll();
+		do {
+			my $doc = $parser->parse_string($x);
+			_appendChildrenOfDOMToOtherDOM( $doc, \$dom ) if $dom;
+			$dom = $doc unless $dom;
+		} if $x;
+		
+		$x = MOBY::RDF::Ontologies::Objects->new;
+		$x = $x->createAll();
+		do {
+			my $doc = $parser->parse_string($x);
+			_appendChildrenOfDOMToOtherDOM( $doc, \$dom ) if $dom;
+			$dom = $doc unless $dom;
+		} if $x;
+		
+		$x = MOBY::RDF::Ontologies::ServiceTypes->new;
+		$x = $x->createAll();
+		do {
+			my $doc = $parser->parse_string($x);
+			_appendChildrenOfDOMToOtherDOM( $doc, \$dom ) if $dom;
+			$dom = $doc unless $dom;
+		} if $x;
+		
+		$x = MOBY::RDF::Ontologies::Services->new;
+		$x = $x->findService();
+		do {
+			my $doc = $parser->parse_string($x);
+			_appendChildrenOfDOMToOtherDOM( $doc, \$dom ) if $dom;
+			$dom = $doc unless $dom;
+		} if $x;
+
+		# TODO append ServiceDescription too when complete
+		print $dom->toString if $dom;
+	}
 
 } elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/ServiceDescription$/ ) {
 	print $form->header('text/html');
@@ -172,3 +250,10 @@
 	print end_html;
 }
 
+sub _appendChildrenOfDOMToOtherDOM {
+	my ( $dom, $other_dom ) = @_;
+	foreach my $service ( $dom->findnodes('/rdf:RDF/rdf:Description') ) {
+		$$other_dom->documentElement->appendChild($service);
+	}
+	return $other_dom;
+}




More information about the MOBY-guts mailing list