[MOBY-guts] biomoby commit

Gary Schlitz gss at pub.open-bio.org
Wed May 19 18:26:40 UTC 2004


gss
Wed May 19 14:26:40 EDT 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets
In directory pub.open-bio.org:/tmp/cvs-serv634/src/org/smoby/ref/servlets

Modified Files:
	ProviderInvestigationServlet.java DiscoveryServlet.java 
Log Message:
Incorporation of new parser

moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets ProviderInvestigationServlet.java,1.2,1.3 DiscoveryServlet.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets/ProviderInvestigationServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets/ProviderInvestigationServlet.java	2004/03/22 22:13:13	1.2
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets/ProviderInvestigationServlet.java	2004/05/19 18:26:40	1.3
@@ -6,9 +6,9 @@
 import javax.servlet.http.*;
 import org.apache.commons.logging.*;
 import org.smoby.ref.tools.db.*;
-import org.smoby.tools.common.graph.*;
+import org.smoby.graph.*;
 import org.smoby.ref.tools.URIInvestigator;
-import org.smoby.tools.server.servlet.*;
+import org.smoby.servlet.*;
 
 /**
  * This servlet class is used to request that S-MOBY investigate a URL for the

===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets/DiscoveryServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets/DiscoveryServlet.java	2004/03/20 00:36:48	1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/server/src/org/smoby/ref/servlets/DiscoveryServlet.java	2004/05/19 18:26:40	1.2
@@ -1,9 +1,10 @@
 package org.smoby.ref.servlets;
 
-import org.smoby.tools.common.graph.*;
-import org.smoby.tools.common.io.*;
+import org.smoby.servlet.*;
+import org.smoby.graph.*;
+import org.smoby.parser.NonCanonicalException;
+import org.smoby.parser.Parser;
 import org.smoby.ref.tools.*;
-import org.smoby.tools.server.servlet.*;
 import com.hp.hpl.jena.rdf.model.*;
 import com.hp.hpl.jena.rdql.*;
 import java.io.*;
@@ -37,26 +38,18 @@
             //
 			String graphString = ParamReader.getParameter("query-graph", request);
             
-            // Does the requester want the matching graphs sent back in a
-            // binary format?
-            //
-            boolean binary = false;
-            try {
-            	ParamReader.getParameter("binary-return", request);
-                binary = true;
-            } catch (ParameterException e) {}
-            
             // Parse the query graph into a MOBYGraph object
             //
-			MOBYGraph g = MOBYGraph.fromString(graphString, true);
+			Parser parser = Parser.forString(graphString, Parser.LANGUAGE_RDF_XML);
+			MOBYProvider provider = parser.parseProvider();
             
             // Retrieve an array of provider description graphs that unify with
             // the query graph.
             //
-            DiscoveryQuery q = new DiscoveryQuery(g, DiscoveryQuery.ALL_STMTS);
-			ProviderDescriptionGraph[] matching = q.findMatchingGraphs();
+            DiscoveryQuery q = new DiscoveryQuery(provider, DiscoveryQuery.ALL_STMTS);
+			MOBYCollection matching = q.findMatchingGraphs();
 			
-            if ((matching.length == 0) && (! binary))
+            if ((matching.size() == 0))
             {
                 // The client doesn't want the graphs sent in a binary
                 // format, so show a text message indicating that there
@@ -66,23 +59,20 @@
             }
             else
             {
-                // Otherwise, create an object capable of transmitting the
-                // graphs (in either binary or human-readable text format)
-                // and use the object to send the matching graphs.
-                //
-                GraphListTransmitter transmitter =
-                    GraphListTransceiverFactory.newTransmitter(out, binary);
-                transmitter.transmit(matching);
+                for (Iterator it = matching.iterator(); it.hasNext();) {
+                    MOBYProvider p = (MOBYProvider) it.next();
+                    p.serialize(out);
+                }
 			}
             
 		}
-		catch (NonCanonicalException e)
-		{
-            // The query graph did not have the required canonical form
-            //
-			response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
-				"Query graph is not canonical:\n" + e);
-		}
+//		catch (NonCanonicalException e)
+//		{
+//            // The query graph did not have the required canonical form
+//            //
+//			response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
+//				"Query graph is not canonical:\n" + e);
+//		}
 		catch (ParameterException e)
         {
             // The graph parameter was missing




More information about the MOBY-guts mailing list