[Mulgara-svn] r492 - branches/nw-interface/src/jar/itql/java/org/mulgara/itql

pag at mulgara.org pag at mulgara.org
Mon Oct 22 21:23:47 UTC 2007


Author: pag
Date: 2007-10-22 16:23:47 -0500 (Mon, 22 Oct 2007)
New Revision: 492

Modified:
   branches/nw-interface/src/jar/itql/java/org/mulgara/itql/Collaborator.java
   branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java
   branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java
   branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java
   branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java
Log:
Numerous fixes, and debugging output to STDERR.  The debugging output will need to be fixed before merging with the trunk.

Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/Collaborator.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/Collaborator.java	2007-10-22 21:22:32 UTC (rev 491)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/Collaborator.java	2007-10-22 21:23:47 UTC (rev 492)
@@ -1340,7 +1340,7 @@
 
         // break if failure occurs
         if (!successful) {
-
+          System.err.println("Collaborator command: " + command + "\nmessage: " + message + "\nexpected: " + expectedResult);
           break;
         }
       }

Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java	2007-10-22 21:22:32 UTC (rev 491)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java	2007-10-22 21:23:47 UTC (rev 492)
@@ -402,6 +402,8 @@
               //Error has occurred at the interpreter
               //Generate a SOAP fault
               // TODO REMOVE Constants.FAULT_CODE_SERVER,
+              System.err.println("Generating a SOAP fault due to interpreter exception:");
+              interpreter.getLastException().printStackTrace();
               log.error("Execute query failed.  Returning error", interpreter.getLastException());
               throw new SOAPException("ItqlInterpreter error - " +
                   ItqlUtil.getCause(interpreter.getLastException(), 0) + EOL +

Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java	2007-10-22 21:22:32 UTC (rev 491)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBeanUnitTest.java	2007-10-22 21:23:47 UTC (rev 492)
@@ -838,10 +838,8 @@
 
       }
       catch (Exception ex) {
-        log.error("Failed to create/query the " + count +
-            " ItqlInterpreterBean", ex);
-        assertTrue("Failed to create/query the " + count +
-            " ItqlInterpreterBean", false);
+        log.error("Failed to create/query the " + count + " ItqlInterpreterBean", ex);
+        assertTrue("Failed to create/query the " + count + " ItqlInterpreterBean", false);
         break;
       }
       finally {

Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java	2007-10-22 21:22:32 UTC (rev 491)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java	2007-10-22 21:23:47 UTC (rev 492)
@@ -99,7 +99,10 @@
       lastException = e;
       return true;
     }
-    assert cmd != null;
+    if (cmd == null) {
+      lastMessage = "";
+      return true;
+    }
 
     // execute the operation
     try {

Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java	2007-10-22 21:22:32 UTC (rev 491)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlInterpreter.java	2007-10-22 21:23:47 UTC (rev 492)
@@ -53,7 +53,6 @@
 import org.mulgara.query.*;
 import org.mulgara.query.rdf.*;
 import org.mulgara.server.Session;
-import org.mulgara.util.Reflect;
 
 
 /**
@@ -595,8 +594,9 @@
     // get the resource we're inserting data into
     URI graphURI = toURI(node.getResource());
 
-    lastCommand = buildModification(graphURI, node.getTripleFactor(), Insertion.class);
+    lastCommand = buildModification(graphURI, node.getTripleFactor(), true);
   }
+
   /**
    * Deletes a triple, model, database or the results of a query from a model or
    * database.
@@ -611,7 +611,7 @@
     // get the resource we're inserting data into
     URI graphURI = toURI(node.getResource());
 
-    lastCommand = buildModification(graphURI, node.getTripleFactor(), Deletion.class);
+    lastCommand = buildModification(graphURI, node.getTripleFactor(), false);
   }
 
 
@@ -1156,7 +1156,7 @@
    * @param graphURI
    * @param tripleFactor
    */
-  private Modification buildModification(URI graphURI, PTripleFactor tripleFactor, Class<? extends Modification> clazz) {
+  private Modification buildModification(URI graphURI, PTripleFactor tripleFactor, boolean asserting) {
     // get the set of triples out of the factor
     PSetOfTriples setOfTriples = null;
     if (tripleFactor instanceof ABracedTripleFactor) {
@@ -1175,11 +1175,11 @@
         // build the query
         Query query = this.buildQuery((ASelectSetOfTriples)setOfTriples);
         if (logger.isDebugEnabled()) logger.debug("Insert query " + query);
-        return Reflect.newInstance(clazz, graphURI, query);
+        return newModifier(graphURI, query, asserting);
       } else if (setOfTriples instanceof ATripleSetOfTriples) {
         // This is an inline set of triples
         Set<Triple> statements = getStatements((ATripleSetOfTriples)setOfTriples, new HashMap<String,VariableNodeImpl>());
-        return Reflect.newInstance(clazz, graphURI, statements);
+        return newModifier(graphURI, statements, asserting);
       }
     } catch (URISyntaxException ue) {
       logger.warn("Invalid URL in the insertion data: " + ue.getMessage());
@@ -1191,8 +1191,36 @@
     return null;
   }
 
+  
+  /**
+   * Factory method to create a Modification object.
+   * @param graphURI The URI of the graph to be modified.
+   * @param query The query to select the data to be modified.
+   * @param asserting Indicates if the data needs to be asserted (inserted)
+   *        or denied (deleted).
+   * @return An {@link Insertion} if asserting is <code>true</code>,
+   *         otherwise a {@link Deletion}.
+   */
+  private Modification newModifier(URI graphURI, Query query, boolean asserting) {
+    return asserting ? new Insertion(graphURI, query) : new Deletion(graphURI, query);
+  }
 
+
   /**
+   * Factory method to create a Modification object.
+   * @param graphURI The URI of the graph to be modified.
+   * @param statements A set of triples to be modified.
+   * @param asserting Indicates if the data needs to be asserted (inserted)
+   *        or denied (deleted).
+   * @return An {@link Insertion} if asserting is <code>true</code>,
+   *         otherwise a {@link Deletion}.
+   */
+  private Modification newModifier(URI graphURI, Set<Triple> statements, boolean asserting) {
+    return asserting ? new Insertion(graphURI, statements) : new Deletion(graphURI, statements);
+  }
+
+
+  /**
    * Constructs a {@link org.jrdf.graph.Node} from a {@link
    * org.mulgara.itql.node.PTripleElement}.
    *




More information about the Mulgara-svn mailing list