[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Mon Dec 17 18:55:23 UTC 2007


kawas
Mon Dec 17 13:55:22 EST 2007
Update of /home/repository/moby/moby-live/Perl/scripts
In directory dev.open-bio.org:/tmp/cvs-serv6800/Perl/scripts

Modified Files:
	RESOURCES 
Log Message:
added caching for all of the ontologies
moby-live/Perl/scripts RESOURCES,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/scripts/RESOURCES,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/scripts/RESOURCES	2007/11/29 19:59:51	1.2
+++ /home/repository/moby/moby-live/Perl/scripts/RESOURCES	2007/12/17 18:55:22	1.3
@@ -7,8 +7,8 @@
 # $Id$
 #
 # NOTES:
-# 	1. This script assumes that a BioMOBY registry is properly 
-#	   installed and that SetEnv commands have been added to 
+# 	1. This script assumes that a BioMOBY registry is properly
+#	   installed and that SetEnv commands have been added to
 #      the servers environment (e.g. httpd.conf)
 #
 #	2. Caching is enabled by default and can be toggled by
@@ -17,7 +17,7 @@
 #      recomended
 #
 #   3. Caching requires that a cache dir be specified and
-#      that the directory is readable by the web server 
+#      that the directory is readable by the web server
 #      process. By default, the cache dir is set to '/tmp/'
 #-----------------------------------------------------------------
 
@@ -30,6 +30,9 @@
 use MOBY::RDF::Ontologies::Namespaces;
 use MOBY::RDF::Ontologies::Services;
 use MOBY::RDF::Ontologies::Cache::ServiceCache;
+use MOBY::RDF::Ontologies::Cache::ObjectCache;
+use MOBY::RDF::Ontologies::Cache::NamespaceCache;
+use MOBY::RDF::Ontologies::Cache::ServiceTypeCache;
 
 # your cache dir
 my $dir = "/tmp/";
@@ -43,17 +46,30 @@
 
 if ( $url =~ m/^RESOURCES\/MOBY\-S\/Objects$/ ) {
 
-	my $x = MOBY::RDF::Ontologies::Objects->new;
-	$x = $x->createAll();
-	print $form->header('text/xml'), $x if $x;
-
+	if ($useCache) {
+		my $x =
+		  MOBY::RDF::Ontologies::Cache::ObjectCache->new( cache => "$dir", );
+		$x = $x->get_rdf();
+		print $form->header('text/xml'), $x if $x;
+	} else {
+		my $x = MOBY::RDF::Ontologies::Objects->new;
+		$x = $x->createAll();
+		print $form->header('text/xml'), $x if $x;
+	}
 } elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Services$/ ) {
-	my $x = MOBY::RDF::Ontologies::ServiceTypes->new;
-	$x = $x->createAll();
-	print $form->header('text/xml'), $x if $x;
-
+	if ($useCache) {
+		my $x =
+		  MOBY::RDF::Ontologies::Cache::ServiceTypeCache->new( cache => "$dir", );
+		$x = $x->get_rdf();
+		print $form->header('text/xml'), $x if $x;
+	} else {
+		my $x = MOBY::RDF::Ontologies::ServiceTypes->new;
+		$x = $x->createAll();
+		print $form->header('text/xml'), $x if $x;
+	}
 } elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/ServiceInstances$/ ) {
 	my $x;
+
 	# shall we use the cache?
 	if ($useCache) {
 		$x =
@@ -61,27 +77,36 @@
 		$x = $x->get_rdf();
 
 	} else {
+
 		# no cache
 		$x = MOBY::RDF::Ontologies::Services->new;
 		$x = $x->findService();
-		
+
 	}
+
 	# output the RDF generated
 	print $form->header('text/xml'), $x if $x;
+
 	# say not implemented if an error occurs
 	do {
-			print $form->header('text/html');
-			$form->start_html( -title => 'unavailable', );
-			print h2( "not", "implemented" );
-			print end_html;
+		print $form->header('text/html');
+		$form->start_html( -title => 'unavailable', );
+		print h2( "not", "implemented" );
+		print end_html;
 	} unless $x;
-	
-} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Namespaces$/ ) {
-
-	my $x = MOBY::RDF::Ontologies::Namespaces->new;
-	$x = $x->createAll();
-	print $form->header('text/xml'), $x if $x;
 
+} elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/Namespaces$/ ) {
+	if ($useCache) {
+		my $x = MOBY::RDF::Ontologies::Cache::NamespaceCache->new( 
+															 cache => "$dir",
+		);
+		$x = $x->get_rdf();
+		print $form->header('text/xml'), $x if $x;
+	} else {
+		my $x = MOBY::RDF::Ontologies::Namespaces->new;
+		$x = $x->createAll();
+		print $form->header('text/xml'), $x if $x;
+	}
 } elsif ( $url =~ m/^RESOURCES\/MOBY\-S\/FULL$/ ) {
 
 	print $form->header('text/html');
@@ -101,5 +126,5 @@
 	$form->start_html( -title => 'not MOBY-S', );
 	print h2( "not", "MOBY-S" );
 	print end_html;
-}    
+}
 




More information about the MOBY-guts mailing list