[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Thu Jul 29 21:53:54 UTC 2004


mwilkinson
Thu Jul 29 17:53:53 EDT 2004
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv20244/MOBY

Modified Files:
	Central.pm 
Log Message:
currently untested.  This should now return RDF of the service signature to a client who registers a service.  IF this works, and is parsable by Nina's agent, we will switch off service deregistration shortly and send an RDF message to everyone with a registered service

moby-live/Perl/MOBY Central.pm,1.133,1.134
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2004/07/12 00:39:37	1.133
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm	2004/07/29 21:53:53	1.134
@@ -22,6 +22,14 @@
 use MOBY::secondary_input;
 use MOBY::central_db_connection;
 use MOBY::Config;
+use MOBY::RDF::ServiceInstanceRDF;
+use RDF::Core;
+use RDF::Core::Model;
+use RDF::Core::Literal;
+use RDF::Core::Statement;
+use RDF::Core::Model::Serializer;
+use RDF::Core::Storage::Memory;
+use RDF::Core::Constants qw(:xml :rdf :rdfs);
 
 my $debug = 0;
 
@@ -153,11 +161,15 @@
 	my $id = $details->{id};
 	my $success = $details->{success};
 	my $message = $details->{message};
+    my $RDF = "";
+    $RDF = $details->{RDF};
+    
 
 	return "<MOBYRegistration>
 				<id>$id</id>
 				<success>$success</success>
 				<message><![CDATA[$message]]></message>
+                <RDF><![CDATA[$RDF]]></RDF>
 			</MOBYRegistration>";
 }
 
@@ -1149,7 +1161,36 @@
 		return &_error("Registration Failed During SECONDARY Article Registration: $msg","") unless ($success==1);
 	}
 	
-	return &_success("Registration successful", $SVC->service_instance_id);
+    # we're going to do a findService here to find the service that we just created
+    # and use the resulting XML to create a MOBY::Client::ServiceInstance object
+    # that we can then use to retrieve the RDF for that service signature.
+    # this is roundabout, I agree, but it is the most re-usable way to go at
+    # the moment.
+    
+    my ($si, $reg) = &findService(qw{<?xml version="1.0" encoding="UTF-8"?>
+                                        <MOBY>
+                                            <findService>
+                                                  <authURI>$AuthURI</authURI>;
+                                                  <serviceName>$serviceName</serviceName>;
+                                            </findService>
+                                        </MOBY>"});
+    unless ($si){
+        $SVC->DELETE_THYSELF;
+        return &_error("Registration Failed - newly registered service could not be discovered","");
+    }
+    my $service = shift @{$si};
+    unless ($service){
+        $SVC->DELETE_THYSELF;
+        return &_error("Registration Failed - newly registered service could not be discovered","");
+    }
+    
+    my $services = MOBY::Client::Central::_parseServices('', '', $service);
+    my $service_instance = shift @{$services};
+    my $storage = new RDF::Core::Storage::Memory;
+    my $model = new RDF::Core::Model (Storage => $storage);
+    my $RDF_MODEL = MOBY::RDF::ServiceInstanceRDF->new(model => $model, service_instance => $service_instance);
+    my $RDF_XML = $RDF_MODEL->serialize;
+	return &_success("Registration successful", $SVC->service_instance_id, $RDF_XML);
 }
 
 sub _registerArticles {
@@ -2977,11 +3018,12 @@
 }
 
 sub _success {
-	my ($message, $id) = @_;
+	my ($message, $id, $RDF) = @_;
 	my $reg = &Registration({
 	success => 1,
 	message => "$message",
 	id => "$id",
+    RDF => $RDF,
 							  });
 	return $reg;
 }




More information about the MOBY-guts mailing list