[Mulgara-svn] r2007 - in trunk/src/jar: query/java/org/mulgara/query/operation query/java/org/mulgara/server resolver/java/org/mulgara/resolver resolver-lucene/java/org/mulgara/resolver/lucene resolver-relational/java/org/mulgara/resolver/relational resolver-view/java/org/mulgara/resolver/view server-rmi/java/org/mulgara/server/rmi

alexhall at mulgara.org alexhall at mulgara.org
Tue Jul 19 15:54:06 UTC 2011


Author: alexhall
Date: 2011-07-19 15:54:06 +0000 (Tue, 19 Jul 2011)
New Revision: 2007

Modified:
   trunk/src/jar/query/java/org/mulgara/query/operation/DataInputTx.java
   trunk/src/jar/query/java/org/mulgara/query/operation/Load.java
   trunk/src/jar/query/java/org/mulgara/query/operation/Restore.java
   trunk/src/jar/query/java/org/mulgara/server/Session.java
   trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolverUnitTest.java
   trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java
   trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/AdvDatabaseSessionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java
Log:
Modified Session.setModel to use URI instead of GraphResource for the source graph

Modified: trunk/src/jar/query/java/org/mulgara/query/operation/DataInputTx.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/operation/DataInputTx.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/query/java/org/mulgara/query/operation/DataInputTx.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -41,7 +41,7 @@
  * @copyright © 2008 <a href="http://www.revelytix.com">Revelytix, Inc.</a>
  * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
  */
-public abstract class DataInputTx<SourceType> extends DataTx {
+public abstract class DataInputTx extends DataTx {
 
   /** String constant for the extension of gzip files. */
   private static final String GZIP_EXTENSION = ".gz";
@@ -93,7 +93,7 @@
   /**
    * Perform the input transfer with the configured source.
    */
-  protected Long doTx(Connection conn, SourceType src) throws QueryException {
+  protected Long doTx(Connection conn, URI src) throws QueryException {
     return conn.execute(getExecutable(src));
   }
   
@@ -105,7 +105,7 @@
   /**
    * Get the operation that will transfer from the given source object.
    */
-  protected abstract SessionOp<Long,QueryException> getExecutable(SourceType src);
+  protected abstract SessionOp<Long,QueryException> getExecutable(URI src);
   
   /**
    * Wrap the local source data (input stream or file URI) in an RMI object for marshalling, 

Modified: trunk/src/jar/query/java/org/mulgara/query/operation/Load.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/operation/Load.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/query/java/org/mulgara/query/operation/Load.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -39,14 +39,11 @@
  * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
  * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
  */
-public class Load extends DataInputTx<GraphResource> {
+public class Load extends DataInputTx {
 
   /** The logger */
   static final Logger logger = Logger.getLogger(Load.class.getName());
 
-  /** Graph resource form of the source URI */
-  private final GraphResource srcRsc;
-
   /** The type of data that may be in a stream. */
   private MimeType contentType;
 
@@ -61,8 +58,6 @@
     
     // Validate arguments.
     if (graphURI == null) throw new IllegalArgumentException("Need a valid destination graph URI");
-    
-    srcRsc = source == null ? null : new GraphResource(source);
     contentType = null;
   }
 
@@ -108,7 +103,7 @@
     }
 
     try {
-      long stmtCount = isLocal() ? sendMarshalledData(conn, true) : doTx(conn, srcRsc);
+      long stmtCount = isLocal() ? sendMarshalledData(conn, true) : doTx(conn, getSource());
       if (logger.isDebugEnabled()) logger.debug("Loaded " + stmtCount + " statements from " + src + " into " + dest);
   
       if (stmtCount > 0L) setResultMessage("Successfully loaded " + stmtCount + " statements from " + 
@@ -131,7 +126,7 @@
   protected SessionOp<Long,QueryException> getExecutable(final InputStream inputStream) {
     return new SessionOp<Long,QueryException>() {
       public Long fn(Session session) throws QueryException {
-        return session.setModel(inputStream, getDestination(), srcRsc, contentType);
+        return session.setModel(inputStream, getDestination(), getSource(), contentType);
       }
     };
   }
@@ -141,7 +136,7 @@
    * @see org.mulgara.query.operation.DataInputTx#getExecutable(java.net.URI)
    */
   @Override
-  protected SessionOp<Long,QueryException> getExecutable(final GraphResource src) {
+  protected SessionOp<Long,QueryException> getExecutable(final URI src) {
     return new SessionOp<Long,QueryException>() {
       public Long fn(Session session) throws QueryException {
         return session.setModel(getDestination(), src);

Modified: trunk/src/jar/query/java/org/mulgara/query/operation/Restore.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/operation/Restore.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/query/java/org/mulgara/query/operation/Restore.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -33,7 +33,7 @@
  * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
  * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
  */
-public class Restore extends DataInputTx<URI> {
+public class Restore extends DataInputTx {
 
   /**
    * Creates a restore operation, restoring the server from backup data at the given location.

Modified: trunk/src/jar/query/java/org/mulgara/server/Session.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/server/Session.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/query/java/org/mulgara/server/Session.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -282,25 +282,27 @@
   /**
    * Define the contents of a model via a {@link GraphExpression}
    *
-   * @param uri the {@link URI} of the model to be redefined
-   * @param graphExpression the new content for the model
+   * @param destinationUri the {@link URI} of the model to be redefined
+   * @param sourceUri the new content for the model
    * @return The number of statements inserted into the model
    * @throws QueryException if the model can't be modified
    */
-  public long setModel(URI uri, GraphExpression graphExpression)
+  public long setModel(URI destinationUri, URI sourceUri)
     throws QueryException;
 
   /**
    * Define the contents of a model via an {@link InputStream}.
    *
    * @param inputStream a remote inputstream
-   * @param uri the {@link URI} of the model to be redefined
-   * @param graphExpression the new content for the model
+   * @param destinationUri the {@link URI} of the model to be redefined
+   * @param sourceUri the URI for the new content for the model;
+   *        if inputStream is null this will be used to locate the new content.
+   * @param contentType the content type being loaded, if known.
    * @return The number of statements inserted into the model
    * @throws QueryException if the model can't be modified
    */
-  public long setModel(InputStream inputStream, URI uri,
-      GraphExpression graphExpression, MimeType contentType) throws QueryException;
+  public long setModel(InputStream inputStream, URI destinationUri,
+      URI sourceUri, MimeType contentType) throws QueryException;
 
   /**
    * Extract {@link Rules} from the data found in a model.

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/AdvDatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/AdvDatabaseSessionUnitTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/AdvDatabaseSessionUnitTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -230,7 +230,7 @@
       Session session = database.newSession();
       try {
         session.createModel(modelURI, null);
-        session.setModel(modelURI, new GraphResource(fileURI));
+        session.setModel(modelURI, fileURI);
       } finally {
         session.close();
       }
@@ -555,7 +555,7 @@
         try {
           session1.createModel(model3URI, null);
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new GraphResource(fileURI));
+          session1.setModel(model3URI, fileURI);
 
           // Evaluate the query
           Answer answer = session2.query(createQuery(model3URI));
@@ -593,7 +593,7 @@
         try {
           session1.createModel(model3URI, null);
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new GraphResource(fileURI));
+          session1.setModel(model3URI, fileURI);
 
           // Evaluate the query
           Answer answer = session2.query(createQuery(model3URI));
@@ -633,7 +633,7 @@
         try {
           session1.createModel(model3URI, null);
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new GraphResource(fileURI));
+          session1.setModel(model3URI, fileURI);
 
           // Evaluate the query
           Answer answer = session2.query(createQuery(model3URI));
@@ -687,7 +687,7 @@
         Session session2 = database.newSession();
         try {
           session1.createModel(model4URI, null);
-          session1.setModel(model4URI, new GraphResource(fileURI));
+          session1.setModel(model4URI, fileURI);
 
           // Check data loaded
           Answer answer = session1.query(createQuery(model4URI));
@@ -774,7 +774,7 @@
       try {
         session1.createModel(model3URI, null);
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -867,7 +867,7 @@
       try {
         session1.createModel(model3URI, null);
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
 
         Thread t2 = new Thread("tx2Test") {
           public void run() {
@@ -987,7 +987,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");
@@ -1045,7 +1045,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");
@@ -1221,7 +1221,7 @@
       Session session = database.newSession();
       try {
         session.createModel(model5URI, null);
-        session.setModel(model5URI, new GraphResource(fileURI));
+        session.setModel(model5URI, fileURI);
 
         Variable varA   = new Variable("a");
         Variable varB   = new Variable("b");
@@ -1331,7 +1331,7 @@
         // verify second setAutoCommit(false) is a no-op
         session.createModel(model3URI, null);
         session.setAutoCommit(false);
-        session.setModel(model3URI, new GraphResource(new File("data/xatest-model1.rdf").toURI()));
+        session.setModel(model3URI, new File("data/xatest-model1.rdf").toURI());
         session.setAutoCommit(false);
         session.commit();
 

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -255,7 +255,7 @@
       Session session = database.newSession();
       try {
         session.createModel(modelURI, null);
-        session.setModel(modelURI, new GraphResource(fileURI));
+        session.setModel(modelURI, fileURI);
         session.removeModel(modelURI);
       } finally {
         session.close();

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -541,51 +541,45 @@
   /**
    * Define the contents of a model.
    * @param uri the {@link URI} of the model to be redefined
-   * @param graphExpression the new content for the model
+   * @param sourceUri the new content for the model
    * @return RETURNED VALUE TO DO
    * @throws QueryException if the model can't be modified
    */
-  public synchronized long setModel(URI uri, GraphExpression graphExpression) throws QueryException {
-    return this.setModel(null, uri, graphExpression, null);
+  public synchronized long setModel(URI uri, URI sourceUri) throws QueryException {
+    return this.setModel(null, uri, sourceUri, null);
   }
 
 
   /**
    * Define the contents of a model via an inputstream
    * @param inputStream a remote inputstream
-   * @param destinationModelURI the {@link URI} of the graph to be redefined
-   * @param graphExpression the new content for the graph
+   * @param destinationUri the {@link URI} of the graph to be redefined
+   * @param sourceUri the new content for the graph
    * @return The number of statements loaded into the graph
    * @throws QueryException if the model can't be modified
    */
   public synchronized long setModel(InputStream inputStream,
-      URI destinationModelURI, GraphExpression graphExpression, MimeType contentType) throws QueryException {
+      URI destinationUri, URI sourceUri, MimeType contentType) throws QueryException {
     if (logger.isDebugEnabled()) {
-      logger.debug("SET-MODEL " + destinationModelURI + " to " + graphExpression + " from " + inputStream);
+      logger.debug("SET-MODEL " + destinationUri + " to " + sourceUri + " from " + inputStream);
     }
 
     // Validate parameters
-    if (destinationModelURI == null) {
-      throw new IllegalArgumentException("Null 'destinationModelURI' parameter");
+    if (destinationUri == null) {
+      throw new IllegalArgumentException("Must provide a destination graph URI.");
     }
-    if (graphExpression == null && contentType == null) {
-      throw new IllegalArgumentException("Null 'modelExpression' and 'contentType' parameters");
+    if (sourceUri == null && (contentType == null || inputStream == null)) {
+      throw new IllegalArgumentException("Must provide either a source URI or a source input stream/content type.");
     }
 
-    // Convert the model expression into the source model URI
-    if (graphExpression != null && !(graphExpression instanceof GraphResource)) {
-      throw new QueryException("Unsupported model expression " + graphExpression + " (" + graphExpression.getClass() + ")");
-    }
+    assert sourceUri != null || contentType != null;
 
-    URI sourceModelURI = graphExpression == null ? null : ((GraphResource)graphExpression).getURI();
-    assert sourceModelURI != null || contentType != null;
-
     // Perform the operation
-    SetGraphOperation op = new SetGraphOperation(sourceModelURI, destinationModelURI,
+    SetGraphOperation op = new SetGraphOperation(sourceUri, destinationUri,
                                   inputStream, contentType, contentHandlers, this);
     // preExcecute is a rather ugly hack, get rid of it once we support re-entrant transactions.
     if (op.preExecute()) {
-      execute(op, "Unable to load " + sourceModelURI + " into " + destinationModelURI);
+      execute(op, "Unable to load " + sourceUri + " into " + destinationUri);
     }
 
     return op.getStatementCount();

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -268,7 +268,7 @@
       Xid xid = new TestXid(1);
       resource.start(xid, XAResource.TMNOFLAGS);
       try {
-        session.setModel(modelURI, new GraphResource(fileURI));
+        session.setModel(modelURI, fileURI);
         resource.end(xid, XAResource.TMSUCCESS);
         resource.prepare(xid);
         resource.commit(xid, false);
@@ -778,7 +778,7 @@
 
         // Perform update
         rwResource.start(xid3, XAResource.TMNOFLAGS);
-        session.setModel(model3URI, new GraphResource(fileURI));
+        session.setModel(model3URI, fileURI);
         rwResource.end(xid3, XAResource.TMSUSPEND);
 
         // Check uncommitted change not visible
@@ -881,7 +881,7 @@
 
           // Perform update
           rwResource.start(xid2, XAResource.TMNOFLAGS);
-          session1.setModel(model3URI, new GraphResource(fileURI));
+          session1.setModel(model3URI, fileURI);
           rwResource.end(xid2, XAResource.TMSUSPEND);
 
           // Check uncommitted change not visible
@@ -940,7 +940,7 @@
 
           // Perform update with autocommit off
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new GraphResource(fileURI));
+          session1.setModel(model3URI, fileURI);
 
           // Check uncommitted change not visible
           roResource.start(xid2, XAResource.TMNOFLAGS);
@@ -1028,7 +1028,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1128,7 +1128,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1223,7 +1223,7 @@
         session1.createModel(model3URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1333,7 +1333,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1429,7 +1429,7 @@
         session1.createModel(model3URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1538,7 +1538,7 @@
         rwResource.commit(new TestXid(1), true);
 
         rwResource.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session.setModel(model3URI, new GraphResource(fileURI));
+        session.setModel(model3URI, fileURI);
         rwResource.end(new TestXid(2), XAResource.TMSUSPEND);
 
         roResource.start(new TestXid(3), XAResource.TMNOFLAGS);
@@ -1590,7 +1590,7 @@
         session1.createModel(model4URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model4URI, new GraphResource(fileURI));
+        session1.setModel(model4URI, fileURI);
 
         session1.commit();
         session1.close();
@@ -1659,7 +1659,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");
@@ -1726,7 +1726,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new GraphResource(fileURI));
+        session1.setModel(model3URI, fileURI);
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -187,7 +187,7 @@
 
       try {
         try {
-          session.setModel(modelURI, new GraphResource(fileURI));
+          session.setModel(modelURI, fileURI);
         } finally {
           session.close();
         }
@@ -217,7 +217,7 @@
       txManager.getTransaction().enlistResource(session.getXAResource());
 
       try {
-        session.setModel(modelURI, new GraphResource(fileURI));
+        session.setModel(modelURI, fileURI);
         txManager.commit();
       } finally {
         session.close();

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -49,8 +49,8 @@
 
 /**
  * An {@link Operation} that implements the
- * {@link org.mulgara.server.Session#setModel(URI, GraphExpression)} and
- * {@link org.mulgara.server.Session#setModel(InputStream, URI, GraphExpression, MimeType)} methods.
+ * {@link org.mulgara.server.Session#setModel(URI, URI)} and
+ * {@link org.mulgara.server.Session#setModel(InputStream, URI, URI, MimeType)} methods.
  *
  * @created 2004-11-04
  *

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -582,7 +582,7 @@
       Session session = database.newSession();
       for (int i = 1; i < modelURIs.length; i++) {
         session.createModel(modelURIs[i], modelTypeURI);
-        session.setModel(modelURIs[i], new GraphResource(modelDataURIs[i]));
+        session.setModel(modelURIs[i], modelDataURIs[i]);
       }
     } catch (URISyntaxException e) {
       throw new Error("Bad hardcoded XA store model URI", e);

Modified: trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolverUnitTest.java
===================================================================
--- trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolverUnitTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolverUnitTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -19,8 +19,8 @@
 package org.mulgara.resolver.lucene;
 
 import java.io.File;
-import java.io.StringWriter;
 import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
@@ -32,20 +32,18 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.log4j.Logger;
 import org.jrdf.graph.Literal;
 import org.jrdf.graph.URIReference;
-
-import org.apache.log4j.Logger;
 import org.mulgara.itql.TqlInterpreter;
 import org.mulgara.query.Answer;
 import org.mulgara.query.ConstraintConjunction;
 import org.mulgara.query.ConstraintExpression;
-import org.mulgara.query.GraphResource;
 import org.mulgara.query.Query;
 import org.mulgara.query.Variable;
 import org.mulgara.query.operation.Modification;
-import org.mulgara.query.rdf.Mulgara;
 import org.mulgara.query.rdf.LiteralImpl;
+import org.mulgara.query.rdf.Mulgara;
 import org.mulgara.query.rdf.URIReferenceImpl;
 import org.mulgara.resolver.Database;
 import org.mulgara.resolver.JotmTransactionManagerFactory;
@@ -161,7 +159,7 @@
           session.removeModel(modelURI);
         }
         session.createModel(modelURI, luceneModelType);
-        session.setModel(modelURI, new GraphResource(fileURI));
+        session.setModel(modelURI, fileURI);
       } finally {
         session.close();
       }
@@ -336,7 +334,7 @@
 
         // load models
         URI fileURI = new File(new File(System.getProperty("cvs.root"), "data"), "w3c-news.rss").toURI();
-        session.setModel(dataModel, new GraphResource(fileURI));
+        session.setModel(dataModel, fileURI);
 
         String q = "select $s $p $o from <local:sampledata> where $s $p $o and (" +
                      "  $p <mulgara:is> <http://purl.org/rss/1.0/description> or " +

Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -365,7 +365,7 @@
   public void testLoadRelationalDef() throws Exception {
     Session session = database.newSession();
     try {
-      session.setModel(testModelDefURI, new GraphResource(new File("data/ISWC-d2rq.rdf").toURI()));
+      session.setModel(testModelDefURI, new File("data/ISWC-d2rq.rdf").toURI());
     } finally {
       session.close();
     }
@@ -1507,7 +1507,7 @@
   public void testLoadRelationalDef2() throws Exception {
     Session session = database.newSession();
     try {
-      session.setModel(testModel2DefURI, new GraphResource(new File("data/ISWC-d2rq.rdf").toURI()));
+      session.setModel(testModel2DefURI, new File("data/ISWC-d2rq.rdf").toURI());
     } finally {
       session.close();
     }

Modified: trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
===================================================================
--- trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -579,7 +579,7 @@
     Session session = database.newSession();
     for (int i = 1; i < modelURIs.length; i++) {
       session.createModel(modelURIs[i], modelTypeURI);
-      session.setModel(modelURIs[i], new GraphResource(modelDataURIs[i]));
+      session.setModel(modelURIs[i], modelDataURIs[i]);
     }
   }
 
@@ -595,7 +595,6 @@
   // Test cases
   //
 
-  @SuppressWarnings("unchecked")
   public void testModel() {
     try {
       logger.warn("Testing: " + test.errorString);

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -236,26 +236,26 @@
   /**
    * Define the contents of a model.
    *
-   * @param uri the {@link URI} of the model to be redefined
-   * @param graphExpression the new content for the model
+   * @param destinationUri the {@link URI} of the model to be redefined
+   * @param sourceUri the new content for the model
    * @return The number of statements inserted into the model
    * @throws QueryException if the model can't be modified
    * @throws RemoteException EXCEPTION TO DO
    */
-  public long setModel(URI uri,
-      GraphExpression graphExpression) throws QueryException, RemoteException;
+  public long setModel(URI destinationUri,
+      URI sourceUri) throws QueryException, RemoteException;
 
   /**
    * Define the contents of a model via an inputstream.
    *
    * @param inputStream a remote inputstream
-   * @param uri the {@link URI} of the model to be redefined
-   * @param graphExpression the new content for the model
+   * @param destinationUri the {@link URI} of the model to be redefined
+   * @param sourceUri the new content for the model
    * @return The number of statements inserted into the model
    * @throws QueryException if the model can't be modified
    */
-  public long setModel(InputStream inputStream, URI uri,
-                       GraphExpression graphExpression, MimeType contentType)
+  public long setModel(InputStream inputStream, URI destinationUri,
+                       URI sourceUri, MimeType contentType)
       throws QueryException, RemoteException;
 
   /**

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -134,19 +134,19 @@
    * Sets the contents of a model, via a model expression.
    *
    * @param uri The name of the model to set.
-   * @param graphExpression The expression describing the data to put in the model.
+   * @param sourceUri The expression describing the data to put in the model.
    * @return The number of statements inserted into the model.
    * @throws QueryException An error getting data for the model, or inserting into the new model.
    */
-  public long setModel(URI uri, GraphExpression graphExpression) throws QueryException {
+  public long setModel(URI uri, URI sourceUri) throws QueryException {
 
     try {
-      long r = remoteSession.setModel(uri, graphExpression);
+      long r = remoteSession.setModel(uri, sourceUri);
       resetRetries();
       return r;
     } catch (RemoteException e) {
       testRetry(e);
-      return setModel(uri, graphExpression);
+      return setModel(uri, sourceUri);
     }
   }
 
@@ -156,20 +156,20 @@
    *
    * @param inputStream a remote inputstream
    * @param uri the {@link URI} of the model to be redefined
-   * @param graphExpression the new content for the model
+   * @param sourceUri the new content for the model
    * @return The number of statements inserted into the model
    * @throws QueryException if the model can't be modified
    */
-  public long setModel(InputStream inputStream, URI uri, GraphExpression graphExpression, MimeType contentType) throws QueryException {
+  public long setModel(InputStream inputStream, URI uri, URI sourceUri, MimeType contentType) throws QueryException {
 
     try {
 
-      long r = remoteSession.setModel(inputStream, uri, graphExpression, contentType);
+      long r = remoteSession.setModel(inputStream, uri, sourceUri, contentType);
       resetRetries();
       return r;
     } catch (RemoteException e) {
       testRetry(e);
-      return setModel(inputStream, uri, graphExpression, contentType);
+      return setModel(inputStream, uri, sourceUri, contentType);
     }
   }
 

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java	2011-07-19 06:31:20 UTC (rev 2006)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java	2011-07-19 15:54:06 UTC (rev 2007)
@@ -97,15 +97,15 @@
   /**
    * Sets the Graph attribute of the SessionWrapperRemoteSession object
    *
-   * @param uri The new Graph value
-   * @param graphExpression The new Graph value
+   * @param destinationUri The new Graph value
+   * @param sourceUri The new Graph value
    * @return RETURNED VALUE TO DO
    * @throws QueryException EXCEPTION TO DO
    * @throws RemoteException EXCEPTION TO DO
    */
-  public long setModel(URI uri, GraphExpression graphExpression) throws QueryException, RemoteException {
+  public long setModel(URI destinationUri, URI sourceUri) throws QueryException, RemoteException {
     try {
-      return session.setModel(uri, graphExpression);
+      return session.setModel(destinationUri, sourceUri);
     } catch (Throwable t) {
       throw convertToQueryException(t);
     }
@@ -115,14 +115,14 @@
    * Define the contents of a model via an inputstream.
    *
    * @param inputStream a remote inputstream
-   * @param uri the {@link URI} of the model to be redefined
-   * @param graphExpression the new content for the model
+   * @param destinationUri the {@link URI} of the model to be redefined
+   * @param sourceUri the new content for the model
    * @return The number of statements inserted into the model
    * @throws QueryException if the model can't be modified
    */
-  public long setModel(InputStream inputStream, URI uri, GraphExpression graphExpression, MimeType contentType) throws QueryException {
+  public long setModel(InputStream inputStream, URI destinationUri, URI sourceUri, MimeType contentType) throws QueryException {
     try {
-      return session.setModel(inputStream, uri, graphExpression, contentType);
+      return session.setModel(inputStream, destinationUri, sourceUri, contentType);
     } catch (Throwable t) {
       throw convertToQueryException(t);
     }



More information about the Mulgara-svn mailing list