[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Thu Jun 5 14:13:05 UTC 2008


kawas
Thu Jun  5 10:13:04 EDT 2008
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Cache
In directory dev.open-bio.org:/tmp/cvs-serv5317/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Cache

Modified Files:
	ServiceCache.pm 
Log Message:
Fixed bug in the service instance cache code. Services from service  providers with other registered services was not updating itself  correctly.
Modified the call that gets the service providers to reduce the bandwidth used when making the call. We use to get all services names and providers and now we get only service providers.
moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Cache ServiceCache.pm,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Cache/ServiceCache.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Cache/ServiceCache.pm	2008/04/30 16:53:36	1.3
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/RDF/Ontologies/Cache/ServiceCache.pm	2008/06/05 14:13:04	1.4
@@ -241,7 +241,7 @@
 	}
 
 	# steps:
-	# read in the LIST file and extract lsids for all datatypes
+	# read in the LIST file and extract lsids for all services
 	my $file = File::Spec->catfile(
 							$self->{utils}->cachedir,
 							$self->{utils}->_clean( $self->{utils}->_endpoint ),
@@ -287,17 +287,27 @@
 		$new_services{$name}{$lsid} = 1;
 	}
 
-# go through the keys of the new one and if the keys doesnt exist or has been modified, add to 'download' queue
+    # go through the keys of the new one and if the keys doesnt exist or has been modified, add to 'download' queue
 	foreach my $auth ( keys %new_services ) {
 		next if $changed_services{$auth};
 		foreach my $lsid ( keys %{ $new_services{$auth} } ) {
-			next unless !$old_services{$auth}{$lsid};
-			$changed_services{$auth} = 1;
+			$changed_services{$auth} = 1 unless $old_services{$auth}{$lsid};
+			delete $old_services{$auth}{$lsid} if $old_services{$auth}{$lsid};
+			
 		}
-
 	}
 
-   # if their where changes, save new LIST file over the old one and get changes
+	# iterate over old_services and add their authority to changed_services
+	# old services should only have authorities with services that have been removed 
+	foreach my $auth ( keys %old_services ) {
+		next if $changed_services{$auth};
+		foreach my $lsid ( keys %{ $old_services{$auth} } ) {
+			next if $changed_services{$auth};
+			$changed_services{$auth} = 1;
+		}
+	}
+	
+    # if their where changes, save new LIST file over the old one and get changes
 	if ( keys %changed_services ) {
 
 		# save new LIST file
@@ -351,7 +361,7 @@
 			  	or $filename eq $self->{utils}->UPDATE_FILE;
 			  	
 			unlink($path) unless $new_services{$filename};
-			$wasOld++;
+			$wasOld++ unless $new_services{$filename};
 		}
 	};
 	return $wasOld;
@@ -486,14 +496,14 @@
 		}
 	  );
 
-	my $xml = $soap->retrieveServiceNames()->result;
+	my $xml = $soap->retrieveServiceProviders()->result;
 	my %providers = ();
 	
 	my $parser                = XML::LibXML->new();
 	my $doc                   = $parser->parse_string($xml);
-	my $nodes = $doc->documentElement()->getChildrenByTagName('serviceName');
+	my $nodes = $doc->documentElement()->getChildrenByTagName('serviceProvider');
 	for ( 1 .. $nodes->size() ) {
-		my $name = $nodes->get_node($_)->getAttribute('authURI');
+		my $name = $nodes->get_node($_)->getAttribute('name');
 		next if $providers{$name};
 		$providers{$name} = 1;
 	}




More information about the MOBY-guts mailing list