[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Wed Aug 3 11:28:52 UTC 2005


mwilkinson
Wed Aug  3 07:28:52 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv3751/MOBY

Modified Files:
	Central.pm 
Log Message:
as per Martin's request, there is now a retrieveResourceURLs method in MOBY Central.  See Twiki API documentation (in the next few minutes...), or just make the call with no arguments to see the XML.

moby-live/Perl/MOBY Central.pm,1.198,1.199
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -r1.198 -r1.199
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2005/08/02 15:18:00	1.198
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2005/08/03 11:28:52	1.199
@@ -22,7 +22,7 @@
 use MOBY::secondary_input;
 use MOBY::central_db_connection;
 use MOBY::Config;
-use MOBY::Client::Central;
+#use MOBY::Client::Central;
 
 #use MOBY::RDF::ServiceInstanceRDF;
 #use RDF::Core;
@@ -1205,7 +1205,7 @@
 			my $conf = MOBY::Config->new();
 			my $path = $conf->{mobycentral}->{rdfagent};
 			my $rez  = system( $path. " " . $signatureURL );
-			return &_error(
+			return &_success(
 "The RDFagent call was successful.  Report will send to you by E-mail",
 				""
 			  )
@@ -1229,10 +1229,7 @@
 	  if $AuthURI =~ '[/:]';
 	return &_error( "Malformed authURI - must take the form NNN.NNN.NNN", "" )
 	  unless $AuthURI =~ /\./;
-	return &_error(
-"Malformed email - must be a valid email address of the form name\@organization.foo",
-		""
-	  )
+	return &_error("Malformed email - must be a valid email address of the form name\@organization.foo","")
 	  unless $contactEmail =~ /\S\@\S+\.\S+/;
 	$error .= "missing URL \n"         unless defined $URL;
 	$error .= "missing description \n" unless defined $desc;
@@ -1249,11 +1246,8 @@
 		|| ( $Category eq "moby" )
 	  );
 	$debug && &_LOG("Entering switch with $Category method\n");
-	return &_error(
-"Service categories other than 'moby' and 'wsdl' are not yet implemented",
-		""
-	  )
-	unless ( ( $Category eq "moby" ) || ( $Category eq "wsdl" ) );
+	return &_error("Service categories other than 'moby' and 'wsdl' are not yet implemented","")
+          unless ( ( $Category eq "moby" ) || ( $Category eq "wsdl" ) );
 
 #test the existence of the service
 	return &_error( "This service already exists", "" ) if (MOBY::service_instance->new(
@@ -1437,12 +1431,13 @@
 	# this is a Simple, Collection, or Parameter object
 	my $simp_coll = $node->nodeName;
 	$debug && &_LOG("TAGNAME in $inout _registerArticle is $simp_coll");
-	my $article =
-	  $node->getAttributeNode("articleName");    # may or may not have a name
+	my $article = $node->getAttributeNode("articleName");    # may or may not have a name
 	if ($article) { $article = $article->getValue() }
 	$debug && &_LOG("ARTICLENAME in _registerArticle is $article");
 	my ( $object_type, @namespaces );
 	if ( $simp_coll eq "Collection" ) {
+open OUT, 'C;\out.txt';
+print OUT "Collection found\n";
 		$debug && &_LOG("Collection!\n");
 		my $collection_id;
 		if ( $inout eq 'input' ) {
@@ -1463,9 +1458,14 @@
 #my $collection_id=$dbh->{mysql_insertid};
 		my $Simples = $node->getElementsByTagName('Simple');
 		my $length  = $Simples->size();
+print OUT "Collection has length $length\n";
 		unless ( $length > 0 ) {
-			return ( -1,
-"Your collection must be a collection of one or more Simple types"
+			return ( -1,"Your collection must be a collection of one Simple type"
+			);
+		}
+		unless ( $length == 1 ) {
+print  "\n\n\n\n\nLENGTH OF SIMPLES WAS $length\n\n\n\n\n";
+			return ( -1,"As of API v0.86, Collections must not be of more than one Simple type"
 			);
 		}
 		for ( my $x = 1 ; $x <= $length ; ++$x ) {
@@ -2473,6 +2473,47 @@
 	return ( $authURI, $serviceName, $InputXML, $OutputXML, $SecondaryXML );
 }
 
+=head2 retrieveResourceURLs
+
+ Title     :    retrieveResourceURLs
+ Usage     :    $urls = $MOBY->retrieveResourceURLs
+ Function  :    to retrieve the location(s) of the RDF versions of the various
+                MOBY-S Ontologies
+ Args      :    none
+ Returns   :    XML (see below).  The "name" attribute indicates which ontology
+                is described by the URL (Service, Object, Namespace, ServiceInstance, Full),
+		and the "url" attribute provides a URL that, when called with an
+		HTTP GET, will return RDF-XML describing that ontology.
+ XML       :
+        <resourceURLs>
+	    <Resource name="Service" url="http://mobycentral.org/RESOURCES/MOBY-S/Services/>
+	    <Resource name="Object" url="..."/>
+	    <Resource name="Namespace" url="...X..."/>
+	    <Resource name="Namespace" url="...Y..."/>
+	</resourceURLs>
+
+=cut
+
+sub retrieveResourceURLs {
+
+    $CONFIG ||= MOBY::Config->new;    # exported by Config.pm
+    my $central = $CONFIG->{mobycentral}->{resourceURL};
+    my $service = $CONFIG->{mobyservice}->{resourceURL};
+    my $namespace = $CONFIG->{mobynamespace}->{resourceURL};
+    my $object = $CONFIG->{mobyobject}->{resourceURL};
+    my $all = $CONFIG->{mobycentral}->{allResources};
+
+    my $message ="<resourceURLs>";
+    $message .="<Resource name='ServiceInstance' url='$central'/>" if $central;
+    $message .="<Resource name='Object' url='$object'/>" if $object;
+    $message .="<Resource name='Service' url='$service'/>" if $service;
+    $message .="<Resource name='Namespace' url='$namespace'/>" if $namespace;
+    $message .="<Resource name='Full' url='$all'/>" if $all;
+    $message .="</resourceURLs>";
+    return $message;
+}
+ 
+ 
 =head2 retrieveServiceProviders
 
  Title     :	retrieveServiceProviders




More information about the MOBY-guts mailing list