[MOBY-guts] biomoby commit

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


gss
Wed May 19 14:26:44 EDT 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/example-clients/SimpleEngager
In directory pub.open-bio.org:/tmp/cvs-serv843

Modified Files:
	SimpleProviderEngagerPanel.java 
Log Message:
Incorporation of new parser

moby-live/S-MOBY/ref-impl/example-clients/SimpleEngager SimpleProviderEngagerPanel.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/example-clients/SimpleEngager/SimpleProviderEngagerPanel.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/example-clients/SimpleEngager/SimpleProviderEngagerPanel.java	2004/03/30 21:41:36	1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/example-clients/SimpleEngager/SimpleProviderEngagerPanel.java	2004/05/19 18:26:44	1.2
@@ -4,13 +4,20 @@
 import javax.swing.border.*;
 import javax.swing.event.*;
 
-import org.smoby.tools.common.graph.MOBYGraph;
-import org.smoby.tools.common.graph.NonCanonicalException;
-import org.smoby.tools.common.graph.UnparsableModelException;
-import org.smoby.tools.common.http.HTTPException;
-import org.smoby.tools.common.http.HTTPRequest;
-import org.smoby.tools.common.http.HTTPResponse;
+import org.smoby.http.*;
+import org.smoby.graph.*;
+import org.smoby.parser.*;
 
+/**
+ * This class is a simple two-pane window for engaging Semantic MOBY
+ * providers. The user first pastes into the input pane a canonical graph
+ * of the form that is acceptable to the provider (i.e. the graph
+ * returned by doing an HTTP GET on the provider URI, with some of
+ * the blank nodes filled in). When the user presses the "Engage Provider"
+ * button, the graph is submitted, via HTTP POST, to the provider embedded
+ * in the graph; the results of the HTTP POST, as written by the provider,
+ * are then printed to the lower pane.
+ */
 public class SimpleProviderEngagerPanel extends JPanel
 {
 	private JTextArea inputArea = new JTextArea();
@@ -31,8 +38,7 @@
 		Font plain = new Font("Monospaced", Font.PLAIN, 12);
 		inputArea.setFont(plain);
 		outputArea.setFont(plain);
-		inputArea.setEditable(true);
-		outputArea.setEditable(false);
+		
 		engageButton.setEnabled(false);
 		
 		addListeners();
@@ -104,26 +110,26 @@
 		String graphString = inputArea.getText();
 		try
 		{
-			MOBYGraph mobyGraph = MOBYGraph.fromString(graphString, false);
-			String graphURI = mobyGraph.getProvider().getURI();
+		    Parser parser = Parser.forString(graphString, Parser.LANGUAGE_RDF_XML);
+		    MOBYProvider provider = parser.parseProvider();
+			String graphURI = provider.getURI();
 			HTTPRequest request = HTTPRequest.newPostRequest(graphURI);
 			request.addParameter("graph", graphString);
 			HTTPResponse response = request.send();
 			outputArea.setText(response.getBody());
-//			inputArea.setText("");
 		}
-		catch (UnparsableModelException e)
+		catch (UnparsableGraphException e)
 		{
 			JOptionPane.showMessageDialog(this,
 				"The graph could not be parsed", "Unparsable",
 				JOptionPane.ERROR_MESSAGE);
 		}
-		catch (NonCanonicalException e)
-		{
-			JOptionPane.showMessageDialog(this,
-					"The graph is not canonical", "Non-canonoical",
-					JOptionPane.ERROR_MESSAGE);
-		}
+//		catch (NonCanonicalException e)
+//		{
+//			JOptionPane.showMessageDialog(this,
+//					"The graph is not canonical", "Non-canonoical",
+//					JOptionPane.ERROR_MESSAGE);
+//		}
 		catch (HTTPException e)
 		{
 			JOptionPane.showMessageDialog(this,




More information about the MOBY-guts mailing list