[Mulgara-svn] r1399 - in trunk/src/jar: ant-task/java/org/mulgara/ant/task/rdf client-jrdf/java/org/mulgara/client/jrdf/itql client-jrdf/java/org/mulgara/client/jrdf/test client-jrdf/java/org/mulgara/client/jrdf/writer content-mbox/java/org/mulgara/content/mbox/parser/model content-mp3/java/org/mulgara/content/mp3/parser content-rdfxml/java/org/mulgara/content/rdfxml/writer demo-mp3/java/org/mulgara/demo/mp3 demo-mp3/java/org/mulgara/demo/mp3/id3 demo-mp3/java/org/mulgara/demo/mp3/swing/actions demo-mp3/java/org/mulgara/demo/mp3/swing/results demo-mp3/java/org/mulgara/demo/mp3/swing/search demo-mp3/java/org/mulgara/demo/mp3/swing/widgets descriptor/src/java/org/mulgara/descriptor jrdf/java/org/mulgara/jrdf krule/java/org/mulgara/krule query/java/org/mulgara/connection query/java/org/mulgara/query query/java/org/mulgara/query/operation query/java/org/mulgara/server querylang/java/org/mulgara/itql querylang/java/org/mulgara/sparql querylang/java/org/mulgara/store/jxunit resolver/java/org/mulgara/resolver resolver/java/org/mulgara/store/exporter resolver-distributed/java/org/mulgara/resolver/distributed resolver-file/java/org/mulgara/resolver/file resolver-filesystem/java/org/mulgara/resolver/filesystem resolver-gis/java/org/mulgara/resolver/gis resolver-http/java/org/mulgara/resolver/http resolver-jar/java/org/mulgara/resolver/jar resolver-lucene/java/org/mulgara/resolver/lucene resolver-memory/java/org/mulgara/resolver/memory resolver-relational/java/org/mulgara/resolver/relational resolver-spi/java/org/mulgara/content resolver-spi/java/org/mulgara/resolver/spi resolver-store/java/org/mulgara/resolver/store resolver-test/java/org/mulgara/resolver/test resolver-url/java/org/mulgara/resolver/url resolver-view/java/org/mulgara/resolver/view resolver-xsd/java/org/mulgara/resolver/xsd server/java/org/mulgara/server server-local/java/org/mulgara/server/local server-rmi/java/org/mulgara/server/rmi tag/java/org/mulgara/extractor/tag

pag at mulgara.org pag at mulgara.org
Fri Dec 5 05:42:30 UTC 2008


Author: pag
Date: 2008-12-04 21:42:29 -0800 (Thu, 04 Dec 2008)
New Revision: 1399

Added:
   trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java
   trunk/src/jar/query/java/org/mulgara/query/Graph.java
   trunk/src/jar/query/java/org/mulgara/query/GraphExpression.java
   trunk/src/jar/query/java/org/mulgara/query/GraphIntersection.java
   trunk/src/jar/query/java/org/mulgara/query/GraphLiteral.java
   trunk/src/jar/query/java/org/mulgara/query/GraphOperation.java
   trunk/src/jar/query/java/org/mulgara/query/GraphPartition.java
   trunk/src/jar/query/java/org/mulgara/query/GraphResource.java
   trunk/src/jar/query/java/org/mulgara/query/GraphResourceUnitTest.java
   trunk/src/jar/query/java/org/mulgara/query/GraphUnion.java
   trunk/src/jar/query/java/org/mulgara/query/GraphVariable.java
   trunk/src/jar/querylang/java/org/mulgara/itql/GraphExpressionBuilder.java
   trunk/src/jar/querylang/java/org/mulgara/itql/GraphNameCompletor.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintGraphRewrite.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphExpansion.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphResolutionHandler.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/CreateGraphOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/GraphExistsOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyGraphOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveGraphOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/SystemGraphSecurityAdapter.java
   trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphN3Writer.java
   trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphWriter.java
   trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphXMLWriter.java
Removed:
   trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java
   trunk/src/jar/query/java/org/mulgara/query/Model.java
   trunk/src/jar/query/java/org/mulgara/query/ModelExpression.java
   trunk/src/jar/query/java/org/mulgara/query/ModelIntersection.java
   trunk/src/jar/query/java/org/mulgara/query/ModelLiteral.java
   trunk/src/jar/query/java/org/mulgara/query/ModelOperation.java
   trunk/src/jar/query/java/org/mulgara/query/ModelPartition.java
   trunk/src/jar/query/java/org/mulgara/query/ModelResource.java
   trunk/src/jar/query/java/org/mulgara/query/ModelResourceUnitTest.java
   trunk/src/jar/query/java/org/mulgara/query/ModelUnion.java
   trunk/src/jar/query/java/org/mulgara/query/ModelVariable.java
   trunk/src/jar/querylang/java/org/mulgara/itql/ModelExpressionBuilder.java
   trunk/src/jar/querylang/java/org/mulgara/itql/ModelNameCompletor.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintModelRewrite.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelExpansion.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelResolutionHandler.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/ModelExistsOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyModelOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveModelOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/SetModelOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/SystemModelSecurityAdapter.java
   trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelN3Writer.java
   trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelWriter.java
   trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelXMLWriter.java
Modified:
   trunk/src/jar/ant-task/java/org/mulgara/ant/task/rdf/RDFLoadUnitTest.java
   trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/ItqlGraphProxy.java
   trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/SessionGraphProxy.java
   trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/test/RemoteAnswerCloneUnitTest.java
   trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/writer/MemoryXMLWriter.java
   trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/parser/ID3ParsersUnitTest.java
   trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriter.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/AbstractModel.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/FileSystemModelImpl.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ControllerImpl.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3FileImpl.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3Model.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ModelImpl.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModel.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModelImpl.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/id3/AbstractId3Tag.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/actions/ClearMp3ModelAction.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/results/Mp3List.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/search/BrowserPanel.java
   trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/widgets/PropertiesTable.java
   trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DeployServlet.java
   trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/Descriptor.java
   trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DescriptorElement.java
   trunk/src/jar/jrdf/java/org/mulgara/jrdf/JRDFGraph.java
   trunk/src/jar/krule/java/org/mulgara/krule/QueryStruct.java
   trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactoryUnitTest.java
   trunk/src/jar/query/java/org/mulgara/query/AskQuery.java
   trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java
   trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java
   trunk/src/jar/query/java/org/mulgara/query/ConstructQuery.java
   trunk/src/jar/query/java/org/mulgara/query/Query.java
   trunk/src/jar/query/java/org/mulgara/query/QueryUnitTest.java
   trunk/src/jar/query/java/org/mulgara/query/operation/Load.java
   trunk/src/jar/query/java/org/mulgara/query/operation/ServerCommand.java
   trunk/src/jar/query/java/org/mulgara/server/Session.java
   trunk/src/jar/querylang/java/org/mulgara/itql/Collaborator.java
   trunk/src/jar/querylang/java/org/mulgara/itql/CollaboratorUnitTest.java
   trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java
   trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java
   trunk/src/jar/querylang/java/org/mulgara/sparql/SparqlInterpreter.java
   trunk/src/jar/querylang/java/org/mulgara/store/jxunit/LoadDataJX.java
   trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/DistributedResolver.java
   trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/NetworkDelegator.java
   trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileResolver.java
   trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java
   trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/ReadOnlyGISResolver.java
   trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java
   trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarResolver.java
   trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneConstraintDescriptor.java
   trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java
   trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolverUnitTest.java
   trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/ReadOnlyLuceneResolver.java
   trunk/src/jar/resolver-memory/java/org/mulgara/resolver/memory/MemoryResolver.java
   trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraintDescriptor.java
   trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java
   trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverFactory.java
   trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java
   trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentLoader.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintDescriptor.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintExpansion.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintResolutionHandler.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolver.java
   trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolverFactory.java
   trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolver.java
   trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraintDescriptor.java
   trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolver.java
   trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
   trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java
   trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java
   trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java
   trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraintDescriptor.java
   trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java
   trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.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/ConstraintOperations.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/ExhaustiveTransitiveFunction.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/InternalResolver.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/PrimitiveConstraintDescriptor.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/RestoreOperation.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/TestDef.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
   trunk/src/jar/server-local/java/org/mulgara/server/local/LocalSessionFactory.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteJRDFSession.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
   trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java
   trunk/src/jar/tag/java/org/mulgara/extractor/tag/InitTag.java
Log:
Renaming classes from "Model" to "Graph"

Modified: trunk/src/jar/ant-task/java/org/mulgara/ant/task/rdf/RDFLoadUnitTest.java
===================================================================
--- trunk/src/jar/ant-task/java/org/mulgara/ant/task/rdf/RDFLoadUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/ant-task/java/org/mulgara/ant/task/rdf/RDFLoadUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -278,7 +278,7 @@
     answer.beforeFirst();
 
     if (answer.isUnconstrained() || !answer.next()) {
-      fail("Model was not created!");
+      fail("Graph was not created!");
     }
     assertEquals("Query should not return multiple answers", list.size(), 1);
     answer.close();
@@ -297,7 +297,7 @@
     answer.beforeFirst();
 
     if (answer.next()) {
-      fail("Model was not dropped!");
+      fail("Graph was not dropped!");
     }
     assertEquals("Query should not return multiple answers", list.size(), 1);
     answer.close();
@@ -307,7 +307,7 @@
 
     try {
       load.createModel();
-      fail("Model creation should have failed");
+      fail("Graph creation should have failed");
     } catch (BuildException be) {
     }
 
@@ -317,7 +317,7 @@
     try {
       load.interpreter = null;
       load.execute();
-      fail("Model creation should have failed");
+      fail("Graph creation should have failed");
     } catch (BuildException be) {
     }
   }

Modified: trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/ItqlGraphProxy.java
===================================================================
--- trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/ItqlGraphProxy.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/ItqlGraphProxy.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -112,7 +112,7 @@
 
     if (modelURI == null) {
 
-      throw new GraphException("Model URI cannot be null.");
+      throw new GraphException("Graph URI cannot be null.");
     }
 
     //initialize members

Modified: trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/SessionGraphProxy.java
===================================================================
--- trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/SessionGraphProxy.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/itql/SessionGraphProxy.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -111,7 +111,7 @@
 
     if (modelURI == null) {
 
-      throw new GraphException("Model URI cannot be null.");
+      throw new GraphException("Graph URI cannot be null.");
     }
 
     //initialize members

Modified: trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/test/RemoteAnswerCloneUnitTest.java
===================================================================
--- trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/test/RemoteAnswerCloneUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/test/RemoteAnswerCloneUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -27,18 +27,15 @@
 
 package org.mulgara.client.jrdf.test;
 
-import java.io.*;
 
 import org.jrdf.graph.*;
-import org.jrdf.vocabulary.*;
+import org.jrdf.graph.Graph;
 
 // Third party packages
 import junit.framework.*;
 import java.net.*;
 import java.util.*;
-import org.jrdf.graph.mem.*;
 import org.mulgara.client.jrdf.*;
-import org.mulgara.jrdf.*;
 import org.mulgara.query.*;
 import org.mulgara.query.rdf.LiteralImpl;
 import org.mulgara.query.rdf.TripleImpl;
@@ -109,11 +106,11 @@
   public Graph newGraph() throws Exception {
 
     //reset graph
-    this.dropModel(this.modelURI);
-    this.createModel(this.modelURI);
+    dropModel(modelURI);
+    createModel(modelURI);
 
     //create and return graph
-    return AbstractGraphFactory.createGraph(this.serverURI, this.modelURI);
+    return AbstractGraphFactory.createGraph(serverURI, modelURI);
   }
 
   /**
@@ -151,40 +148,40 @@
     try {
 
       //test answer with entire graph
-      Answer answer = this.session.find(this.modelURI, null, null, null);
-      this.testClone(answer);
+      Answer answer = session.find(modelURI, null, null, null);
+      testClone(answer);
 
       //test constrained answers
-      Answer constrainedS = this.session.find(this.modelURI, this.reference1,
+      Answer constrainedS = session.find(modelURI, reference1,
           null, null);
-      this.testClone(constrainedS);
+      testClone(constrainedS);
 
-      Answer constrainedP = this.session.find(this.modelURI, null,
-          this.reference1, null);
-      this.testClone(constrainedP);
+      Answer constrainedP = session.find(modelURI, null,
+          reference1, null);
+      testClone(constrainedP);
 
-      Triple constrainedTripleO = new TripleImpl(null, null, this.reference1);
-      Answer constrainedO = this.session.find(this.modelURI,
+      Triple constrainedTripleO = new TripleImpl(null, null, reference1);
+      Answer constrainedO = session.find(modelURI,
           constrainedTripleO.getSubject(), constrainedTripleO.getPredicate(),
           constrainedTripleO.getObject());
-      this.testClone(constrainedO);
+      testClone(constrainedO);
 
-      Answer constrainedSP = this.session.find(this.modelURI, this.reference1,
-          this.reference1, null);
-      this.testClone(constrainedSP);
+      Answer constrainedSP = session.find(modelURI, reference1,
+          reference1, null);
+      testClone(constrainedSP);
 
-      Answer constrainedPO = this.session.find(this.modelURI, null,
-          this.reference1, this.reference1);
-      this.testClone(constrainedPO);
+      Answer constrainedPO = session.find(modelURI, null,
+          reference1, reference1);
+      testClone(constrainedPO);
 
-      Answer constrainedOS = this.session.find(this.modelURI, this.reference1,
-          null, this.reference1);
-      this.testClone(constrainedOS);
+      Answer constrainedOS = session.find(modelURI, reference1,
+          null, reference1);
+      testClone(constrainedOS);
 
       //test unconstrained answer
-      Answer unconstrained = this.session.find(this.modelURI, this.reference1,
-          this.reference1, this.reference1);
-      this.testClone(unconstrained);
+      Answer unconstrained = session.find(modelURI, reference1,
+          reference1, reference1);
+      testClone(unconstrained);
     } catch (Exception exception) {
 
       exception.printStackTrace();
@@ -244,38 +241,38 @@
     try {
 
       //test answer with entire graph
-      Answer answer = this.session.find(this.modelURI, null, null, null);
-      this.testCloneOfClones(answer);
+      Answer answer = session.find(modelURI, null, null, null);
+      testCloneOfClones(answer);
 
       //test constrained answers
-      Answer constrainedS = this.session.find(this.modelURI, this.reference1,
+      Answer constrainedS = session.find(modelURI, reference1,
           null, null);
-      this.testCloneOfClones(constrainedS);
+      testCloneOfClones(constrainedS);
 
-      Answer constrainedP = this.session.find(this.modelURI, null,
-          this.reference1, null);
-      this.testCloneOfClones(constrainedP);
+      Answer constrainedP = session.find(modelURI, null,
+          reference1, null);
+      testCloneOfClones(constrainedP);
 
-      Answer constrainedO = this.session.find(this.modelURI, null, null,
-          this.reference1);
-      this.testCloneOfClones(constrainedO);
+      Answer constrainedO = session.find(modelURI, null, null,
+          reference1);
+      testCloneOfClones(constrainedO);
 
-      Answer constrainedSP = this.session.find(this.modelURI, this.reference1,
-          this.reference1, null);
-      this.testCloneOfClones(constrainedSP);
+      Answer constrainedSP = session.find(modelURI, reference1,
+          reference1, null);
+      testCloneOfClones(constrainedSP);
 
-      Answer constrainedPO = this.session.find(this.modelURI, null,
-          this.reference1, this.reference1);
-      this.testCloneOfClones(constrainedPO);
+      Answer constrainedPO = session.find(modelURI, null,
+          reference1, reference1);
+      testCloneOfClones(constrainedPO);
 
-      Answer constrainedOS = this.session.find(this.modelURI, this.reference1,
-          null, this.reference1);
-      this.testCloneOfClones(constrainedOS);
+      Answer constrainedOS = session.find(modelURI, reference1,
+          null, reference1);
+      testCloneOfClones(constrainedOS);
 
       //test unconstrained answer
-      Answer unconstrained = this.session.find(this.modelURI, this.reference1,
-          this.reference1, this.reference1);
-      this.testCloneOfClones(unconstrained);
+      Answer unconstrained = session.find(modelURI, reference1,
+          reference1, reference1);
+      testCloneOfClones(unconstrained);
     } catch (Exception exception) {
 
       exception.printStackTrace();
@@ -297,10 +294,10 @@
     Answer answerCloneCloneClone = (Answer) answerCloneClone.clone();
 
     //test each level (also closes)
-    this.testClone(original);
-    this.testClone(answerClone);
-    this.testClone(answerCloneClone);
-    this.testClone(answerCloneCloneClone);
+    testClone(original);
+    testClone(answerClone);
+    testClone(answerCloneClone);
+    testClone(answerCloneCloneClone);
   }
 
   /**
@@ -310,7 +307,7 @@
    */
   private void populate() throws Exception {
 
-    Set triples = new HashSet();
+    Set<Triple> triples = new HashSet<Triple>();
 
     //create triples that can be searched for
     triples.add(new TripleImpl(reference1, reference1, literal));
@@ -342,7 +339,7 @@
     }
 
     //insert
-    this.session.insert(this.modelURI, triples);
+    session.insert(modelURI, triples);
 
   }
 
@@ -359,35 +356,31 @@
     try {
 
       String hostname = InetAddress.getLocalHost().getCanonicalHostName();
-      this.serverURI = new URI("rmi", hostname, "/" + SERVER_NAME, null);
-      this.modelURI = new URI("rmi", hostname, "/" + SERVER_NAME, MODEL_NAME);
+      serverURI = new URI("rmi", hostname, "/" + SERVER_NAME, null);
+      modelURI = new URI("rmi", hostname, "/" + SERVER_NAME, MODEL_NAME);
 
       //get session
       SessionFactory sessionFactory = SessionFactoryFinder.newSessionFactory(
-          this.serverURI, true);
-      this.session = (JRDFSession) sessionFactory.newJRDFSession();
+          serverURI, true);
+      session = (JRDFSession) sessionFactory.newJRDFSession();
 
       //create test triples
-      this.reference1 = new URIReferenceImpl(new URI("http://mulgara.org/mulgara#testReference"));
-      this.reference2 = new URIReferenceImpl(new URI("http://mulgara.org/mulgara#testReference2"));
-      this.literal = new LiteralImpl("test Literal");
+      reference1 = new URIReferenceImpl(new URI("http://mulgara.org/mulgara#testReference"));
+      reference2 = new URIReferenceImpl(new URI("http://mulgara.org/mulgara#testReference2"));
+      literal = new LiteralImpl("test Literal");
 
       //initialize model
-      this.createModel(this.modelURI);
-      this.populate();
+      createModel(modelURI);
+      populate();
 
       //let superclass set up too
       super.setUp();
-    }
-    catch (Exception exception) {
+    } catch (Exception exception) {
 
       //try to tear down first
       try {
-
         tearDown();
-      }
-      finally {
-
+      } catch (Throwable t) {
         throw exception;
       }
     }
@@ -400,7 +393,7 @@
    */
   public void tearDown() throws Exception {
 
-    this.dropModel(this.modelURI);
+    dropModel(modelURI);
 
     //allow super to close down too
     super.tearDown();
@@ -414,7 +407,7 @@
    */
   private void createModel(URI modelURI) throws Exception {
 
-    this.session.createModel(modelURI, new URI("http://mulgara.org/mulgara#Model"));
+    session.createModel(modelURI, new URI("http://mulgara.org/mulgara#Model"));
   }
 
   /**
@@ -425,6 +418,6 @@
    */
   private void dropModel(URI modelURI) throws Exception {
 
-    this.session.removeModel(modelURI);
+    session.removeModel(modelURI);
   }
 }

Modified: trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/writer/MemoryXMLWriter.java
===================================================================
--- trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/writer/MemoryXMLWriter.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/client-jrdf/java/org/mulgara/client/jrdf/writer/MemoryXMLWriter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -42,7 +42,7 @@
 import org.jrdf.graph.GraphException;
 import org.jrdf.util.ClosableIterator;
 import org.jrdf.graph.*;
-//import org.mulgara.store.exporter.ModelXMLWriter;
+//import org.mulgara.store.exporter.GraphXMLWriter;
 import org.mulgara.client.jrdf.util.*;
 import org.mulgara.util.StringUtil;
 
@@ -116,7 +116,7 @@
     }
     catch (IOException ioException) {
 
-      throw new GraphException("Could not write Model.", ioException);
+      throw new GraphException("Could not write Graph.", ioException);
     }
   }
 
@@ -147,7 +147,7 @@
     }
     catch (IOException ioException) {
 
-      throw new GraphException("Could not write Model.", ioException);
+      throw new GraphException("Could not write Graph.", ioException);
     }
   }
 
@@ -313,7 +313,7 @@
   }
 
   /**
-   * Writes the Model's statements as RDF/XML to the print Writer.
+   * Writes the Graph's statements as RDF/XML to the print Writer.
    *
    * @param graph Graph
    * @param out PrintWriter
@@ -360,7 +360,7 @@
     else {
 
       //message for exception to be thrown
-      String message = "Could not write Model. Invlaid arguments provided. ";
+      String message = "Could not write Graph. Invlaid arguments provided. ";
 
       if (out == null) {
 

Deleted: trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java
===================================================================
--- trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,292 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.content.mbox.parser.model;
-
-import java.util.Set;
-import java.util.Properties;
-import java.io.*;
-import java.net.URL;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.mulgara.content.mbox.parser.model.exception.*;
-
-import org.apache.log4j.Logger;
-
-/**
- * Factory used to create implementations of the parsers used by the mbox
- * resolver.  Which implementation is used is determined by the factory
- * configuration.
- *
- * @created 2004-08-24
- *
- * @author Mark Ludlow
- *
- * @version $Revision: 1.7 $
- *
- * @modified $Date: 2005/01/05 04:57:42 $ by $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy;2002-2004
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Quoll License</a>
- */
-public class ModelFactory {
-
-  /** The logger */
-  private static Logger log = Logger.getLogger(ModelFactory.class);
-
-  /** The singleton instance of this class */
-  private static ModelFactory instance = null;
-
-  /** The properties determining which implementation to use */
-  private static Properties properties;
-
-  /**
-   * Constructor.  Creates and initialises the console factory.
-   */
-  private ModelFactory() throws FactoryException {
-
-    // Perform initialisation of the factory
-    initialiseFactory();
-  }
-
-  /**
-   * Get the ModelFactory instance.
-   *
-   * @return The ModelFactory singleton instance.
-   *
-   * @throws FactoryException
-   */
-  public static ModelFactory getInstance() throws FactoryException {
-
-    if (instance == null) {
-
-      synchronized (ModelFactory.class) {
-
-        if (instance == null) {
-
-          // Create the factory
-          instance = new ModelFactory();
-        }
-      }
-    }
-
-    return instance;
-  }
-
-  /**
-   * Initialises the factory by reading in the configuration and any other setup
-   * functions.
-   *
-   * @throws FactoryException
-   */
-  private void initialiseFactory() throws FactoryException {
-
-    // Initialise our properties
-    properties = new Properties();
-
-    // Retrieve the resource url for our configuration file
-    URL parserConfiguration = this.getClass().getResource("/modelfactory.conf");
-
-    try {
-
-      // Load the properties for the parser factory using the stream from the URL
-      properties.load(parserConfiguration.openStream());
-    } catch (IOException ioException) {
-
-      throw new FactoryException("Unable to load the parser factory " +
-                                 "configuration from: " +
-                                 parserConfiguration.toString(), ioException);
-    }
-  }
-
-  /**
-   * Creates and returns an instance of the class defined by
-   * "classNameProperty" in the properties file. Any parameters for the
-   * constructor are also passed in and used when constructing a new instance.
-   * Returned Object needs to be cast to correct type.
-   *
-   * @param classNameProperty The proprty which holds the class name to
-   *                          instantiate
-   * @param classType The class type to create the object in
-   * @param parameterTypes The List of type for the constructor parameters
-   * @param parameters The actual parameter values, matching the types array
-   *
-   * @return Object
-   *
-   * @throws FactoryException
-   */
-  private Object createObject(String classNameProperty, String classType,
-                              Class[] parameterTypes, Object[] parameters) throws
-      FactoryException {
-
-    //The instance of the "classNameProperty" to be returned
-    Object object = null;
-
-    //class that classNameProperty represents from the properties file
-    Class objectClass = null;
-
-    //class type that object should be instantiated as
-    Class type = null;
-
-    // Constructor for our object
-    Constructor constructor = null;
-
-    try {
-
-      //Get the objectClass
-      objectClass = Class.forName(properties.getProperty(classNameProperty));
-
-      //set type as Class "classType"
-      type = Class.forName(classType);
-
-      try {
-
-        // Get the constructor we are after by parameter types
-        constructor = objectClass.getConstructor(parameterTypes);
-      } catch (NoSuchMethodException noSuchMethodException) {
-
-        // Container for type string
-        String types = "";
-
-        for (int i = 0; i < parameterTypes.length; i++) {
-
-          // Add the next parameter type name
-          types += parameterTypes[i].getName() + ", ";
-        }
-
-        // An exception has occurred so report it and throw it as a factory exception
-        log.error("Constructor with parameters [" + types + "] was not found.",
-                  noSuchMethodException);
-        throw new FactoryException("Constructor with parameters [" + types +
-                                   "] was not found.",
-                                   noSuchMethodException);
-      }
-
-      // Instantiate an instance of the class
-      object = constructor.newInstance(parameters);
-    } catch (ClassNotFoundException classNotFoundException) {
-
-      // An exception has occurred so report it and throw it as a factory exception
-      log.error(classNameProperty + " was not found.",
-                classNotFoundException);
-      throw new FactoryException(classNameProperty + " was not found.",
-                                 classNotFoundException);
-    } catch (InstantiationException instantiationException) {
-
-      // An exception has occurred so report it and throw it as a factory exception
-      log.error("Could not instantiate " + classNameProperty + ".",
-                instantiationException);
-      throw new FactoryException("Could not instantiate " + classNameProperty
-                                 + ".", instantiationException);
-    } catch (IllegalAccessException illegalAccessException) {
-
-      // An exception has occurred so report it and throw it as a factory exception
-      log.error("Illegal access when creating " + classNameProperty + ".",
-                illegalAccessException);
-      throw new FactoryException("Illegal access when creating "
-                                 + classNameProperty + ".",
-                                 illegalAccessException);
-    } catch (InvocationTargetException invocationTargetException) {
-
-      // An exception has occurred so report it and throw it as a factory exception
-      log.error("Could not find target constructor for " + classNameProperty +
-                ".",
-                invocationTargetException);
-      throw new FactoryException("Could not find target constructor for " +
-                                 classNameProperty + ".",
-                                 invocationTargetException);
-    }
-
-    if (type.isInstance(object)) {
-
-      //return the instance of the class as java.lang.Object
-      return object;
-
-    } else {
-
-      throw new FactoryException(classNameProperty + " could not be " +
-                                 "instantiated because it is not a valid " +
-                                 type.getName() + " class");
-    }
-  }
-
-  /**
-   * Creates an mbox file object using the implementation specified in the
-   * properties and returns it.
-   *
-   * @param parameterTypes Any parameter types of constructor parameters
-   * @param parameters The parameter values matching the types for the
-   *                   constructor
-   *
-   * @return The created mbox object
-   */
-  public MBox createMBox(Class[] parameterTypes, Object[] parameters) throws
-      FactoryException {
-
-    // Container for parser object
-    MBox mbox = null;
-
-    // Create an instance of the class defined in the properties file
-    mbox = (MBox)this.createObject("mbox.class", MBox.class.getName(),
-                                   parameterTypes, parameters);
-
-    // Return the parser instance
-    return mbox;
-  }
-
-  /**
-   * Creates an MBox management object using the implementation specified in the
-   * properties and returns it.
-   *
-   * @return The created mbox manager object
-   */
-  public MBoxManager createMBoxManager() throws FactoryException {
-
-    // Container for parser object
-    MBoxManager mboxManager = null;
-
-    // Create an array of the types for the mbox constructor
-    Class[] parameterTypes = new Class[0];
-
-    // Create an array of parameters for the mbox constructor
-    Object[] parameters = new Object[0];
-
-    // Create an instance of the class defined in the properties file
-    mboxManager = (MBoxManager)this.createObject("mboxmanager.class",
-                                                 MBoxManager.class.getName(),
-                                                 parameterTypes, parameters);
-
-    // Return the parser instance
-    return mboxManager;
-  }
-
-}

Copied: trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java (from rev 1397, trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java)
===================================================================
--- trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java	                        (rev 0)
+++ trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,292 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.content.mbox.parser.model;
+
+import java.util.Set;
+import java.util.Properties;
+import java.io.*;
+import java.net.URL;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.mulgara.content.mbox.parser.model.exception.*;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Factory used to create implementations of the parsers used by the mbox
+ * resolver.  Which implementation is used is determined by the factory
+ * configuration.
+ *
+ * @created 2004-08-24
+ *
+ * @author Mark Ludlow
+ *
+ * @version $Revision: 1.7 $
+ *
+ * @modified $Date: 2005/01/05 04:57:42 $ by $Author: newmana $
+ *
+ * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
+ *
+ * @copyright &copy;2002-2004
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Quoll License</a>
+ */
+public class ModelFactory {
+
+  /** The logger */
+  private static Logger log = Logger.getLogger(ModelFactory.class);
+
+  /** The singleton instance of this class */
+  private static ModelFactory instance = null;
+
+  /** The properties determining which implementation to use */
+  private static Properties properties;
+
+  /**
+   * Constructor.  Creates and initialises the console factory.
+   */
+  private ModelFactory() throws FactoryException {
+
+    // Perform initialisation of the factory
+    initialiseFactory();
+  }
+
+  /**
+   * Get the ModelFactory instance.
+   *
+   * @return The ModelFactory singleton instance.
+   *
+   * @throws FactoryException
+   */
+  public static ModelFactory getInstance() throws FactoryException {
+
+    if (instance == null) {
+
+      synchronized (ModelFactory.class) {
+
+        if (instance == null) {
+
+          // Create the factory
+          instance = new ModelFactory();
+        }
+      }
+    }
+
+    return instance;
+  }
+
+  /**
+   * Initialises the factory by reading in the configuration and any other setup
+   * functions.
+   *
+   * @throws FactoryException
+   */
+  private void initialiseFactory() throws FactoryException {
+
+    // Initialise our properties
+    properties = new Properties();
+
+    // Retrieve the resource url for our configuration file
+    URL parserConfiguration = this.getClass().getResource("/modelfactory.conf");
+
+    try {
+
+      // Load the properties for the parser factory using the stream from the URL
+      properties.load(parserConfiguration.openStream());
+    } catch (IOException ioException) {
+
+      throw new FactoryException("Unable to load the parser factory " +
+                                 "configuration from: " +
+                                 parserConfiguration.toString(), ioException);
+    }
+  }
+
+  /**
+   * Creates and returns an instance of the class defined by
+   * "classNameProperty" in the properties file. Any parameters for the
+   * constructor are also passed in and used when constructing a new instance.
+   * Returned Object needs to be cast to correct type.
+   *
+   * @param classNameProperty The proprty which holds the class name to
+   *                          instantiate
+   * @param classType The class type to create the object in
+   * @param parameterTypes The List of type for the constructor parameters
+   * @param parameters The actual parameter values, matching the types array
+   *
+   * @return Object
+   *
+   * @throws FactoryException
+   */
+  private Object createObject(String classNameProperty, String classType,
+                              Class[] parameterTypes, Object[] parameters) throws
+      FactoryException {
+
+    //The instance of the "classNameProperty" to be returned
+    Object object = null;
+
+    //class that classNameProperty represents from the properties file
+    Class objectClass = null;
+
+    //class type that object should be instantiated as
+    Class type = null;
+
+    // Constructor for our object
+    Constructor constructor = null;
+
+    try {
+
+      //Get the objectClass
+      objectClass = Class.forName(properties.getProperty(classNameProperty));
+
+      //set type as Class "classType"
+      type = Class.forName(classType);
+
+      try {
+
+        // Get the constructor we are after by parameter types
+        constructor = objectClass.getConstructor(parameterTypes);
+      } catch (NoSuchMethodException noSuchMethodException) {
+
+        // Container for type string
+        String types = "";
+
+        for (int i = 0; i < parameterTypes.length; i++) {
+
+          // Add the next parameter type name
+          types += parameterTypes[i].getName() + ", ";
+        }
+
+        // An exception has occurred so report it and throw it as a factory exception
+        log.error("Constructor with parameters [" + types + "] was not found.",
+                  noSuchMethodException);
+        throw new FactoryException("Constructor with parameters [" + types +
+                                   "] was not found.",
+                                   noSuchMethodException);
+      }
+
+      // Instantiate an instance of the class
+      object = constructor.newInstance(parameters);
+    } catch (ClassNotFoundException classNotFoundException) {
+
+      // An exception has occurred so report it and throw it as a factory exception
+      log.error(classNameProperty + " was not found.",
+                classNotFoundException);
+      throw new FactoryException(classNameProperty + " was not found.",
+                                 classNotFoundException);
+    } catch (InstantiationException instantiationException) {
+
+      // An exception has occurred so report it and throw it as a factory exception
+      log.error("Could not instantiate " + classNameProperty + ".",
+                instantiationException);
+      throw new FactoryException("Could not instantiate " + classNameProperty
+                                 + ".", instantiationException);
+    } catch (IllegalAccessException illegalAccessException) {
+
+      // An exception has occurred so report it and throw it as a factory exception
+      log.error("Illegal access when creating " + classNameProperty + ".",
+                illegalAccessException);
+      throw new FactoryException("Illegal access when creating "
+                                 + classNameProperty + ".",
+                                 illegalAccessException);
+    } catch (InvocationTargetException invocationTargetException) {
+
+      // An exception has occurred so report it and throw it as a factory exception
+      log.error("Could not find target constructor for " + classNameProperty +
+                ".",
+                invocationTargetException);
+      throw new FactoryException("Could not find target constructor for " +
+                                 classNameProperty + ".",
+                                 invocationTargetException);
+    }
+
+    if (type.isInstance(object)) {
+
+      //return the instance of the class as java.lang.Object
+      return object;
+
+    } else {
+
+      throw new FactoryException(classNameProperty + " could not be " +
+                                 "instantiated because it is not a valid " +
+                                 type.getName() + " class");
+    }
+  }
+
+  /**
+   * Creates an mbox file object using the implementation specified in the
+   * properties and returns it.
+   *
+   * @param parameterTypes Any parameter types of constructor parameters
+   * @param parameters The parameter values matching the types for the
+   *                   constructor
+   *
+   * @return The created mbox object
+   */
+  public MBox createMBox(Class[] parameterTypes, Object[] parameters) throws
+      FactoryException {
+
+    // Container for parser object
+    MBox mbox = null;
+
+    // Create an instance of the class defined in the properties file
+    mbox = (MBox)this.createObject("mbox.class", MBox.class.getName(),
+                                   parameterTypes, parameters);
+
+    // Return the parser instance
+    return mbox;
+  }
+
+  /**
+   * Creates an MBox management object using the implementation specified in the
+   * properties and returns it.
+   *
+   * @return The created mbox manager object
+   */
+  public MBoxManager createMBoxManager() throws FactoryException {
+
+    // Container for parser object
+    MBoxManager mboxManager = null;
+
+    // Create an array of the types for the mbox constructor
+    Class[] parameterTypes = new Class[0];
+
+    // Create an array of parameters for the mbox constructor
+    Object[] parameters = new Object[0];
+
+    // Create an instance of the class defined in the properties file
+    mboxManager = (MBoxManager)this.createObject("mboxmanager.class",
+                                                 MBoxManager.class.getName(),
+                                                 parameterTypes, parameters);
+
+    // Return the parser instance
+    return mboxManager;
+  }
+
+}


Property changes on: trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/parser/model/ModelFactory.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/parser/ID3ParsersUnitTest.java
===================================================================
--- trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/parser/ID3ParsersUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/parser/ID3ParsersUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -326,7 +326,7 @@
           // Obtain the next triple
           Triple triple = (Triple) iterator.next();
 
-          log.debug(">> Model triple [" + triple.getSubject() +
+          log.debug(">> Graph triple [" + triple.getSubject() +
               ", " + triple.getPredicate() + ", " +
               triple.getObject() + "]");
         }
@@ -567,7 +567,7 @@
 
           // Get the next triple
           Triple triple = (Triple) iterator.next();
-          System.err.println(">> Model triple [" + triple.getSubject() + ", " +
+          System.err.println(">> Graph triple [" + triple.getSubject() + ", " +
                     triple.getPredicate() + ", " + triple.getObject() + "]");
         }
       } catch (GraphException graphException) {

Modified: trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriter.java
===================================================================
--- trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriter.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/writer/RDFXMLWriter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -330,7 +330,7 @@
   }
 
   /**
-   * Writes the Model's statements as RDF/XML to the print Writer.
+   * Writes the Graph's statements as RDF/XML to the print Writer.
    *
    * @param statements Statements
    * @param session ResolverSession

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/AbstractModel.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/AbstractModel.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/AbstractModel.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -54,7 +54,7 @@
 import java.net.URLEncoder;
 
 /**
- * Base class for Model.
+ * Base class for Graph.
  *
  * @created 2004-12-03
  *
@@ -93,13 +93,13 @@
   /** Used to perform queries */
   private ItqlInterpreterBean bean = null;
 
-  /** The Resource that the Model represents */
+  /** The Resource that the Graph represents */
   private URIReference resource = null;
 
-  /** Used to determine if the Model has been initialized */
+  /** Used to determine if the Graph has been initialized */
   private boolean initialized = false;
 
-  /** Type of the Model */
+  /** Type of the Graph */
   private URIReference type = null;
 
   /**
@@ -140,7 +140,7 @@
   }
 
   /**
-   * Sets the Model's type.
+   * Sets the Graph's type.
    * @param model URIReference
    */
   public void setType(URIReference type) {
@@ -148,7 +148,7 @@
   }
 
   /**
-   * Returns the Resource URI that represents the Model's type.
+   * Returns the Resource URI that represents the Graph's type.
    * @return URIReference
    */
   public URIReference getType() {
@@ -178,7 +178,7 @@
   }
 
   /**
-   * Creates the Model with the specified type, or the default Model type if
+   * Creates the Graph with the specified type, or the default Graph type if
    * 'type' null.
    *
    * @param type URIReference
@@ -187,7 +187,7 @@
   public void create() throws QueryException {
     checkInitialized();
     try {
-      String typeURI = (type == null) ? Mulgara.NAMESPACE + "Model" :
+      String typeURI = (type == null) ? Mulgara.NAMESPACE + "Graph" :
           type.getURI().toString();
       getBean().executeUpdate("create <" + getResource().getURI() + "> " +
           "<" + typeURI + "> ;");
@@ -214,7 +214,7 @@
   }
 
   /**
-   * Drops the Model and then re-creates it.
+   * Drops the Graph and then re-creates it.
    *
    * @throws QueryException
    */
@@ -291,7 +291,7 @@
   }
 
   /**
-   * Throw an Exception if the Model has not been initialized.
+   * Throw an Exception if the Graph has not been initialized.
    * @throws IllegalStateException
    */
   protected void checkInitialized() throws IllegalStateException {
@@ -300,7 +300,7 @@
         initialized = true;
       }
       else {
-        throw new IllegalStateException("Model has not been Initialized.");
+        throw new IllegalStateException("Graph has not been Initialized.");
       }
     }
   }

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/FileSystemModelImpl.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/FileSystemModelImpl.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/FileSystemModelImpl.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -248,7 +248,7 @@
   }
 
   /**
-   * Returns a Resource representing the Definition Model Resource
+   * Returns a Resource representing the Definition Graph Resource
    *
    * @return URIReference
    * @throws URISyntaxException

Deleted: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,149 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.demo.mp3;
-
-// Java 2 standard packages
-
-// JRDF
-import org.jrdf.graph.URIReference;
-
-// Local packages
-import org.mulgara.query.QueryException;
-
-import java.util.*;
-import org.jrdf.util.*;
-
-/**
- * Generic methods for Model management.
- *
- * @created 2004-12-03
- *
- * @author <a href="mailto:robert.turner at tucanatech.com">Robert Turner</a>
- *
- * @version $Revision: 1.3 $
- *
- * @modified $Date: 2005/01/05 04:58:06 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
- *   Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public interface Model {
-
-  /**
-   * Initializes the Model.
-   *
-   * @param context ModelContext
-   * @throws Exception
-   */
-  public void init(ModelContext context) throws Exception;
-
-  /**
-   * Sets the Resource URI that is being represented.
-   * @param model URIReference
-   */
-  public void setResource(URIReference model);
-
-  /**
-   * Returns the Resource URI that is being represented.
-   * @return URIReference
-   */
-  public URIReference getResource();
-
-  /**
-   * Sets the Model's type.
-   * @param model URIReference
-   */
-  public void setType(URIReference type);
-
-  /**
-   * Returns the Resource URI that represents the Model's type.
-   * @return URIReference
-   */
-  public URIReference getType();
-
-  /**
-   * Returns a ClosableIterator of Triples that are returned from the model
-   * using the property-value pairs as constraints. Any null values are
-   * replaced by the relevant variable name.
-   *
-   * @param properties Iterator containing PredicateNodes
-   * @param values Iterator containing ObjectNodes (non-Blank)
-   * @throws QueryException
-   * @return ClosableIterator
-   */
-  public ClosableIterator find(Iterator properties,
-      Iterator values) throws QueryException;
-
-  /**
-   * Executes the query and returns the results as a ClosableIterator. Query
-   * must return three columns that represent subject, predicate and object.
-   *
-   * @param query String
-   * @throws Exception
-   * @return ClosableIterator
-   */
-  public ClosableIterator query(String query) throws Exception;
-
-  /**
-   * Creates the Model with the type set by setType(), or the default Model
-   * type if 'type' null (or not set).
-   * @throws QueryException
-   */
-  public void create() throws QueryException;
-
-  /**
-   * Deletes any persistant resources.
-   *
-   * @throws QueryException
-   */
-  public void delete() throws QueryException;
-
-  /**
-   * Deletes all statements in the Model.
-   *
-   * @throws QueryException
-   */
-  public void clear() throws QueryException;
-
-  /**
-   * Frees any resources allocated.
-   */
-  public void close();
-
-  /**
-   * Returns true if the Model has been initialized.
-   * @return boolean
-   */
-  public boolean hasInitialized();
-}

Copied: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java (from rev 1397, trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java)
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java	                        (rev 0)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,149 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.demo.mp3;
+
+// Java 2 standard packages
+
+// JRDF
+import org.jrdf.graph.URIReference;
+
+// Local packages
+import org.mulgara.query.QueryException;
+
+import java.util.*;
+import org.jrdf.util.*;
+
+/**
+ * Generic methods for Graph management.
+ *
+ * @created 2004-12-03
+ *
+ * @author <a href="mailto:robert.turner at tucanatech.com">Robert Turner</a>
+ *
+ * @version $Revision: 1.3 $
+ *
+ * @modified $Date: 2005/01/05 04:58:06 $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
+ *
+ * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
+ *   Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public interface Model {
+
+  /**
+   * Initializes the Graph.
+   *
+   * @param context ModelContext
+   * @throws Exception
+   */
+  public void init(ModelContext context) throws Exception;
+
+  /**
+   * Sets the Resource URI that is being represented.
+   * @param model URIReference
+   */
+  public void setResource(URIReference model);
+
+  /**
+   * Returns the Resource URI that is being represented.
+   * @return URIReference
+   */
+  public URIReference getResource();
+
+  /**
+   * Sets the Graph's type.
+   * @param model URIReference
+   */
+  public void setType(URIReference type);
+
+  /**
+   * Returns the Resource URI that represents the Graph's type.
+   * @return URIReference
+   */
+  public URIReference getType();
+
+  /**
+   * Returns a ClosableIterator of Triples that are returned from the model
+   * using the property-value pairs as constraints. Any null values are
+   * replaced by the relevant variable name.
+   *
+   * @param properties Iterator containing PredicateNodes
+   * @param values Iterator containing ObjectNodes (non-Blank)
+   * @throws QueryException
+   * @return ClosableIterator
+   */
+  public ClosableIterator find(Iterator properties,
+      Iterator values) throws QueryException;
+
+  /**
+   * Executes the query and returns the results as a ClosableIterator. Query
+   * must return three columns that represent subject, predicate and object.
+   *
+   * @param query String
+   * @throws Exception
+   * @return ClosableIterator
+   */
+  public ClosableIterator query(String query) throws Exception;
+
+  /**
+   * Creates the Graph with the type set by setType(), or the default Graph
+   * type if 'type' null (or not set).
+   * @throws QueryException
+   */
+  public void create() throws QueryException;
+
+  /**
+   * Deletes any persistant resources.
+   *
+   * @throws QueryException
+   */
+  public void delete() throws QueryException;
+
+  /**
+   * Deletes all statements in the Graph.
+   *
+   * @throws QueryException
+   */
+  public void clear() throws QueryException;
+
+  /**
+   * Frees any resources allocated.
+   */
+  public void close();
+
+  /**
+   * Returns true if the Graph has been initialized.
+   * @return boolean
+   */
+  public boolean hasInitialized();
+}


Property changes on: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Model.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ControllerImpl.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ControllerImpl.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ControllerImpl.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -86,13 +86,13 @@
   /** Where the fsModel stores it's information */
   private URIReference fsModelResource = null;
 
-  /** Type of Model to store Mp3s information */
+  /** Type of Graph to store Mp3s information */
   private URIReference mp3ModelType = null;
 
-  /** Type of Model to store Schema information */
+  /** Type of Graph to store Schema information */
   private URIReference schemaModelType = null;
 
-  /** Type of Model to store FileSystem information */
+  /** Type of Graph to store FileSystem information */
   private URIReference fsModelType = null;
 
   /** Returned by getMp3Model */
@@ -213,8 +213,8 @@
   }
 
   /**
-   * Closes the Model
-   * @param model Model
+   * Closes the Graph
+   * @param model Graph
    */
   private void close(Model model) {
     if (model != null) {

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3FileImpl.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3FileImpl.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3FileImpl.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -77,10 +77,10 @@
   /** Used to execute iTQL queries */
   private ItqlInterpreterBean bean = null;
 
-  /** Model where the Mp3 metadata is stored */
+  /** Graph where the Mp3 metadata is stored */
   private Mp3Model model = null;
 
-  /** Model where schema information is stored */
+  /** Graph where schema information is stored */
   private SchemaModel schemaModel = null;
 
   /** Used to determine if this Mp3 is ready first use. */

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3Model.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3Model.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3Model.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -79,7 +79,7 @@
       QueryException, IllegalArgumentException;
 
   /**
-   * Sets the Model used to store Schema Information.
+   * Sets the Graph used to store Schema Information.
    * @param schemaModel SchemaModel
    * @throws IllegalArgumentException
    */
@@ -87,7 +87,7 @@
       IllegalArgumentException;
 
   /**
-   * Returns the Model used to store Schema Information.
+   * Returns the Graph used to store Schema Information.
    * @return SchemaModel
    */
   public SchemaModel getSchemaModel();

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ModelImpl.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ModelImpl.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/Mp3ModelImpl.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -75,7 +75,7 @@
     /** Listener used to notify caller of events */
     private Mp3ModelListener listener = null;
 
-    /** Model where Schema information is stored */
+    /** Graph where Schema information is stored */
     private SchemaModel schemaModel = null;
 
     /**
@@ -119,7 +119,7 @@
     }
 
     /**
-     * Sets the Model used to store Schema Information.
+     * Sets the Graph used to store Schema Information.
      * 
      * @param schemaModel
      *            SchemaModel
@@ -134,7 +134,7 @@
     }
 
     /**
-     * Returns the Model used to store Schema Information.
+     * Returns the Graph used to store Schema Information.
      * 
      * @return SchemaModel
      */

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModel.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModel.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModel.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -37,7 +37,7 @@
 import org.mulgara.query.QueryException;
 
 /**
- * Represents a Model containg RDF schema statements.
+ * Represents a Graph containg RDF schema statements.
  *
  * @created 2004-12-03
  *

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModelImpl.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModelImpl.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/SchemaModelImpl.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -41,7 +41,7 @@
 import org.mulgara.query.QueryException;
 
 /**
- * Represents a Model containg RDF schema statements.
+ * Represents a Graph containg RDF schema statements.
  *
  * @created 2004-12-03
  *

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/id3/AbstractId3Tag.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/id3/AbstractId3Tag.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/id3/AbstractId3Tag.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -81,10 +81,10 @@
   /** Used to perform queries */
   private ItqlInterpreterBean bean = null;
 
-  /** Model containing the Mp3 instance data */
+  /** Graph containing the Mp3 instance data */
   private Mp3Model model = null;
 
-  /** Model containing Schema information */
+  /** Graph containing Schema information */
   private SchemaModel schemaModel = null;
 
   /** Mp3File that this Tag represents. */

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/actions/ClearMp3ModelAction.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/actions/ClearMp3ModelAction.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/actions/ClearMp3ModelAction.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -86,7 +86,7 @@
       Mp3Controller controller = getMp3Controller();
       Mp3Model mp3Model = controller.getMp3Model();
       if (confirmClear(mp3Model.getResource())) {
-        getStatusPanel().startProcessing("Clearing Mp3 Model...");
+        getStatusPanel().startProcessing("Clearing Mp3 Graph...");
         mp3Model.clear();
         //underlying model/data has changed
         getSearchPanel().constraintsHaveChanged();
@@ -95,7 +95,7 @@
     }
     catch (Exception exception) {
       getStatusPanel().stopProcessingError("Error(s) occurred while clearing " +
-          "Mp3 Model");
+          "Mp3 Graph");
       ExceptionHandler.handleException(exception);
     }
   }
@@ -109,7 +109,7 @@
    */
   private boolean confirmClear(URIReference model) {
     String message = "Are you sure you want to delete all statements from " +
-        NEWLINE + "the following Model: " + NEWLINE +  model + "?";
+        NEWLINE + "the following Graph: " + NEWLINE +  model + "?";
     int decision = JOptionPane.showConfirmDialog(super.getSearchPanel(), message,
         "Confirm Clear Mp3 Metadata", JOptionPane.YES_NO_OPTION);
     //was 'Yes' chosen

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/results/Mp3List.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/results/Mp3List.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/results/Mp3List.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -68,7 +68,7 @@
    */
   private final static Logger log = Logger.getLogger(Mp3List.class.getName());
 
-  /** Model used to store list items */
+  /** Graph used to store list items */
   private DefaultListModel model = null;
 
   /** Renders the Mp3Files */

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/search/BrowserPanel.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/search/BrowserPanel.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/search/BrowserPanel.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -297,7 +297,7 @@
   }
 
   /**
-   * Registers the Constraint Listener with the Model.
+   * Registers the Constraint Listener with the Graph.
    * @param listener ConstraintListener
    * @throws IllegalArgumentException
    */

Modified: trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/widgets/PropertiesTable.java
===================================================================
--- trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/widgets/PropertiesTable.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/demo-mp3/java/org/mulgara/demo/mp3/swing/widgets/PropertiesTable.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -137,7 +137,7 @@
   }
 
   /**
-   * Returns the Model to be used to modify Table.
+   * Returns the Graph to be used to modify Table.
    * @return DefaultTableModel
    */
   private DefaultTableModel getTableModel() {

Modified: trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DeployServlet.java
===================================================================
--- trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DeployServlet.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DeployServlet.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -449,7 +449,7 @@
     if (clearLocalDescriptors) {
 
       query.append(
-          "# create,drop,create avoids Model not found exceptions" + eol);
+          "# create,drop,create avoids Graph not found exceptions" + eol);
       query.append("create <" + modelURIString + ">;" + eol);
       query.append("drop <" + modelURIString + ">;" + eol);
       query.append("create <" + modelURIString + ">;" + eol);

Modified: trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/Descriptor.java
===================================================================
--- trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/Descriptor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/Descriptor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -295,9 +295,9 @@
 
 
   /**
-   * Get the descriptor Model URI
+   * Get the descriptor Graph URI
    *
-   * @return the Descriptor Model URI as a string;
+   * @return the Descriptor Graph URI as a string;
    */
    public static String getModelURIString() {
     return ServerInfo.getServerURI() + "#" + DEFAULT_DESCRIPTOR_MODEL;
@@ -935,12 +935,12 @@
 
       if (log.isDebugEnabled()) {
 
-        log.debug("Using descriptor Model URI is : " + descriptorModelURI);
+        log.debug("Using descriptor Graph URI is : " + descriptorModelURI);
       }
     }
     catch (URISyntaxException use) {
 
-      throw new DescriptorException("Descriptor Model URI: " +
+      throw new DescriptorException("Descriptor Graph URI: " +
           descriptorModelString +
           " is not a valid URI", use);
     }

Modified: trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DescriptorElement.java
===================================================================
--- trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DescriptorElement.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/descriptor/src/java/org/mulgara/descriptor/DescriptorElement.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -241,7 +241,7 @@
 
         String errorString = "Could not find parameters for (" +
                                       descURL +
-            ") RDF is probably not loaded into the Descriptor Model";
+            ") RDF is probably not loaded into the Descriptor Graph";
         log.error(errorString);
         throw new DescriptorException(errorString);
       }

Modified: trunk/src/jar/jrdf/java/org/mulgara/jrdf/JRDFGraph.java
===================================================================
--- trunk/src/jar/jrdf/java/org/mulgara/jrdf/JRDFGraph.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/jrdf/java/org/mulgara/jrdf/JRDFGraph.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -36,6 +36,7 @@
 
 // JRDF
 import org.jrdf.graph.*;
+import org.jrdf.graph.Graph;
 import org.jrdf.util.ClosableIterator;
 
 // Locally written packages
@@ -45,7 +46,7 @@
 
 /**
  * A {@link org.jrdf.graph.Graph} contained within this database. Represents a
- * Model/Resolver via an URI and a Session.
+ * Graph/Resolver via an URI and a Session.
  *
  * @created 2004-10-12
  *
@@ -78,7 +79,7 @@
   private LocalJRDFSession session = null;
 
   /**
-   * Model URI.
+   * Graph URI.
    */
   private URI graphURI = null;
 

Modified: trunk/src/jar/krule/java/org/mulgara/krule/QueryStruct.java
===================================================================
--- trunk/src/jar/krule/java/org/mulgara/krule/QueryStruct.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/krule/java/org/mulgara/krule/QueryStruct.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -32,9 +32,9 @@
 import org.mulgara.query.ConstraintElement;
 import org.mulgara.query.ConstraintExpression;
 import org.mulgara.query.ConstraintHaving;
-import org.mulgara.query.ModelExpression;
-import org.mulgara.query.ModelResource;
-import org.mulgara.query.ModelUnion;
+import org.mulgara.query.GraphExpression;
+import org.mulgara.query.GraphResource;
+import org.mulgara.query.GraphUnion;
 import org.mulgara.query.Order;
 import org.mulgara.query.Query;
 import org.mulgara.query.SelectElement;
@@ -68,7 +68,7 @@
   private List<SelectElement> variables;
 
   /** The model expresison for the query. */
-  private ModelExpression models;
+  private GraphExpression models;
 
   /** The where clause of the query. */
   private ConstraintExpression where;
@@ -181,7 +181,7 @@
    * @param modelUri The URI of the model for the query.
    */
   public void setModelExpression(URI modelUri) {
-    this.models = new ModelResource(modelUri);
+    this.models = new GraphResource(modelUri);
   }
 
 
@@ -195,7 +195,7 @@
     if (firstModelUri.equals(secondModelUri)) {
       setModelExpression(firstModelUri);
     } else {
-      this.models = new ModelUnion(new ModelResource(firstModelUri), new ModelResource(secondModelUri));
+      this.models = new GraphUnion(new GraphResource(firstModelUri), new GraphResource(secondModelUri));
     }
   }
 

Modified: trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactoryUnitTest.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactoryUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/connection/ConnectionFactoryUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -25,7 +25,7 @@
 
 import org.mulgara.query.Answer;
 import org.mulgara.query.ConstraintImpl;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.query.Order;
 import org.mulgara.query.Query;
 import org.mulgara.query.SelectElement;
@@ -83,7 +83,7 @@
 
     query = new Query(
       selectList,                                       // SELECT
-      new ModelResource(URI.create("rmi://localhost/server1#")), // FROM
+      new GraphResource(URI.create("rmi://localhost/server1#")), // FROM
       new ConstraintImpl(subjectVariable,               // WHERE
                      predicateVariable,
                      objectVariable),

Modified: trunk/src/jar/query/java/org/mulgara/query/AskQuery.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/AskQuery.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/AskQuery.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -34,13 +34,13 @@
   /**
    * Creates an ASK query.
    * @param variableList The variables in the result to check for.
-   * @param modelExpression The source of the data to query.
+   * @param graphExpression The source of the data to query.
    * @param constraintExpression The WHERE clause to test.
    */
   @SuppressWarnings("unchecked")
-  public AskQuery(List<? extends SelectElement> variableList, ModelExpression modelExpression,
+  public AskQuery(List<? extends SelectElement> variableList, GraphExpression graphExpression,
         ConstraintExpression constraintExpression) {
-    super(variableList, modelExpression, constraintExpression,
+    super(variableList, graphExpression, constraintExpression,
         null, // no having
         (List<Order>)Collections.EMPTY_LIST, // no ordering
         null, // no limit

Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -112,14 +112,14 @@
   /**
    * METHOD TO DO
    *
-   * @param modelExpression PARAMETER TO DO
+   * @param graphExpression PARAMETER TO DO
    * @param transformation PARAMETER TO DO
    * @param modelProperty PARAMETER TO DO
    * @param systemModel PARAMETER TO DO
    * @param variableFactory PARAMETER TO DO
    * @return RETURNED VALUE TO DO
    */
-  public ConstraintExpression from(ModelExpression modelExpression,
+  public ConstraintExpression from(GraphExpression graphExpression,
       Transformation transformation, Value modelProperty, Value systemModel,
       VariableFactory variableFactory) {
     return this;

Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -110,14 +110,14 @@
   /**
    * Converts an expression to be made against a new source. In this case, nothing need change.
    *
-   * @param modelExpression ignored
+   * @param graphExpression ignored
    * @param transformation ignored
    * @param modelProperty ignored
    * @param systemModel ignored
    * @param variableFactory ignored
    * @return The current constraint.
    */
-  public ConstraintExpression from(ModelExpression modelExpression,
+  public ConstraintExpression from(GraphExpression graphExpression,
       Transformation transformation, Value modelProperty, Value systemModel,
       VariableFactory variableFactory) {
     return this;

Modified: trunk/src/jar/query/java/org/mulgara/query/ConstructQuery.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstructQuery.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstructQuery.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -34,10 +34,10 @@
   private static final long serialVersionUID = -6024259961466362580L;
 
   @SuppressWarnings("unchecked")
-  public ConstructQuery(List<? extends SelectElement> variableList, ModelExpression modelExpression,
+  public ConstructQuery(List<? extends SelectElement> variableList, GraphExpression graphExpression,
         ConstraintExpression constraintExpression,
         List<Order> orderList, Integer limit, int offset) {
-    super(variableList, modelExpression, constraintExpression,
+    super(variableList, graphExpression, constraintExpression,
         null, // no having
         orderList,
         limit,

Copied: trunk/src/jar/query/java/org/mulgara/query/Graph.java (from rev 1397, trunk/src/jar/query/java/org/mulgara/query/Model.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/Graph.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/Graph.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,59 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+/**
+ * A simple model expression involving a set of RDF statements.
+ *
+ * @created 2001-10-02
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @copyright &copy;2001-2003
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public interface Graph extends GraphExpression {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = -4054403807442867450L;
+
+  // no additional specification
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/Graph.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphExpression.java (from rev 1398, trunk/src/jar/query/java/org/mulgara/query/ModelExpression.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphExpression.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphExpression.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,83 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+import java.net.*;
+import java.util.*;
+import java.io.Serializable;
+
+/**
+ * An expression whose leaves are the {@link URL}s of RDF models.
+ *
+ * Currently this doesn't handle compound expressions, only simple models.
+ *
+ * @created 12/Aug/2001
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
+ *
+ * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public interface GraphExpression extends Cloneable, Serializable {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = -7760184436366431348L;
+
+  /**
+   * Calculate the databases involved in this expression. Bear in mind that
+   * different models may reside on the same database. The idea of this function
+   * is to test for when only one database is involved, and we're able to
+   * transmit a query to that database for remove processing.
+   *
+   * @return a set containing the {@link URI}s of the databases
+   */
+  public Set<URI> getDatabaseURIs();
+
+  /**
+   * Calculate the graphs involved in this expression.
+   *
+   * @return a set containing the {@link URI}s of the graphs
+   */
+  public Set<URI> getGraphURIs();
+
+  /**
+   * Clones sets of models in the rhs and lhs objects.
+   */
+  public Object clone();
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphExpression.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphIntersection.java (from rev 1397, trunk/src/jar/query/java/org/mulgara/query/ModelIntersection.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphIntersection.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphIntersection.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,80 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+/**
+ * A model expression composed of the intersection of two subexpressions.
+ *
+ * @created 2001-09-04
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @copyright &copy;2001-2003
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphIntersection extends GraphOperation {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = -5897664547668612754L;
+
+  //
+  // Constructor
+  //
+
+  /**
+   * Construct a model intersection.
+   *
+   * @param lhs a non-<code>null</code> model expression
+   * @param rhs another non-<code>null</code> model expression
+   */
+  public GraphIntersection(GraphExpression lhs, GraphExpression rhs) {
+    super(lhs, rhs);
+  }
+
+  /**
+   * Legible representation
+   *
+   * @return RETURNED VALUE TO DO
+   */
+  public String toString() {
+    return "(" + getLHS() + " intersect " + getRHS() + ")";
+  }
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphIntersection.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphLiteral.java (from rev 1398, trunk/src/jar/query/java/org/mulgara/query/ModelLiteral.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphLiteral.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphLiteral.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,208 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+// Java 2 standard packages
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import javax.xml.transform.*;
+import javax.xml.transform.stream.StreamResult;
+
+// Third party packages
+import org.apache.log4j.Logger;
+import org.xml.sax.InputSource;
+
+/**
+ * A leaf expression containing the statements comprising an RDF model.
+ *
+ * @created 2001-10-02
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @copyright &copy;2001-2003
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphLiteral implements Graph {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = 5132086338306266830L;
+
+  /**
+   * Logger. This is named after the class.
+   */
+  @SuppressWarnings("unused")
+  private final static Logger logger = Logger.getLogger(GraphLiteral.class);
+
+  /**
+   * The content of the model, an RDF syntax byte sequence.
+   */
+  private byte[] buffer;
+
+  /**
+   * The system ID of the model.
+   */
+  private String systemId;
+
+  //
+  // Constructors
+  //
+
+  /**
+   * Construct a model from RDF syntax.
+   *
+   * @param source the RDF syntax source
+   * @throws IllegalArgumentException if the <var>inputSource</var> is <code>null</code>
+   * @throws TransformerConfigurationException EXCEPTION TO DO
+   * @throws TransformerException EXCEPTION TO DO
+   */
+  public GraphLiteral(Source source) throws TransformerConfigurationException,
+      TransformerException {
+
+    // Validate "source" parameter
+    if (source == null) {
+
+      throw new IllegalArgumentException("Null \"source\" parameter");
+    }
+
+    // Copy from the RDF syntax source into a byte array
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    TransformerFactory.newInstance().newTransformer().transform(source,
+        // RDF syntax source
+        new StreamResult(baos));
+
+    // Initialize fields
+    buffer = baos.toByteArray();
+    systemId = source.getSystemId();
+  }
+
+  //
+  // Methods implementing GraphExpression
+  //
+
+  /**
+   * @return an empty {@link Set}
+   */
+  public Set<URI> getDatabaseURIs() {
+    return Collections.emptySet();
+  }
+
+  /**
+   * @return an empty {@link Set}
+   */
+  public Set<URI> getGraphURIs() {
+    return Collections.emptySet();
+  }
+
+  //
+  // API methods
+  //
+
+  /**
+   * Gets the InputSource attribute of the GraphLiteral object
+   *
+   * @return The InputSource value
+   */
+  public InputSource getInputSource() {
+
+    InputSource in = new InputSource(new ByteArrayInputStream(buffer));
+
+    if (systemId != null) {
+
+      in.setSystemId(systemId);
+    }
+
+    return in;
+  }
+
+  //
+  // Methods of Object
+  //
+
+  /**
+   * Equality is by value. The value of a literal requires that the RDF model be
+   * parsed out of it and compared. We don't actually do this, so the method
+   * will throw an {@link Error} if it's asked to do any serious work.
+   *
+   * @param object the object to test against
+   * @return <code>false</code> if inequality can be proved
+   * @throws Error if inequality can't be proved
+   */
+  public boolean equals(Object object) {
+
+    // Check trivial cases
+    if (object == null) {
+
+      return false;
+    }
+
+    if (object == this) {
+
+      return true;
+    }
+
+    if (! (object instanceof GraphLiteral)) {
+
+      return false;
+    }
+
+    // Give up
+    throw new Error("RDF literal equality not implemented");
+  }
+
+  /**
+   * Returns just the default Object clone.
+   */
+  public Object clone() {
+
+    try {
+
+      GraphLiteral cloned = (GraphLiteral) super.clone();
+      return cloned;
+    }
+    catch (CloneNotSupportedException e) {
+      throw new RuntimeException(
+          "GraphLiteral not cloneable"
+          );
+    }
+  }
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphLiteral.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphOperation.java (from rev 1398, trunk/src/jar/query/java/org/mulgara/query/ModelOperation.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphOperation.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,243 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+// Java 2 standard packages
+import java.net.URI;
+import java.util.*;
+
+/**
+ * A model expression composed of two subexpressions and a dyadic operator.
+ *
+ * @created 2001-07-12
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
+ *
+ * @copyright &copy; 2001-2003 <A href="http://www.PIsoftware.com/">Plugged In
+ *      Software Pty Ltd</A>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public abstract class GraphOperation implements GraphExpression {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = 7647456202844495785L;
+
+  /**
+   * The two operands.
+   */
+  private GraphExpression lhs;
+
+  /**
+   * The two operands.
+   */
+  private GraphExpression rhs;
+
+  //
+  // Constructor
+  //
+
+  /**
+   * Construct a model operation. Subclasses are compelled to use this
+   * constructor, guaranteeing that the operands are always
+   * non-<code>null</code>.
+   *
+   * @param lhs a non-<code>null</code> model expression
+   * @param rhs another non-<code>null</code> model expression
+   */
+  protected GraphOperation(GraphExpression lhs, GraphExpression rhs) {
+
+    // Validate "lhs" parameter
+    if (lhs == null) {
+
+      throw new IllegalArgumentException("Null \"lhs\" parameter");
+    }
+
+    // Validate "rhs" parameter
+    if (rhs == null) {
+
+      throw new IllegalArgumentException("Null \"rhs\" parameter");
+    }
+
+    // Initialize fields
+    this.lhs = lhs;
+    this.rhs = rhs;
+  }
+
+  //
+  // Methods implementing the GraphExpression abstract class
+  //
+
+  /**
+   * Gets the DatabaseURIs attribute of the GraphOperation object
+   *
+   * @return The DatabaseURIs value
+   */
+  public Set<URI> getDatabaseURIs() {
+
+    Set<URI> databaseURIs = new HashSet<URI>();
+    databaseURIs.addAll(lhs.getDatabaseURIs());
+    databaseURIs.addAll(rhs.getDatabaseURIs());
+
+    return databaseURIs;
+  }
+
+  /**
+   * Calculate the graphs involved in this expression.
+   *
+   * @return a set containing the {@link URI}s of the graphs
+   */
+  public Set<URI> getGraphURIs() {
+    
+    Set<URI> graphURIs = new HashSet<URI>();
+    graphURIs.addAll(lhs.getGraphURIs());
+    graphURIs.addAll(rhs.getGraphURIs());
+
+    return graphURIs;
+  }
+
+  //
+  // Additional API
+  //
+
+  /**
+   * Accessor for the <var>lhs</var> property.
+   *
+   * @return The LHS value
+   */
+  public GraphExpression getLHS() {
+
+    return lhs;
+  }
+
+  /**
+   * Accessor for the <var>rhs</var> property.
+   *
+   * @return The RHS value
+   */
+  public GraphExpression getRHS() {
+
+    return rhs;
+  }
+
+  /**
+   * Transform to an equivalent WHERE clause expression.
+   *
+   * @param m The object to compare against.
+   * @return <code>true</code> if the objects are the same type,
+   *         and applied to the same operands 
+   */
+  public boolean equals(Object m) {
+    
+    if (!(m instanceof GraphOperation)) return false;
+    if ((m == null) || !m.getClass().equals(getClass())) return false;
+    if (m == this) return true;
+
+    Class<?> type = m.getClass();
+
+    Set<GraphExpression> otherExpressions = new HashSet<GraphExpression>();
+    ((GraphOperation)m).flattenExpression(otherExpressions, type);
+
+    Set<GraphExpression> myExpressions = new HashSet<GraphExpression>();
+    flattenExpression(myExpressions, type);
+
+    return myExpressions.equals(otherExpressions);
+  }
+
+  /**
+   * Creates a hash code, based on the child expressions and the current operation type.
+   *
+   * @return The hash code for this object.
+   */
+  public int hashCode() {
+
+    Set<GraphExpression> myExpressions = new HashSet<GraphExpression>();
+    flattenExpression(myExpressions, getClass());
+
+    return (getClass().hashCode() * 7) + myExpressions.hashCode();
+  }
+
+  /**
+   * Traverse down the binary tree of the current object, and merge any nodes
+   * of the current type into a flattened set.
+   *
+   * @param expressions The set to be built up containing all nodes being
+   *        operated on in the same way.
+   * @param type The class representing the operation type.
+   */
+  private void flattenExpression(Set<GraphExpression> expressions, Class<?> type) {
+
+    if (lhs.getClass().equals(type)) {
+      ((GraphOperation)lhs).flattenExpression(expressions, type);
+    } else {
+      expressions.add(lhs);
+    }
+
+    if (rhs.getClass().equals(type)) {
+      ((GraphOperation)rhs).flattenExpression(expressions, type);
+    } else {
+      expressions.add(rhs);
+    }
+  }
+
+  /**
+   * Clones sets of models in the rhs and lhs objects.
+   */
+  public Object clone() {
+
+    try {
+      GraphOperation cloned = (GraphOperation)super.clone();
+
+      // Copy database URIs.
+      cloned.lhs = (GraphExpression)lhs.clone();
+      cloned.rhs = (GraphExpression)rhs.clone();
+
+      return cloned;
+    } catch (CloneNotSupportedException e) {
+      throw new RuntimeException("GraphOperation subclass " + getClass() + " not cloneable");
+    }
+  }
+
+
+  public String toString() {
+    return getClass().toString() + ":[(" + lhs.toString() + ") . (" + rhs.toString() +")]";
+  }
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphOperation.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphPartition.java (from rev 1398, trunk/src/jar/query/java/org/mulgara/query/ModelPartition.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphPartition.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphPartition.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,92 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+
+// Third party packages
+import org.apache.log4j.Logger;
+
+/**
+ * A model expression composed of the union of two subexpressions.
+ *
+ *
+ * @created 2002-05-20
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
+ *
+ * @copyright &copy; 2002-2004 <A href="http://www.PIsoftware.com/">Plugged In
+ *      Software Pty Ltd</A>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphPartition extends GraphOperation {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = 8660358035003409731L;
+
+  /** Logger. */
+  @SuppressWarnings("unused")
+  private final static Logger logger = Logger.getLogger(GraphPartition.class);
+
+  //
+  // Constructor
+  //
+
+  /**
+   * Construct a model union.
+   *
+   * @param lhs a non-<code>null</code> model expression
+   * @param rhs another non-<code>null</code> model expression
+   */
+  public GraphPartition(GraphExpression lhs, GraphExpression rhs) {
+    super(lhs, rhs);
+  }
+
+  /**
+   * Legible representation
+   *
+   * @return RETURNED VALUE TO DO
+   */
+  public String toString() {
+
+    return "(" + getLHS() + " par " + getRHS() + ")";
+  }
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphPartition.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphResource.java (from rev 1398, trunk/src/jar/query/java/org/mulgara/query/ModelResource.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphResource.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphResource.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,219 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+// Java 2 standard packages
+import java.net.*;
+import java.util.*;
+
+// Third party packages
+import org.apache.log4j.Logger;
+
+
+/**
+ * A leaf expression containing the {@link URL} of an RDF model.
+ *
+ * @created 2001-07-12
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @copyright &copy;2001-2003
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphResource implements Graph {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = -5673467065206144337L;
+
+  /** Logger. This is named after the class. */
+  @SuppressWarnings("unused")
+  private final static Logger logger = Logger.getLogger(GraphResource.class.getName());
+
+  /** The {@link URI} of the RDF model. */
+  private URI uri;
+
+  //
+  // Constructors
+  //
+
+  /**
+   * Construct a model from a {@link URL}.
+   *
+   * @param uri the {@link URI} of the model to query
+   * @throws IllegalArgumentException if <var>url</var> is <code>null</code>
+   */
+  public GraphResource(URI uri) {
+
+    // Validate "uri" parameter
+    if (uri == null) {
+
+      throw new IllegalArgumentException("Null \"uri\" parameter");
+    }
+
+    // Initialize fields
+    this.uri = uri;
+  }
+
+  //
+  // Methods implementing GraphExpression
+  //
+
+  /**
+   * @return an immutable singleton {@link Set} containing the {@link URL} of
+   *   the server if this is a Java RMI, BEEP, or local model, or the empty
+   *   {@link Set} otherwise
+   */
+  @SuppressWarnings("unchecked")
+  public Set<URI> getDatabaseURIs() {
+
+    try {
+
+      if ("beep".equals(uri.getScheme()) || "rmi".equals(uri.getScheme()) ||
+          "local".equals(uri.getScheme())) {
+
+        // In Java RMI models, the database is the URI without
+        // the fragment identifier
+        // TODO: Call RmiQueryHandler.serverURI instead
+        return Collections.singleton(new URI(uri.getScheme(),
+                                             uri.getAuthority(),
+                                             uri.getPath(),
+                                             null,
+                                             null));
+      } else {
+        return (Set<URI>)Collections.EMPTY_SET;
+      }
+    } catch (URISyntaxException e) {
+      throw new RuntimeException("Couldn't truncate model URI " + uri + " to obtain a database URI");
+    }
+
+  }
+
+  /** @see org.mulgara.query.GraphExpression#getGraphURIs() */
+  public Set<URI> getGraphURIs() {
+    return Collections.singleton(uri);
+  }
+
+  //
+  // API methods
+  //
+
+  /**
+   * Accessor for the <var>uri</var> property.
+   *
+   * @return a {@link URI} instance (never <code>null</code>)
+   */
+  public URI getURI() {
+
+    return uri;
+  }
+
+  //
+  // Methods extending Object
+  //
+
+  /**
+   * The text representation of the URI.
+   *
+   * @return the text representation of the URI.
+   */
+  public String toString() {
+
+    return uri.toString();
+  }
+
+  //
+  // Methods overriding Object
+  //
+
+  /**
+   * Return true if the URIs of a GraphResource are equal.
+   *
+   * @param object GraphResource to test equality.
+   * @return true if the URIs of a GraphResource are equal.
+   */
+  public boolean equals(Object object) {
+
+    if (object == null) {
+
+      return false;
+    }
+
+    try {
+
+      GraphResource tmpModelResource = (GraphResource) object;
+      return getURI().equals(tmpModelResource.getURI());
+    }
+    catch (ClassCastException cce) {
+
+      return false;
+    }
+  }
+
+  /**
+   * Returns the hashCode of a URI.
+   *
+   * @return the hashCode of a URI.
+   */
+  public int hashCode() {
+
+    return uri.hashCode();
+  }
+
+  /**
+   * Returns just the default Object clone.
+   *
+   * @return just the default Object clone.
+   */
+  public Object clone() {
+
+    try {
+
+      GraphResource cloned = (GraphResource) super.clone();
+      cloned.uri = getURI();
+      return cloned;
+    }
+    catch (CloneNotSupportedException e) {
+
+      throw new RuntimeException("GraphResource not cloneable");
+    }
+  }
+
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphResource.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphResourceUnitTest.java (from rev 1397, trunk/src/jar/query/java/org/mulgara/query/ModelResourceUnitTest.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphResourceUnitTest.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphResourceUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,146 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+// Java packages
+import java.net.URI;
+
+// JUnit
+import junit.framework.*;
+
+// Log4J
+import org.apache.log4j.Logger;
+
+/**
+ * Tests the functionality of GraphResource.
+ *
+ * @created 2004-04-15
+ *
+ * @author Andrew Newman
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @copyright &copy;2001-2003
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphResourceUnitTest extends TestCase {
+
+  /**
+   * Logger.
+   */
+  private static final Logger logger = Logger.getLogger(GraphResourceUnitTest.class);
+
+  /**
+   * Construct a new unit test.
+   *
+   * @param name the name of the test
+   */
+  public GraphResourceUnitTest(String name) {
+
+    super(name);
+  }
+
+  /**
+   * Hook for test runner to obtain a test suite from.
+   *
+   * @return The test suite
+   */
+  public static Test suite() {
+
+    TestSuite suite = new TestSuite();
+    suite.addTest(new GraphResourceUnitTest("testEquals"));
+    suite.addTest(new GraphResourceUnitTest("testClone"));
+    return suite;
+  }
+
+  /**
+   * Default text runner.
+   *
+   * @param args The command line arguments
+   */
+  public static void main(String[] args) {
+
+    junit.textui.TestRunner.run(suite());
+  }
+
+  //
+  // Test cases
+  //
+
+  /**
+   * Test equality of two model resource.
+   */
+  public void testEquals() {
+
+    try {
+
+      GraphResource res1 = new GraphResource(new URI("rmi://foo/server1#_"));
+      GraphResource res2 = new GraphResource(new URI("rmi://foo/server1#"));
+      GraphResource res3 = new GraphResource(new URI("rmi://foo/server1#"));
+
+      assertEquals("Two GraphResource with the same RMI protcol should " +
+          "resolve to the same server", res1.getDatabaseURIs(),
+          res2.getDatabaseURIs());
+
+      assertFalse("Resource should be unequal", res1.equals(res2));
+
+      assertNotSame("Resources should be different instances", res2, res3);
+      assertTrue("Resource should be equal", res2.equals(res3));
+    }
+    catch (Exception e) {
+
+      e.printStackTrace();
+    }
+  }
+
+  /**
+   * Test clone of two resources.
+   */
+  public void testClone() {
+
+    try {
+
+      GraphResource res1 = new GraphResource(new URI("rmi://foo/server1#_"));
+      GraphResource res2 = (GraphResource) res1.clone();
+
+      assertNotSame("Resources should be different instances", res1, res2);
+      assertTrue("Resources should be equal", res1.equals(res2));
+    }
+    catch (Exception e) {
+
+      e.printStackTrace();
+    }
+  }
+}
+


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphResourceUnitTest.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphUnion.java (from rev 1397, trunk/src/jar/query/java/org/mulgara/query/ModelUnion.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphUnion.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphUnion.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,81 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.query;
+
+/**
+ * A model expression composed of the union of two subexpressions.
+ *
+ * @created 2001-08-12
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @copyright &copy;2001-2004
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphUnion extends GraphOperation {
+
+  /**
+   * Allow newer compiled version of the stub to operate when changes
+   * have not occurred with the class.
+   * NOTE : update this serialVersionUID when a method or a public member is
+   * deleted.
+   */
+  static final long serialVersionUID = -2658255434397870185L;
+
+  //
+  // Constructor
+  //
+
+  /**
+   * Construct a model union.
+   *
+   * @param lhs a non-<code>null</code> model expression
+   * @param rhs another non-<code>null</code> model expression
+   */
+  public GraphUnion(GraphExpression lhs, GraphExpression rhs) {
+    super(lhs, rhs);
+  }
+
+  /**
+   * Legible representation
+   *
+   * @return RETURNED VALUE TO DO
+   */
+  public String toString() {
+
+    return "(" + getLHS() + " union " + getRHS() + ")";
+  }
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphUnion.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/query/java/org/mulgara/query/GraphVariable.java (from rev 1398, trunk/src/jar/query/java/org/mulgara/query/ModelVariable.java)
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GraphVariable.java	                        (rev 0)
+++ trunk/src/jar/query/java/org/mulgara/query/GraphVariable.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,141 @@
+/**
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+
+package org.mulgara.query;
+
+// Java 2 standard packages
+import java.net.*;
+import java.util.*;
+
+// Third party packages
+import org.apache.log4j.Logger;
+
+/**
+ * A leaf expression containing a variable that is used for the model expression.
+ *
+ * @created Apr 22, 2008
+ * @author Paul Gearon
+ * @copyright &copy; 2008 <a href="http://www.topazproject.org/">The Topaz Project</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public class GraphVariable implements Graph {
+
+  /** Used for serializing. */
+  static final long serialVersionUID = 5132086338306266830L;
+
+  /** Logger. */
+  @SuppressWarnings("unused")
+  private final static Logger logger = Logger.getLogger(GraphVariable.class);
+
+  /** The variable for the graph */
+  private Variable variable;
+
+  //
+  // Constructors
+  //
+
+  /**
+   * Construct a model from a {@link URL}.
+   *
+   * @param uri the {@link URI} of the model to query
+   * @throws IllegalArgumentException if <var>url</var> is <code>null</code>
+   */
+  public GraphVariable(Variable variable) {
+    if (variable == null) throw new IllegalArgumentException("Null variable parameter");
+    this.variable = variable;
+  }
+
+  //
+  // Methods implementing GraphExpression
+  //
+
+  /**
+   * Gets a set of database URIs to operate against.
+   * @return We don't know what is in the variable, so return the empty {@link Set}
+   */
+  public Set<URI> getDatabaseURIs() {
+    return Collections.emptySet();
+  }
+
+  /**
+   * Gets a set of graph URIs this represents.
+   * @return We don't know what is in the variable, so return the empty {@link Set}
+   */
+  public Set<URI> getGraphURIs() {
+    return Collections.emptySet();
+  }
+
+  //
+  // API methods
+  //
+
+  /**
+   * Accessor for the <var>variable</var> property.
+   * @return a {@link Variable} instance
+   */
+  public Variable getVariable() {
+    return variable;
+  }
+
+  //
+  // Methods extending Object
+  //
+
+  /**
+   * The text representation of the URI.
+   * @return the text representation of the URI.
+   */
+  public String toString() {
+    return variable.toString();
+  }
+
+  //
+  // Methods overriding Object
+  //
+
+  /**
+   * Return true if the variables of a GraphVariable are equal.
+   * @param object GraphVariable to test equality.
+   * @return true if the variables of a GraphVariable are equal.
+   */
+  public boolean equals(Object object) {
+    if (object == null) return false;
+    if (object == this) return true;
+
+    if (!(object instanceof GraphVariable)) return false;
+    GraphVariable modelVar = (GraphVariable)object;
+    return variable.equals(modelVar.variable);
+  }
+
+  /**
+   * Returns the hashCode of a Variable.
+   * @return the hashCode of a Variable.
+   */
+  public int hashCode() {
+    return variable.hashCode();
+  }
+
+  /**
+   * Returns just the default Object clone.
+   * @return just the default Object clone.
+   */
+  public Object clone() {
+    try {
+      GraphVariable cloned = (GraphVariable)super.clone();
+      cloned.variable = variable;
+      return cloned;
+    } catch (CloneNotSupportedException e) {
+      throw new RuntimeException("GraphVariable not cloneable");
+    }
+  }
+
+}


Property changes on: trunk/src/jar/query/java/org/mulgara/query/GraphVariable.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/query/java/org/mulgara/query/Model.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/Model.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/Model.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,59 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-/**
- * A simple model expression involving a set of RDF statements.
- *
- * @created 2001-10-02
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright &copy;2001-2003
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public interface Model extends ModelExpression {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = -4054403807442867450L;
-
-  // no additional specification
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelExpression.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelExpression.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelExpression.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,83 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-import java.net.*;
-import java.util.*;
-import java.io.Serializable;
-
-/**
- * An expression whose leaves are the {@link URL}s of RDF models.
- *
- * Currently this doesn't handle compound expressions, only simple models.
- *
- * @created 12/Aug/2001
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public interface ModelExpression extends Cloneable, Serializable {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = -7760184436366431348L;
-
-  /**
-   * Calculate the databases involved in this expression. Bear in mind that
-   * different models may reside on the same database. The idea of this function
-   * is to test for when only one database is involved, and we're able to
-   * transmit a query to that database for remove processing.
-   *
-   * @return a set containing the {@link URI}s of the databases
-   */
-  public Set<URI> getDatabaseURIs();
-
-  /**
-   * Calculate the graphs involved in this expression.
-   *
-   * @return a set containing the {@link URI}s of the graphs
-   */
-  public Set<URI> getGraphURIs();
-
-  /**
-   * Clones sets of models in the rhs and lhs objects.
-   */
-  public Object clone();
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelIntersection.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelIntersection.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelIntersection.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,80 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-/**
- * A model expression composed of the intersection of two subexpressions.
- *
- * @created 2001-09-04
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright &copy;2001-2003
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelIntersection extends ModelOperation {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = -5897664547668612754L;
-
-  //
-  // Constructor
-  //
-
-  /**
-   * Construct a model intersection.
-   *
-   * @param lhs a non-<code>null</code> model expression
-   * @param rhs another non-<code>null</code> model expression
-   */
-  public ModelIntersection(ModelExpression lhs, ModelExpression rhs) {
-    super(lhs, rhs);
-  }
-
-  /**
-   * Legible representation
-   *
-   * @return RETURNED VALUE TO DO
-   */
-  public String toString() {
-    return "(" + getLHS() + " intersect " + getRHS() + ")";
-  }
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelLiteral.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelLiteral.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelLiteral.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,208 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-// Java 2 standard packages
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import javax.xml.transform.*;
-import javax.xml.transform.stream.StreamResult;
-
-// Third party packages
-import org.apache.log4j.Logger;
-import org.xml.sax.InputSource;
-
-/**
- * A leaf expression containing the statements comprising an RDF model.
- *
- * @created 2001-10-02
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright &copy;2001-2003
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelLiteral implements Model {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = 5132086338306266830L;
-
-  /**
-   * Logger. This is named after the class.
-   */
-  @SuppressWarnings("unused")
-  private final static Logger logger = Logger.getLogger(ModelLiteral.class);
-
-  /**
-   * The content of the model, an RDF syntax byte sequence.
-   */
-  private byte[] buffer;
-
-  /**
-   * The system ID of the model.
-   */
-  private String systemId;
-
-  //
-  // Constructors
-  //
-
-  /**
-   * Construct a model from RDF syntax.
-   *
-   * @param source the RDF syntax source
-   * @throws IllegalArgumentException if the <var>inputSource</var> is <code>null</code>
-   * @throws TransformerConfigurationException EXCEPTION TO DO
-   * @throws TransformerException EXCEPTION TO DO
-   */
-  public ModelLiteral(Source source) throws TransformerConfigurationException,
-      TransformerException {
-
-    // Validate "source" parameter
-    if (source == null) {
-
-      throw new IllegalArgumentException("Null \"source\" parameter");
-    }
-
-    // Copy from the RDF syntax source into a byte array
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    TransformerFactory.newInstance().newTransformer().transform(source,
-        // RDF syntax source
-        new StreamResult(baos));
-
-    // Initialize fields
-    buffer = baos.toByteArray();
-    systemId = source.getSystemId();
-  }
-
-  //
-  // Methods implementing ModelExpression
-  //
-
-  /**
-   * @return an empty {@link Set}
-   */
-  public Set<URI> getDatabaseURIs() {
-    return Collections.emptySet();
-  }
-
-  /**
-   * @return an empty {@link Set}
-   */
-  public Set<URI> getGraphURIs() {
-    return Collections.emptySet();
-  }
-
-  //
-  // API methods
-  //
-
-  /**
-   * Gets the InputSource attribute of the ModelLiteral object
-   *
-   * @return The InputSource value
-   */
-  public InputSource getInputSource() {
-
-    InputSource in = new InputSource(new ByteArrayInputStream(buffer));
-
-    if (systemId != null) {
-
-      in.setSystemId(systemId);
-    }
-
-    return in;
-  }
-
-  //
-  // Methods of Object
-  //
-
-  /**
-   * Equality is by value. The value of a literal requires that the RDF model be
-   * parsed out of it and compared. We don't actually do this, so the method
-   * will throw an {@link Error} if it's asked to do any serious work.
-   *
-   * @param object the object to test against
-   * @return <code>false</code> if inequality can be proved
-   * @throws Error if inequality can't be proved
-   */
-  public boolean equals(Object object) {
-
-    // Check trivial cases
-    if (object == null) {
-
-      return false;
-    }
-
-    if (object == this) {
-
-      return true;
-    }
-
-    if (! (object instanceof ModelLiteral)) {
-
-      return false;
-    }
-
-    // Give up
-    throw new Error("RDF literal equality not implemented");
-  }
-
-  /**
-   * Returns just the default Object clone.
-   */
-  public Object clone() {
-
-    try {
-
-      ModelLiteral cloned = (ModelLiteral) super.clone();
-      return cloned;
-    }
-    catch (CloneNotSupportedException e) {
-      throw new RuntimeException(
-          "ModelLiteral not cloneable"
-          );
-    }
-  }
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelOperation.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelOperation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,243 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-// Java 2 standard packages
-import java.net.URI;
-import java.util.*;
-
-/**
- * A model expression composed of two subexpressions and a dyadic operator.
- *
- * @created 2001-07-12
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy; 2001-2003 <A href="http://www.PIsoftware.com/">Plugged In
- *      Software Pty Ltd</A>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public abstract class ModelOperation implements ModelExpression {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = 7647456202844495785L;
-
-  /**
-   * The two operands.
-   */
-  private ModelExpression lhs;
-
-  /**
-   * The two operands.
-   */
-  private ModelExpression rhs;
-
-  //
-  // Constructor
-  //
-
-  /**
-   * Construct a model operation. Subclasses are compelled to use this
-   * constructor, guaranteeing that the operands are always
-   * non-<code>null</code>.
-   *
-   * @param lhs a non-<code>null</code> model expression
-   * @param rhs another non-<code>null</code> model expression
-   */
-  protected ModelOperation(ModelExpression lhs, ModelExpression rhs) {
-
-    // Validate "lhs" parameter
-    if (lhs == null) {
-
-      throw new IllegalArgumentException("Null \"lhs\" parameter");
-    }
-
-    // Validate "rhs" parameter
-    if (rhs == null) {
-
-      throw new IllegalArgumentException("Null \"rhs\" parameter");
-    }
-
-    // Initialize fields
-    this.lhs = lhs;
-    this.rhs = rhs;
-  }
-
-  //
-  // Methods implementing the ModelExpression abstract class
-  //
-
-  /**
-   * Gets the DatabaseURIs attribute of the ModelOperation object
-   *
-   * @return The DatabaseURIs value
-   */
-  public Set<URI> getDatabaseURIs() {
-
-    Set<URI> databaseURIs = new HashSet<URI>();
-    databaseURIs.addAll(lhs.getDatabaseURIs());
-    databaseURIs.addAll(rhs.getDatabaseURIs());
-
-    return databaseURIs;
-  }
-
-  /**
-   * Calculate the graphs involved in this expression.
-   *
-   * @return a set containing the {@link URI}s of the graphs
-   */
-  public Set<URI> getGraphURIs() {
-    
-    Set<URI> graphURIs = new HashSet<URI>();
-    graphURIs.addAll(lhs.getGraphURIs());
-    graphURIs.addAll(rhs.getGraphURIs());
-
-    return graphURIs;
-  }
-
-  //
-  // Additional API
-  //
-
-  /**
-   * Accessor for the <var>lhs</var> property.
-   *
-   * @return The LHS value
-   */
-  public ModelExpression getLHS() {
-
-    return lhs;
-  }
-
-  /**
-   * Accessor for the <var>rhs</var> property.
-   *
-   * @return The RHS value
-   */
-  public ModelExpression getRHS() {
-
-    return rhs;
-  }
-
-  /**
-   * Transform to an equivalent WHERE clause expression.
-   *
-   * @param m The object to compare against.
-   * @return <code>true</code> if the objects are the same type,
-   *         and applied to the same operands 
-   */
-  public boolean equals(Object m) {
-    
-    if (!(m instanceof ModelOperation)) return false;
-    if ((m == null) || !m.getClass().equals(getClass())) return false;
-    if (m == this) return true;
-
-    Class<?> type = m.getClass();
-
-    Set<ModelExpression> otherExpressions = new HashSet<ModelExpression>();
-    ((ModelOperation)m).flattenExpression(otherExpressions, type);
-
-    Set<ModelExpression> myExpressions = new HashSet<ModelExpression>();
-    flattenExpression(myExpressions, type);
-
-    return myExpressions.equals(otherExpressions);
-  }
-
-  /**
-   * Creates a hash code, based on the child expressions and the current operation type.
-   *
-   * @return The hash code for this object.
-   */
-  public int hashCode() {
-
-    Set<ModelExpression> myExpressions = new HashSet<ModelExpression>();
-    flattenExpression(myExpressions, getClass());
-
-    return (getClass().hashCode() * 7) + myExpressions.hashCode();
-  }
-
-  /**
-   * Traverse down the binary tree of the current object, and merge any nodes
-   * of the current type into a flattened set.
-   *
-   * @param expressions The set to be built up containing all nodes being
-   *        operated on in the same way.
-   * @param type The class representing the operation type.
-   */
-  private void flattenExpression(Set<ModelExpression> expressions, Class<?> type) {
-
-    if (lhs.getClass().equals(type)) {
-      ((ModelOperation)lhs).flattenExpression(expressions, type);
-    } else {
-      expressions.add(lhs);
-    }
-
-    if (rhs.getClass().equals(type)) {
-      ((ModelOperation)rhs).flattenExpression(expressions, type);
-    } else {
-      expressions.add(rhs);
-    }
-  }
-
-  /**
-   * Clones sets of models in the rhs and lhs objects.
-   */
-  public Object clone() {
-
-    try {
-      ModelOperation cloned = (ModelOperation)super.clone();
-
-      // Copy database URIs.
-      cloned.lhs = (ModelExpression)lhs.clone();
-      cloned.rhs = (ModelExpression)rhs.clone();
-
-      return cloned;
-    } catch (CloneNotSupportedException e) {
-      throw new RuntimeException("ModelOperation subclass " + getClass() + " not cloneable");
-    }
-  }
-
-
-  public String toString() {
-    return getClass().toString() + ":[(" + lhs.toString() + ") . (" + rhs.toString() +")]";
-  }
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelPartition.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelPartition.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelPartition.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,92 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-
-// Third party packages
-import org.apache.log4j.Logger;
-
-/**
- * A model expression composed of the union of two subexpressions.
- *
- *
- * @created 2002-05-20
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy; 2002-2004 <A href="http://www.PIsoftware.com/">Plugged In
- *      Software Pty Ltd</A>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelPartition extends ModelOperation {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = 8660358035003409731L;
-
-  /** Logger. */
-  @SuppressWarnings("unused")
-  private final static Logger logger = Logger.getLogger(ModelPartition.class);
-
-  //
-  // Constructor
-  //
-
-  /**
-   * Construct a model union.
-   *
-   * @param lhs a non-<code>null</code> model expression
-   * @param rhs another non-<code>null</code> model expression
-   */
-  public ModelPartition(ModelExpression lhs, ModelExpression rhs) {
-    super(lhs, rhs);
-  }
-
-  /**
-   * Legible representation
-   *
-   * @return RETURNED VALUE TO DO
-   */
-  public String toString() {
-
-    return "(" + getLHS() + " par " + getRHS() + ")";
-  }
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelResource.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelResource.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelResource.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,219 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-// Java 2 standard packages
-import java.net.*;
-import java.util.*;
-
-// Third party packages
-import org.apache.log4j.Logger;
-
-
-/**
- * A leaf expression containing the {@link URL} of an RDF model.
- *
- * @created 2001-07-12
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright &copy;2001-2003
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelResource implements Model {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = -5673467065206144337L;
-
-  /** Logger. This is named after the class. */
-  @SuppressWarnings("unused")
-  private final static Logger logger = Logger.getLogger(ModelResource.class.getName());
-
-  /** The {@link URI} of the RDF model. */
-  private URI uri;
-
-  //
-  // Constructors
-  //
-
-  /**
-   * Construct a model from a {@link URL}.
-   *
-   * @param uri the {@link URI} of the model to query
-   * @throws IllegalArgumentException if <var>url</var> is <code>null</code>
-   */
-  public ModelResource(URI uri) {
-
-    // Validate "uri" parameter
-    if (uri == null) {
-
-      throw new IllegalArgumentException("Null \"uri\" parameter");
-    }
-
-    // Initialize fields
-    this.uri = uri;
-  }
-
-  //
-  // Methods implementing ModelExpression
-  //
-
-  /**
-   * @return an immutable singleton {@link Set} containing the {@link URL} of
-   *   the server if this is a Java RMI, BEEP, or local model, or the empty
-   *   {@link Set} otherwise
-   */
-  @SuppressWarnings("unchecked")
-  public Set<URI> getDatabaseURIs() {
-
-    try {
-
-      if ("beep".equals(uri.getScheme()) || "rmi".equals(uri.getScheme()) ||
-          "local".equals(uri.getScheme())) {
-
-        // In Java RMI models, the database is the URI without
-        // the fragment identifier
-        // TODO: Call RmiQueryHandler.serverURI instead
-        return Collections.singleton(new URI(uri.getScheme(),
-                                             uri.getAuthority(),
-                                             uri.getPath(),
-                                             null,
-                                             null));
-      } else {
-        return (Set<URI>)Collections.EMPTY_SET;
-      }
-    } catch (URISyntaxException e) {
-      throw new RuntimeException("Couldn't truncate model URI " + uri + " to obtain a database URI");
-    }
-
-  }
-
-  /** @see org.mulgara.query.ModelExpression#getGraphURIs() */
-  public Set<URI> getGraphURIs() {
-    return Collections.singleton(uri);
-  }
-
-  //
-  // API methods
-  //
-
-  /**
-   * Accessor for the <var>uri</var> property.
-   *
-   * @return a {@link URI} instance (never <code>null</code>)
-   */
-  public URI getURI() {
-
-    return uri;
-  }
-
-  //
-  // Methods extending Object
-  //
-
-  /**
-   * The text representation of the URI.
-   *
-   * @return the text representation of the URI.
-   */
-  public String toString() {
-
-    return uri.toString();
-  }
-
-  //
-  // Methods overriding Object
-  //
-
-  /**
-   * Return true if the URIs of a ModelResource are equal.
-   *
-   * @param object ModelResource to test equality.
-   * @return true if the URIs of a ModelResource are equal.
-   */
-  public boolean equals(Object object) {
-
-    if (object == null) {
-
-      return false;
-    }
-
-    try {
-
-      ModelResource tmpModelResource = (ModelResource) object;
-      return getURI().equals(tmpModelResource.getURI());
-    }
-    catch (ClassCastException cce) {
-
-      return false;
-    }
-  }
-
-  /**
-   * Returns the hashCode of a URI.
-   *
-   * @return the hashCode of a URI.
-   */
-  public int hashCode() {
-
-    return uri.hashCode();
-  }
-
-  /**
-   * Returns just the default Object clone.
-   *
-   * @return just the default Object clone.
-   */
-  public Object clone() {
-
-    try {
-
-      ModelResource cloned = (ModelResource) super.clone();
-      cloned.uri = getURI();
-      return cloned;
-    }
-    catch (CloneNotSupportedException e) {
-
-      throw new RuntimeException("ModelResource not cloneable");
-    }
-  }
-
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelResourceUnitTest.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelResourceUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelResourceUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,146 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-// Java packages
-import java.net.URI;
-
-// JUnit
-import junit.framework.*;
-
-// Log4J
-import org.apache.log4j.Logger;
-
-/**
- * Tests the functionality of ModelResource.
- *
- * @created 2004-04-15
- *
- * @author Andrew Newman
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright &copy;2001-2003
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelResourceUnitTest extends TestCase {
-
-  /**
-   * Logger.
-   */
-  private static final Logger logger = Logger.getLogger(ModelResourceUnitTest.class);
-
-  /**
-   * Construct a new unit test.
-   *
-   * @param name the name of the test
-   */
-  public ModelResourceUnitTest(String name) {
-
-    super(name);
-  }
-
-  /**
-   * Hook for test runner to obtain a test suite from.
-   *
-   * @return The test suite
-   */
-  public static Test suite() {
-
-    TestSuite suite = new TestSuite();
-    suite.addTest(new ModelResourceUnitTest("testEquals"));
-    suite.addTest(new ModelResourceUnitTest("testClone"));
-    return suite;
-  }
-
-  /**
-   * Default text runner.
-   *
-   * @param args The command line arguments
-   */
-  public static void main(String[] args) {
-
-    junit.textui.TestRunner.run(suite());
-  }
-
-  //
-  // Test cases
-  //
-
-  /**
-   * Test equality of two model resource.
-   */
-  public void testEquals() {
-
-    try {
-
-      ModelResource res1 = new ModelResource(new URI("rmi://foo/server1#_"));
-      ModelResource res2 = new ModelResource(new URI("rmi://foo/server1#"));
-      ModelResource res3 = new ModelResource(new URI("rmi://foo/server1#"));
-
-      assertEquals("Two ModelResource with the same RMI protcol should " +
-          "resolve to the same server", res1.getDatabaseURIs(),
-          res2.getDatabaseURIs());
-
-      assertFalse("Resource should be unequal", res1.equals(res2));
-
-      assertNotSame("Resources should be different instances", res2, res3);
-      assertTrue("Resource should be equal", res2.equals(res3));
-    }
-    catch (Exception e) {
-
-      e.printStackTrace();
-    }
-  }
-
-  /**
-   * Test clone of two resources.
-   */
-  public void testClone() {
-
-    try {
-
-      ModelResource res1 = new ModelResource(new URI("rmi://foo/server1#_"));
-      ModelResource res2 = (ModelResource) res1.clone();
-
-      assertNotSame("Resources should be different instances", res1, res2);
-      assertTrue("Resources should be equal", res1.equals(res2));
-    }
-    catch (Exception e) {
-
-      e.printStackTrace();
-    }
-  }
-}
-

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelUnion.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelUnion.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelUnion.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,81 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.query;
-
-/**
- * A model expression composed of the union of two subexpressions.
- *
- * @created 2001-08-12
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright &copy;2001-2004
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelUnion extends ModelOperation {
-
-  /**
-   * Allow newer compiled version of the stub to operate when changes
-   * have not occurred with the class.
-   * NOTE : update this serialVersionUID when a method or a public member is
-   * deleted.
-   */
-  static final long serialVersionUID = -2658255434397870185L;
-
-  //
-  // Constructor
-  //
-
-  /**
-   * Construct a model union.
-   *
-   * @param lhs a non-<code>null</code> model expression
-   * @param rhs another non-<code>null</code> model expression
-   */
-  public ModelUnion(ModelExpression lhs, ModelExpression rhs) {
-    super(lhs, rhs);
-  }
-
-  /**
-   * Legible representation
-   *
-   * @return RETURNED VALUE TO DO
-   */
-  public String toString() {
-
-    return "(" + getLHS() + " union " + getRHS() + ")";
-  }
-}

Deleted: trunk/src/jar/query/java/org/mulgara/query/ModelVariable.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ModelVariable.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/ModelVariable.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,141 +0,0 @@
-/**
- * The contents of this file are subject to the Open Software License
- * Version 3.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.opensource.org/licenses/osl-3.0.txt
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- */
-
-package org.mulgara.query;
-
-// Java 2 standard packages
-import java.net.*;
-import java.util.*;
-
-// Third party packages
-import org.apache.log4j.Logger;
-
-/**
- * A leaf expression containing a variable that is used for the model expression.
- *
- * @created Apr 22, 2008
- * @author Paul Gearon
- * @copyright &copy; 2008 <a href="http://www.topazproject.org/">The Topaz Project</a>
- * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
- */
-public class ModelVariable implements Model {
-
-  /** Used for serializing. */
-  static final long serialVersionUID = 5132086338306266830L;
-
-  /** Logger. */
-  @SuppressWarnings("unused")
-  private final static Logger logger = Logger.getLogger(ModelVariable.class);
-
-  /** The variable for the graph */
-  private Variable variable;
-
-  //
-  // Constructors
-  //
-
-  /**
-   * Construct a model from a {@link URL}.
-   *
-   * @param uri the {@link URI} of the model to query
-   * @throws IllegalArgumentException if <var>url</var> is <code>null</code>
-   */
-  public ModelVariable(Variable variable) {
-    if (variable == null) throw new IllegalArgumentException("Null variable parameter");
-    this.variable = variable;
-  }
-
-  //
-  // Methods implementing ModelExpression
-  //
-
-  /**
-   * Gets a set of database URIs to operate against.
-   * @return We don't know what is in the variable, so return the empty {@link Set}
-   */
-  public Set<URI> getDatabaseURIs() {
-    return Collections.emptySet();
-  }
-
-  /**
-   * Gets a set of graph URIs this represents.
-   * @return We don't know what is in the variable, so return the empty {@link Set}
-   */
-  public Set<URI> getGraphURIs() {
-    return Collections.emptySet();
-  }
-
-  //
-  // API methods
-  //
-
-  /**
-   * Accessor for the <var>variable</var> property.
-   * @return a {@link Variable} instance
-   */
-  public Variable getVariable() {
-    return variable;
-  }
-
-  //
-  // Methods extending Object
-  //
-
-  /**
-   * The text representation of the URI.
-   * @return the text representation of the URI.
-   */
-  public String toString() {
-    return variable.toString();
-  }
-
-  //
-  // Methods overriding Object
-  //
-
-  /**
-   * Return true if the variables of a ModelVariable are equal.
-   * @param object ModelVariable to test equality.
-   * @return true if the variables of a ModelVariable are equal.
-   */
-  public boolean equals(Object object) {
-    if (object == null) return false;
-    if (object == this) return true;
-
-    if (!(object instanceof ModelVariable)) return false;
-    ModelVariable modelVar = (ModelVariable)object;
-    return variable.equals(modelVar.variable);
-  }
-
-  /**
-   * Returns the hashCode of a Variable.
-   * @return the hashCode of a Variable.
-   */
-  public int hashCode() {
-    return variable.hashCode();
-  }
-
-  /**
-   * Returns just the default Object clone.
-   * @return just the default Object clone.
-   */
-  public Object clone() {
-    try {
-      ModelVariable cloned = (ModelVariable)super.clone();
-      cloned.variable = variable;
-      return cloned;
-    } catch (CloneNotSupportedException e) {
-      throw new RuntimeException("ModelVariable not cloneable");
-    }
-  }
-
-}

Modified: trunk/src/jar/query/java/org/mulgara/query/Query.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/Query.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/Query.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -82,7 +82,7 @@
   private List<SelectElement> mutableVariableList;
 
   /** The model expression. It corresponds to the <code>from</code> clause. */
-  private ModelExpression modelExpression;
+  private GraphExpression graphExpression;
 
   /** The constraint expression.  It corresponds to the <code>where</code> clause. */
   private ConstraintExpression constraintExpression;
@@ -126,7 +126,7 @@
    *     in the solution (i.e. columns of the result {@link Answer});
    *     <code>null</code> indicates that all columns are to be retained.
    *     This is a list of: Variable; ConstantValue; Count; Subquery.
-   * @param modelExpression an expression defining the model to query, never
+   * @param graphExpression an expression defining the model to query, never
    *     <code>null</code>
    * @param constraintExpression an expression defining the constraints to
    *     satisfy, never <code>null</code>
@@ -142,18 +142,18 @@
    *     {@link UnconstrainedAnswer} for no constraints; never
    *     <code>null</code> is
    * @throws IllegalArgumentException if <var>limit</var> or <var>offset</var>
-   *     are negative, or if <var>modelExpression</var>,
+   *     are negative, or if <var>graphExpression</var>,
    *     <var>constraintExpression</var>, <var>orderList<var> or
    *     <var>answer</var> are <code>null</code>
    */
-  public Query(List<? extends SelectElement> variableList, ModelExpression modelExpression,
+  public Query(List<? extends SelectElement> variableList, GraphExpression graphExpression,
       ConstraintExpression constraintExpression,
       ConstraintHaving havingExpression, List<Order> orderList, Integer limit,
       int offset, Answer answer) {
 
     // Validate parameters
-    if (modelExpression == null) {
-      throw new IllegalArgumentException("Null \"modelExpression\" parameter");
+    if (graphExpression == null) {
+      throw new IllegalArgumentException("Null \"graphExpression\" parameter");
     } else if (constraintExpression == null) {
       throw new IllegalArgumentException("Null \"constraintExpression\" parameter");
     } else if ((limit != null) && (limit.intValue() < 0)) {
@@ -183,7 +183,7 @@
     // Initialize fields
     this.mutableVariableList = (variableList == null) ? null : new ArrayList<SelectElement>(variableList);
     this.variableList = (variableList == null) ? null : Collections.unmodifiableList(mutableVariableList);
-    this.modelExpression = modelExpression;
+    this.graphExpression = graphExpression;
     this.constraintExpression = constraintExpression;
     this.havingConstraint = havingExpression;
     this.orderList = Collections.unmodifiableList(new ArrayList<Order>(orderList));
@@ -200,7 +200,7 @@
   public Query(Query query, ConstraintExpression where) {
     this.mutableVariableList = query.mutableVariableList;
     this.variableList = query.variableList;
-    this.modelExpression = query.modelExpression;
+    this.graphExpression = query.graphExpression;
     this.constraintExpression = where;
     this.havingConstraint = query.havingConstraint;
     this.orderList = query.orderList;
@@ -251,7 +251,7 @@
       }
       cloned.mutableVariableList = Collections.unmodifiableList(cloned.variableList);
     }
-    cloned.modelExpression = modelExpression;  // FIXME: should be cloned
+    cloned.graphExpression = graphExpression;  // FIXME: should be cloned
     cloned.answer = (Answer)answer.clone();
 
     // Copy immutable fields by reference
@@ -297,11 +297,11 @@
 
 
   /**
-   * Accessor for the <code>modelExpression</code> property.
-   * @return a {@link ModelExpression}, or <code>null</code> to indicate the empty model
+   * Accessor for the <code>graphExpression</code> property.
+   * @return a {@link GraphExpression}, or <code>null</code> to indicate the empty model
    */
-  public ModelExpression getModelExpression() {
-    return modelExpression;
+  public GraphExpression getModelExpression() {
+    return graphExpression;
   }
 
 
@@ -364,10 +364,10 @@
     // Check the variableList field
     if (!variableList.equals(query.variableList)) return false;
 
-    // Check the modelExpression field
-    if ((modelExpression == null) ?
-        (query.modelExpression != null) :
-        (!modelExpression.equals(query.modelExpression))) {
+    // Check the graphExpression field
+    if ((graphExpression == null) ?
+        (query.graphExpression != null) :
+        (!graphExpression.equals(query.graphExpression))) {
       return false;
     }
 
@@ -450,7 +450,7 @@
     }
 
     // FROM
-    buffer.append("FROM ").append(modelExpression);
+    buffer.append("FROM ").append(graphExpression);
 
     // WHERE
     buffer.append(" WHERE ").append(constraintExpression);

Modified: trunk/src/jar/query/java/org/mulgara/query/QueryUnitTest.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/QueryUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/QueryUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -101,7 +101,7 @@
   public void setUp() throws Exception {
     query = new Query(
         Arrays.asList(new SelectElement[] { new Variable("x") }), // variable list
-        new ModelResource(new URI("x:m")),      // model expression
+        new GraphResource(new URI("x:m")),      // model expression
         new ConstraintImpl(new Variable("x"),   // constraint expression
         new URIReferenceImpl(new URI("x:p")),
         new LiteralImpl("o")),
@@ -147,7 +147,7 @@
     // Compose test instances
     Query query2 = new Query(
         Arrays.asList(new SelectElement[] { new Variable("x") }), // variable list
-        new ModelResource(new URI("x:m")),      // model expression
+        new GraphResource(new URI("x:m")),      // model expression
         new ConstraintImpl(new Variable("x"),   // constraint expression
         new URIReferenceImpl(new URI("x:p")),
         new LiteralImpl("o")),

Modified: trunk/src/jar/query/java/org/mulgara/query/operation/Load.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/operation/Load.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/operation/Load.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -17,7 +17,7 @@
 
 import org.apache.log4j.Logger;
 import org.mulgara.connection.Connection;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.query.QueryException;
 import org.mulgara.query.rdf.Mulgara;
 
@@ -37,8 +37,8 @@
   /** Dummy source model URI to pass to the server when overriding with local stream. */
   protected static final URI DUMMY_RDF_SOURCE = URI.create(Mulgara.NAMESPACE+"locally-sourced-inputStream.rdf");
   
-  /** Model resource form of the source URI */
-  private final ModelResource srcRsc;
+  /** Graph resource form of the source URI */
+  private final GraphResource srcRsc;
   
   /**
    * Build a load operation, loading data from one URI into a graph specified by another URI.
@@ -52,7 +52,7 @@
     // Validate arguments.
     if (graphURI == null) throw new IllegalArgumentException("Need a valid destination graph URI");
     
-    srcRsc = new ModelResource(source == null ? DUMMY_RDF_SOURCE : source);
+    srcRsc = new GraphResource(source == null ? DUMMY_RDF_SOURCE : source);
   }
 
 

Modified: trunk/src/jar/query/java/org/mulgara/query/operation/ServerCommand.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/operation/ServerCommand.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/query/operation/ServerCommand.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -15,7 +15,7 @@
 import java.util.Iterator;
 import java.util.Set;
 
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 
 /**
  * An AST element for server-based commands.
@@ -31,7 +31,7 @@
   private String textualForm;
 
   /** The graph being referred to on the server. */
-  private final ModelResource serverGraph;
+  private final GraphResource serverGraph;
   
   /** The message set by the result of this command. */
   private String resultMessage;
@@ -41,7 +41,7 @@
    * @param serverGraphUri The URI of the graph.
    */
   public ServerCommand(URI serverGraphUri) {
-    serverGraph = (serverGraphUri != null) ? new ModelResource(serverGraphUri) : null;
+    serverGraph = (serverGraphUri != null) ? new GraphResource(serverGraphUri) : null;
     resultMessage = "";
   }
   

Modified: trunk/src/jar/query/java/org/mulgara/server/Session.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/server/Session.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/query/java/org/mulgara/server/Session.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -41,7 +41,7 @@
 import org.mulgara.query.AskQuery;
 import org.mulgara.query.ConstructQuery;
 import org.mulgara.query.GraphAnswer;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
 import org.mulgara.query.rdf.Mulgara;
@@ -278,14 +278,14 @@
   public boolean modelExists(URI uri) throws QueryException;
 
   /**
-   * Define the contents of a model via a {@link ModelExpression}
+   * Define the contents of a model via a {@link GraphExpression}
    *
    * @param uri the {@link URI} of the model to be redefined
-   * @param modelExpression the new content for the model
+   * @param graphExpression 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, ModelExpression modelExpression)
+  public long setModel(URI uri, GraphExpression graphExpression)
     throws QueryException;
 
   /**
@@ -293,12 +293,12 @@
    *
    * @param inputStream a remote inputstream
    * @param uri the {@link URI} of the model to be redefined
-   * @param modelExpression the new content for the model
+   * @param graphExpression 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,
-      ModelExpression modelExpression) throws QueryException;
+      GraphExpression graphExpression) throws QueryException;
 
   /**
    * Extract {@link Rules} from the data found in a model.

Modified: trunk/src/jar/querylang/java/org/mulgara/itql/Collaborator.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/Collaborator.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/Collaborator.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -785,7 +785,7 @@
     }
 
     if (initialized == false) {
-      // Model has not been initialized
+      // Graph has not been initialized
       initialized = createModel();
     } else {
       log.debug("Collaborator model already initialized at " + SERVER + MODEL);

Modified: trunk/src/jar/querylang/java/org/mulgara/itql/CollaboratorUnitTest.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/CollaboratorUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/CollaboratorUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -161,7 +161,7 @@
       assertTrue("Failed to create collaborator model", collaborator.createModel());
     } catch (SOAPException ex) {
       ex.printStackTrace();
-      fail("Model tests failed " + ex.getMessage());
+      fail("Graph tests failed " + ex.getMessage());
     }
   }
 

Copied: trunk/src/jar/querylang/java/org/mulgara/itql/GraphExpressionBuilder.java (from rev 1397, trunk/src/jar/querylang/java/org/mulgara/itql/ModelExpressionBuilder.java)
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/GraphExpressionBuilder.java	                        (rev 0)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/GraphExpressionBuilder.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,551 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.itql;
+
+// Java 2 standard packages
+import java.net.*;
+import java.util.*;
+
+// Third party packages
+import org.apache.log4j.Logger;
+
+// Automatically generated packages (SableCC)
+import org.mulgara.itql.node.AAndModelTerm;
+import org.mulgara.itql.node.AExpressionModelFactor;
+import org.mulgara.itql.node.AFactorModelPart;
+import org.mulgara.itql.node.AOrModelExpression;
+import org.mulgara.itql.node.APartModelTerm;
+import org.mulgara.itql.node.AResourceModelFactor;
+import org.mulgara.itql.node.ATermModelExpression;
+import org.mulgara.itql.node.AXorModelPart;
+import org.mulgara.itql.node.PModelExpression;
+import org.mulgara.itql.node.PModelFactor;
+import org.mulgara.itql.node.PModelPart;
+import org.mulgara.itql.node.PModelTerm;
+import org.mulgara.query.GraphExpression;
+import org.mulgara.query.GraphIntersection;
+import org.mulgara.query.GraphPartition;
+import org.mulgara.query.GraphResource;
+import org.mulgara.query.GraphUnion;
+import org.mulgara.query.QueryException;
+import org.mulgara.util.ServerURIHandler;
+import org.mulgara.util.URIUtil;
+
+/**
+ * Builds model expressions using input from the iTQL command interpreter.
+ *
+ * @created 2001-09-11
+ *
+ * @author Tom Adams
+ *
+ * @version $Revision: 1.9 $
+ *
+ * @modified $Date: 2005/04/04 11:30:11 $ by $Author: tomadams $
+ *
+ * @maintenanceAuthor $Author: tomadams $
+ *
+ * @copyright &copy;2001-2004
+ *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphExpressionBuilder {
+
+  //
+  // Constants
+  //
+
+  /**
+   * the category to log to
+   */
+  private final static Logger logger =
+    Logger.getLogger(GraphExpressionBuilder.class.getName());
+
+  //
+  // Public API (methods overridden from ExpressionBuilder)
+  //
+
+  /**
+   * Builds a {@link org.mulgara.query.GraphExpression} object from a {@link
+   * org.mulgara.itql.node.PModelExpression}, using an <code>aliasMap</code>
+   * to resolve aliases.
+   *
+   * TODO: aliasMap is currently ignored!
+   * 
+   * @param aliasMap the map from targets to aliases
+   * @param expression a model expression from the parser
+   * @return RETURNED VALUE TO DO
+   * @throws QueryException if <code>rawModelExpression</code> does not
+   *      represent a valid query
+   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
+   *      a resource whose text violates <a
+   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
+   */
+  public static GraphExpression build(Map<String,URI> aliasMap,
+    PModelExpression expression) throws QueryException, URISyntaxException {
+
+    // validate aliasMap parameter
+    if (aliasMap == null) {
+
+      throw new IllegalArgumentException("Null \"aliasMap\" parameter");
+    }
+
+    // end if
+    // validate expression parameter
+    if (expression == null) {
+
+      throw new IllegalArgumentException("Null \"expression\" parameter");
+    }
+
+    // end if
+    // logger that we're building a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Building model expression from " + expression);
+    }
+
+    // build the model expression from the parser input
+    GraphExpression graphExpression = buildModelExpression(expression, aliasMap);
+
+    // logger that we've building successfully built a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Successfully built model expression from " + expression);
+    }
+
+    // return the model expression
+    return graphExpression;
+  }
+
+  // build()
+  //
+  // Internal methods
+  //
+
+  /**
+   * Recursively builds a {@link org.mulgara.query.GraphExpression} from a
+   * {@link org.mulgara.itql.node.PModelExpression}.
+   *
+   * @param rawModelExpression a raw model expression from the parser
+   * @return a {@link org.mulgara.query.GraphExpression} suitable for use in
+   *      creating a {@link org.mulgara.query.Query}
+   * @throws QueryException if <code>rawModelExpression</code> does not
+   *      represent a valid query
+   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
+   *      a resource whose text violates <a
+   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
+   */
+  private static GraphExpression buildModelExpression(
+    PModelExpression rawModelExpression, Map<String,URI> aliasMap)
+    throws QueryException, URISyntaxException {
+
+    // validate the rawModelExpression parameter
+    if (rawModelExpression == null) {
+
+      throw new IllegalArgumentException("Null \"rawModelExpression\" " +
+        "parameter");
+    }
+
+    // end if
+    // logger that we're building a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Building model expression from " + rawModelExpression);
+    }
+
+    // create a new model expression that we can return
+    GraphExpression graphExpression = null;
+
+    // drill down to find its constituents
+    if (rawModelExpression instanceof AOrModelExpression) {
+
+      // logger that we've found a OR model expression
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found OR model expression " + rawModelExpression);
+      }
+
+      // get the OR model expression
+      PModelExpression orModelExpression =
+        ((AOrModelExpression) rawModelExpression).getModelExpression();
+
+      // get the model term
+      PModelTerm modelTerm =
+        ((AOrModelExpression) rawModelExpression).getModelTerm();
+
+      // logger that we've found the operands of the union
+      if (logger.isDebugEnabled()) {
+        logger.debug("Recursing with model expression " + orModelExpression +
+            " & model term " + modelTerm);
+      }
+
+      // get the LHS and RHS operands of the union
+      GraphExpression lhs = buildModelExpression(orModelExpression, aliasMap);
+      GraphExpression rhs = buildModelExpression(modelTerm, aliasMap);
+
+      // logger that we've resolved the operands
+      if (logger.isDebugEnabled()) {
+        logger.debug("Resolved LHS union operand " + lhs);
+        logger.debug("Resolved RHS union operand " + rhs);
+      }
+
+      // apply the union
+      graphExpression = new GraphUnion(lhs, rhs);
+    } else if (rawModelExpression instanceof ATermModelExpression) {
+
+      // logger that we've got a term model expression
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found term model expression " + rawModelExpression);
+      }
+
+      // get the model term
+      PModelTerm modelTerm = ((ATermModelExpression)rawModelExpression).getModelTerm();
+
+      // logger that we're about to resolve the term into an expression
+      if (logger.isDebugEnabled()) {
+        logger.debug("Recursing with model term " + modelTerm);
+      }
+
+      // drill down into the model term
+      graphExpression = buildModelExpression(modelTerm, aliasMap);
+    }
+
+    // end if
+    // we should not be returning null
+    if (graphExpression == null) {
+
+      throw new QueryException("Unable to parse ITQL model expression " +
+        "into a valid model expression");
+    }
+
+    // end if
+    // logger that we've created a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Created model expression " + graphExpression);
+    }
+
+    // return the built up expression
+    return graphExpression;
+  }
+
+  // buildModelExpression()
+
+  /**
+   * Recursively builds a {@link org.mulgara.query.GraphExpression} from a
+   * {@link org.mulgara.itql.node.PModelTerm}.
+   *
+   * @param rawModelTerm a raw model term from the parser
+   * @return a {@link org.mulgara.query.GraphExpression} suitable for use in
+   *      creating a {@link org.mulgara.query.Query}
+   * @throws QueryException if <code>rawModelExpression</code> does not
+   *      represent a valid query
+   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
+   *      a resource whose text violates <a
+   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
+   */
+  private static GraphExpression buildModelExpression(
+      PModelTerm rawModelTerm, Map<String,URI> aliasMap
+    ) throws QueryException, URISyntaxException {
+
+    // validate the rawModelTerm parameter
+    if (rawModelTerm == null) {
+
+      throw new IllegalArgumentException("Null \"rawModelTerm\" " +
+        "parameter");
+    }
+
+    // end if
+    // logger that we're building a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Building model expression from " + rawModelTerm);
+    }
+
+    // create a new model expression that we can return
+    GraphExpression graphExpression = null;
+
+    // drill down into the model term
+    if (rawModelTerm instanceof APartModelTerm) {
+
+      // logger that we've got a factor model term
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found factor contraint term " + rawModelTerm);
+      }
+
+      // get the model factor
+      PModelPart modelPart = ((APartModelTerm) rawModelTerm).getModelPart();
+
+      // logger that we're recursing with a model part
+      if (logger.isDebugEnabled()) {
+        logger.debug("Recursing with model part " + modelPart);
+      }
+
+      // drill down into the model part
+      graphExpression = buildModelExpression(modelPart, aliasMap);
+
+    } else if (rawModelTerm instanceof AAndModelTerm) {
+
+      // logger that we've got a AND model term
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found AND contraint term " + rawModelTerm);
+      }
+
+      // get the model term
+      PModelTerm modelTerm = ((AAndModelTerm)rawModelTerm).getModelTerm();
+
+      // get the model part
+      PModelPart modelPart = ((AAndModelTerm)rawModelTerm).getModelPart();
+
+      // logger that we've found the operands of the union
+      if (logger.isDebugEnabled()) {
+        logger.debug("Recursing with model term " + modelTerm +
+            " & model part " + modelPart);
+      }
+
+      // get the LHS and RHS operands of the intersection
+      GraphExpression lhs = buildModelExpression(modelTerm, aliasMap);
+      GraphExpression rhs = buildModelExpression(modelPart, aliasMap);
+
+      // logger that we've resolved the operands
+      if (logger.isDebugEnabled()) {
+        logger.debug("Resolved LHS intersection operand " + lhs);
+        logger.debug("Resolved RHS intersection operand " + rhs);
+      }
+
+      // apply the intersection
+      graphExpression = new GraphIntersection(lhs, rhs);
+    }
+
+    // end if
+    // we should not be returning null
+    if (graphExpression == null) {
+
+      throw new QueryException("Unable to parse ITQL model term into a valid model expression");
+    }
+
+    // end if
+    // logger that we've created a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Created model expression " + graphExpression);
+    }
+
+    // return the built up expression
+    return graphExpression;
+  }
+
+  // buildModelExpression()
+
+  /**
+   * Recursively builds a {@link org.mulgara.query.GraphExpression} from a
+   * {@link org.mulgara.itql.node.PModelPart}.
+   *
+   * @param rawModelPart a raw model part from the parser
+   * @return a {@link org.mulgara.query.GraphExpression} suitable for use in
+   *      creating a {@link org.mulgara.query.Query}
+   * @throws QueryException if <code>rawModelExpression</code> does not
+   *      represent a valid query
+   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
+   *      a resource whose text violates <a
+   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
+   */
+  private static GraphExpression buildModelExpression(
+      PModelPart rawModelPart, Map<String,URI> aliasMap
+    ) throws QueryException, URISyntaxException {
+
+    // validate the rawModelPart parameter
+    if (rawModelPart == null) {
+      throw new IllegalArgumentException("Null \"rawModelPart\" " +
+        "parameter");
+    }
+
+    // end if
+    // logger that we're building a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Building model expression from " + rawModelPart);
+    }
+
+    // create a new model expression that we can return
+    GraphExpression graphExpression = null;
+
+    // drill down into the model term
+    if (rawModelPart instanceof AFactorModelPart) {
+
+      // logger that we've got a factor model term
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found factor contraint term " + rawModelPart);
+      }
+
+      // get the model factor
+      PModelFactor modelFactor = ((AFactorModelPart)rawModelPart).getModelFactor();
+
+      // logger that we're recursing with a model factor
+      if (logger.isDebugEnabled()) {
+        logger.debug("Recursing with model factor " + modelFactor);
+      }
+
+      // drill down into the model part
+      graphExpression = buildModelExpression(modelFactor, aliasMap);
+    } else if (rawModelPart instanceof AXorModelPart) {
+
+      // logger that we've got a AND model term
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found AND contraint term " + rawModelPart);
+      }
+
+      // get the model term
+      PModelPart modelPart = ((AXorModelPart)rawModelPart).getModelPart();
+
+      // get the model factor
+      PModelFactor modelFactor = ((AXorModelPart)rawModelPart).getModelFactor();
+
+      // logger that we've found the operands of the union
+      if (logger.isDebugEnabled()) {
+        logger.debug("Recursing with model part " + modelPart + " & model factor " + modelFactor);
+      }
+
+      // get the LHS and RHS operands of the intersection
+      GraphExpression lhs = buildModelExpression(modelPart, aliasMap);
+      GraphExpression rhs = buildModelExpression(modelFactor, aliasMap);
+
+      // logger that we've resolved the operands
+      if (logger.isDebugEnabled()) {
+        logger.debug("Resolved LHS intersection operand " + lhs);
+        logger.debug("Resolved RHS intersection operand " + rhs);
+      }
+
+      // apply the intersection
+      graphExpression = new GraphPartition(lhs, rhs);
+    }
+
+    // end if
+    // we should not be returning null
+    if (graphExpression == null) {
+
+      throw new QueryException("Unable to parse ITQL model term into a valid model expression");
+    }
+
+    // end if
+    // logger that we've created a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Created model expression " + graphExpression);
+    }
+
+    // return the built up expression
+    return graphExpression;
+  }
+
+  // buildModelExpression()
+
+  /**
+   * Recursively builds a {@link org.mulgara.query.GraphExpression} from a
+   * {@link org.mulgara.itql.node.PModelFactor}.
+   *
+   * @param rawModelFactor a raw model factor from the parser
+   * @return a {@link org.mulgara.query.GraphExpression} suitable for use in
+   *      creating a {@link org.mulgara.query.Query}
+   * @throws QueryException if <code>rawModelExpression</code> does not
+   *      represent a valid query
+   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
+   *      a resource whose text violates <a
+   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
+   */
+  private static GraphExpression buildModelExpression(
+        PModelFactor rawModelFactor, Map<String,URI> aliasMap
+      ) throws QueryException, URISyntaxException {
+
+    // validate the rawModelFactor parameter
+    if (rawModelFactor == null) {
+
+      throw new IllegalArgumentException("Null \"rawModelFactor\" parameter");
+    }
+
+    // end if
+    // logger that we're building a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Building model expression from " + rawModelFactor);
+    }
+
+    // create a new model expression that we can return
+    GraphExpression graphExpression = null;
+
+    // drill down into the model term
+    if (rawModelFactor instanceof AResourceModelFactor) {
+
+      // logger that we've got a model model factor
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found resource model factor " + rawModelFactor);
+      }
+
+      // get the resource
+      String resource = ((AResourceModelFactor)rawModelFactor).getResource().getText();
+
+      // logger that we've found a resource
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found resource " + resource);
+      }
+
+      // this resource is what we're looking for
+      URI modelURI = URIUtil.convertToURI(resource, aliasMap);
+      graphExpression = new GraphResource(ServerURIHandler.removePort(modelURI));
+    } else if (rawModelFactor instanceof AExpressionModelFactor) {
+
+      // logger that we've got an expression model factor
+      if (logger.isDebugEnabled()) {
+        logger.debug("Found factor expression model factor " + rawModelFactor);
+      }
+
+      // get the model expression
+      PModelExpression embeddedModelExpression = ((AExpressionModelFactor)rawModelFactor).getModelExpression();
+
+      // logger that we're recursing with a model expression
+      if (logger.isDebugEnabled()) {
+        logger.debug("Recursing with model factor " + graphExpression);
+      }
+
+      // build the model expression
+      graphExpression = buildModelExpression(embeddedModelExpression, aliasMap);
+    }
+
+    // end if
+    // we should not be returning null
+    if (graphExpression == null) {
+
+      throw new QueryException("Unable to parse ITQL model factor " +
+        "into a valid model expression");
+    }
+
+    // end if
+    // logger that we've created a model expression
+    if (logger.isDebugEnabled()) {
+      logger.debug("Created model expression " + graphExpression);
+    }
+
+    // return the built up expression
+    return graphExpression;
+  }
+
+  // buildModelExpression()
+}
+
+
+// GraphExpressionBuilder


Property changes on: trunk/src/jar/querylang/java/org/mulgara/itql/GraphExpressionBuilder.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/querylang/java/org/mulgara/itql/GraphNameCompletor.java (from rev 1397, trunk/src/jar/querylang/java/org/mulgara/itql/ModelNameCompletor.java)
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/GraphNameCompletor.java	                        (rev 0)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/GraphNameCompletor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,56 @@
+/*
+ * The contents of this file are subject to the Open Software License
+ * Version 3.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+
+package org.mulgara.itql;
+
+import java.util.List;
+
+import jline.Completor;
+
+public class GraphNameCompletor implements Completor {
+	
+	private List<String> modelNames;
+	
+	public GraphNameCompletor(List<String> modelNames) {
+		this.modelNames = modelNames;
+	}
+
+	@SuppressWarnings("unchecked")
+	public int complete(String s, int idx, List completionList) {
+		int retValue = idx;
+		
+		if(s.endsWith("<")) {
+			completionList.addAll(modelNames);
+		} else {
+			int gtIdx = s.lastIndexOf("<");
+			boolean addedSomething = false;
+		
+			if(gtIdx >= 0) {
+				String partial = s.substring(gtIdx+1);
+				for(String s2 : modelNames) {
+					if(s2.startsWith(partial)) {
+						completionList.add(s2);
+						addedSomething = true;
+					}
+				}
+			}
+			
+			if(addedSomething) {
+				retValue = gtIdx + 1;
+			}
+		}
+		
+		// TODO Auto-generated method stub
+		return retValue ;
+	}
+
+}


Property changes on: trunk/src/jar/querylang/java/org/mulgara/itql/GraphNameCompletor.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/src/jar/querylang/java/org/mulgara/itql/ModelExpressionBuilder.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/ModelExpressionBuilder.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/ModelExpressionBuilder.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,551 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.itql;
-
-// Java 2 standard packages
-import java.net.*;
-import java.util.*;
-
-// Third party packages
-import org.apache.log4j.Logger;
-
-// Automatically generated packages (SableCC)
-import org.mulgara.itql.node.AAndModelTerm;
-import org.mulgara.itql.node.AExpressionModelFactor;
-import org.mulgara.itql.node.AFactorModelPart;
-import org.mulgara.itql.node.AOrModelExpression;
-import org.mulgara.itql.node.APartModelTerm;
-import org.mulgara.itql.node.AResourceModelFactor;
-import org.mulgara.itql.node.ATermModelExpression;
-import org.mulgara.itql.node.AXorModelPart;
-import org.mulgara.itql.node.PModelExpression;
-import org.mulgara.itql.node.PModelFactor;
-import org.mulgara.itql.node.PModelPart;
-import org.mulgara.itql.node.PModelTerm;
-import org.mulgara.query.ModelExpression;
-import org.mulgara.query.ModelIntersection;
-import org.mulgara.query.ModelPartition;
-import org.mulgara.query.ModelResource;
-import org.mulgara.query.ModelUnion;
-import org.mulgara.query.QueryException;
-import org.mulgara.util.ServerURIHandler;
-import org.mulgara.util.URIUtil;
-
-/**
- * Builds model expressions using input from the iTQL command interpreter.
- *
- * @created 2001-09-11
- *
- * @author Tom Adams
- *
- * @version $Revision: 1.9 $
- *
- * @modified $Date: 2005/04/04 11:30:11 $ by $Author: tomadams $
- *
- * @maintenanceAuthor $Author: tomadams $
- *
- * @copyright &copy;2001-2004
- *   <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelExpressionBuilder {
-
-  //
-  // Constants
-  //
-
-  /**
-   * the category to log to
-   */
-  private final static Logger logger =
-    Logger.getLogger(ModelExpressionBuilder.class.getName());
-
-  //
-  // Public API (methods overridden from ExpressionBuilder)
-  //
-
-  /**
-   * Builds a {@link org.mulgara.query.ModelExpression} object from a {@link
-   * org.mulgara.itql.node.PModelExpression}, using an <code>aliasMap</code>
-   * to resolve aliases.
-   *
-   * TODO: aliasMap is currently ignored!
-   * 
-   * @param aliasMap the map from targets to aliases
-   * @param expression a model expression from the parser
-   * @return RETURNED VALUE TO DO
-   * @throws QueryException if <code>rawModelExpression</code> does not
-   *      represent a valid query
-   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
-   *      a resource whose text violates <a
-   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
-   */
-  public static ModelExpression build(Map<String,URI> aliasMap,
-    PModelExpression expression) throws QueryException, URISyntaxException {
-
-    // validate aliasMap parameter
-    if (aliasMap == null) {
-
-      throw new IllegalArgumentException("Null \"aliasMap\" parameter");
-    }
-
-    // end if
-    // validate expression parameter
-    if (expression == null) {
-
-      throw new IllegalArgumentException("Null \"expression\" parameter");
-    }
-
-    // end if
-    // logger that we're building a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Building model expression from " + expression);
-    }
-
-    // build the model expression from the parser input
-    ModelExpression modelExpression = buildModelExpression(expression, aliasMap);
-
-    // logger that we've building successfully built a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Successfully built model expression from " + expression);
-    }
-
-    // return the model expression
-    return modelExpression;
-  }
-
-  // build()
-  //
-  // Internal methods
-  //
-
-  /**
-   * Recursively builds a {@link org.mulgara.query.ModelExpression} from a
-   * {@link org.mulgara.itql.node.PModelExpression}.
-   *
-   * @param rawModelExpression a raw model expression from the parser
-   * @return a {@link org.mulgara.query.ModelExpression} suitable for use in
-   *      creating a {@link org.mulgara.query.Query}
-   * @throws QueryException if <code>rawModelExpression</code> does not
-   *      represent a valid query
-   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
-   *      a resource whose text violates <a
-   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
-   */
-  private static ModelExpression buildModelExpression(
-    PModelExpression rawModelExpression, Map<String,URI> aliasMap)
-    throws QueryException, URISyntaxException {
-
-    // validate the rawModelExpression parameter
-    if (rawModelExpression == null) {
-
-      throw new IllegalArgumentException("Null \"rawModelExpression\" " +
-        "parameter");
-    }
-
-    // end if
-    // logger that we're building a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Building model expression from " + rawModelExpression);
-    }
-
-    // create a new model expression that we can return
-    ModelExpression modelExpression = null;
-
-    // drill down to find its constituents
-    if (rawModelExpression instanceof AOrModelExpression) {
-
-      // logger that we've found a OR model expression
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found OR model expression " + rawModelExpression);
-      }
-
-      // get the OR model expression
-      PModelExpression orModelExpression =
-        ((AOrModelExpression) rawModelExpression).getModelExpression();
-
-      // get the model term
-      PModelTerm modelTerm =
-        ((AOrModelExpression) rawModelExpression).getModelTerm();
-
-      // logger that we've found the operands of the union
-      if (logger.isDebugEnabled()) {
-        logger.debug("Recursing with model expression " + orModelExpression +
-            " & model term " + modelTerm);
-      }
-
-      // get the LHS and RHS operands of the union
-      ModelExpression lhs = buildModelExpression(orModelExpression, aliasMap);
-      ModelExpression rhs = buildModelExpression(modelTerm, aliasMap);
-
-      // logger that we've resolved the operands
-      if (logger.isDebugEnabled()) {
-        logger.debug("Resolved LHS union operand " + lhs);
-        logger.debug("Resolved RHS union operand " + rhs);
-      }
-
-      // apply the union
-      modelExpression = new ModelUnion(lhs, rhs);
-    } else if (rawModelExpression instanceof ATermModelExpression) {
-
-      // logger that we've got a term model expression
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found term model expression " + rawModelExpression);
-      }
-
-      // get the model term
-      PModelTerm modelTerm = ((ATermModelExpression)rawModelExpression).getModelTerm();
-
-      // logger that we're about to resolve the term into an expression
-      if (logger.isDebugEnabled()) {
-        logger.debug("Recursing with model term " + modelTerm);
-      }
-
-      // drill down into the model term
-      modelExpression = buildModelExpression(modelTerm, aliasMap);
-    }
-
-    // end if
-    // we should not be returning null
-    if (modelExpression == null) {
-
-      throw new QueryException("Unable to parse ITQL model expression " +
-        "into a valid model expression");
-    }
-
-    // end if
-    // logger that we've created a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Created model expression " + modelExpression);
-    }
-
-    // return the built up expression
-    return modelExpression;
-  }
-
-  // buildModelExpression()
-
-  /**
-   * Recursively builds a {@link org.mulgara.query.ModelExpression} from a
-   * {@link org.mulgara.itql.node.PModelTerm}.
-   *
-   * @param rawModelTerm a raw model term from the parser
-   * @return a {@link org.mulgara.query.ModelExpression} suitable for use in
-   *      creating a {@link org.mulgara.query.Query}
-   * @throws QueryException if <code>rawModelExpression</code> does not
-   *      represent a valid query
-   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
-   *      a resource whose text violates <a
-   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
-   */
-  private static ModelExpression buildModelExpression(
-      PModelTerm rawModelTerm, Map<String,URI> aliasMap
-    ) throws QueryException, URISyntaxException {
-
-    // validate the rawModelTerm parameter
-    if (rawModelTerm == null) {
-
-      throw new IllegalArgumentException("Null \"rawModelTerm\" " +
-        "parameter");
-    }
-
-    // end if
-    // logger that we're building a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Building model expression from " + rawModelTerm);
-    }
-
-    // create a new model expression that we can return
-    ModelExpression modelExpression = null;
-
-    // drill down into the model term
-    if (rawModelTerm instanceof APartModelTerm) {
-
-      // logger that we've got a factor model term
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found factor contraint term " + rawModelTerm);
-      }
-
-      // get the model factor
-      PModelPart modelPart = ((APartModelTerm) rawModelTerm).getModelPart();
-
-      // logger that we're recursing with a model part
-      if (logger.isDebugEnabled()) {
-        logger.debug("Recursing with model part " + modelPart);
-      }
-
-      // drill down into the model part
-      modelExpression = buildModelExpression(modelPart, aliasMap);
-
-    } else if (rawModelTerm instanceof AAndModelTerm) {
-
-      // logger that we've got a AND model term
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found AND contraint term " + rawModelTerm);
-      }
-
-      // get the model term
-      PModelTerm modelTerm = ((AAndModelTerm)rawModelTerm).getModelTerm();
-
-      // get the model part
-      PModelPart modelPart = ((AAndModelTerm)rawModelTerm).getModelPart();
-
-      // logger that we've found the operands of the union
-      if (logger.isDebugEnabled()) {
-        logger.debug("Recursing with model term " + modelTerm +
-            " & model part " + modelPart);
-      }
-
-      // get the LHS and RHS operands of the intersection
-      ModelExpression lhs = buildModelExpression(modelTerm, aliasMap);
-      ModelExpression rhs = buildModelExpression(modelPart, aliasMap);
-
-      // logger that we've resolved the operands
-      if (logger.isDebugEnabled()) {
-        logger.debug("Resolved LHS intersection operand " + lhs);
-        logger.debug("Resolved RHS intersection operand " + rhs);
-      }
-
-      // apply the intersection
-      modelExpression = new ModelIntersection(lhs, rhs);
-    }
-
-    // end if
-    // we should not be returning null
-    if (modelExpression == null) {
-
-      throw new QueryException("Unable to parse ITQL model term into a valid model expression");
-    }
-
-    // end if
-    // logger that we've created a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Created model expression " + modelExpression);
-    }
-
-    // return the built up expression
-    return modelExpression;
-  }
-
-  // buildModelExpression()
-
-  /**
-   * Recursively builds a {@link org.mulgara.query.ModelExpression} from a
-   * {@link org.mulgara.itql.node.PModelPart}.
-   *
-   * @param rawModelPart a raw model part from the parser
-   * @return a {@link org.mulgara.query.ModelExpression} suitable for use in
-   *      creating a {@link org.mulgara.query.Query}
-   * @throws QueryException if <code>rawModelExpression</code> does not
-   *      represent a valid query
-   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
-   *      a resource whose text violates <a
-   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
-   */
-  private static ModelExpression buildModelExpression(
-      PModelPart rawModelPart, Map<String,URI> aliasMap
-    ) throws QueryException, URISyntaxException {
-
-    // validate the rawModelPart parameter
-    if (rawModelPart == null) {
-      throw new IllegalArgumentException("Null \"rawModelPart\" " +
-        "parameter");
-    }
-
-    // end if
-    // logger that we're building a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Building model expression from " + rawModelPart);
-    }
-
-    // create a new model expression that we can return
-    ModelExpression modelExpression = null;
-
-    // drill down into the model term
-    if (rawModelPart instanceof AFactorModelPart) {
-
-      // logger that we've got a factor model term
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found factor contraint term " + rawModelPart);
-      }
-
-      // get the model factor
-      PModelFactor modelFactor = ((AFactorModelPart)rawModelPart).getModelFactor();
-
-      // logger that we're recursing with a model factor
-      if (logger.isDebugEnabled()) {
-        logger.debug("Recursing with model factor " + modelFactor);
-      }
-
-      // drill down into the model part
-      modelExpression = buildModelExpression(modelFactor, aliasMap);
-    } else if (rawModelPart instanceof AXorModelPart) {
-
-      // logger that we've got a AND model term
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found AND contraint term " + rawModelPart);
-      }
-
-      // get the model term
-      PModelPart modelPart = ((AXorModelPart)rawModelPart).getModelPart();
-
-      // get the model factor
-      PModelFactor modelFactor = ((AXorModelPart)rawModelPart).getModelFactor();
-
-      // logger that we've found the operands of the union
-      if (logger.isDebugEnabled()) {
-        logger.debug("Recursing with model part " + modelPart + " & model factor " + modelFactor);
-      }
-
-      // get the LHS and RHS operands of the intersection
-      ModelExpression lhs = buildModelExpression(modelPart, aliasMap);
-      ModelExpression rhs = buildModelExpression(modelFactor, aliasMap);
-
-      // logger that we've resolved the operands
-      if (logger.isDebugEnabled()) {
-        logger.debug("Resolved LHS intersection operand " + lhs);
-        logger.debug("Resolved RHS intersection operand " + rhs);
-      }
-
-      // apply the intersection
-      modelExpression = new ModelPartition(lhs, rhs);
-    }
-
-    // end if
-    // we should not be returning null
-    if (modelExpression == null) {
-
-      throw new QueryException("Unable to parse ITQL model term into a valid model expression");
-    }
-
-    // end if
-    // logger that we've created a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Created model expression " + modelExpression);
-    }
-
-    // return the built up expression
-    return modelExpression;
-  }
-
-  // buildModelExpression()
-
-  /**
-   * Recursively builds a {@link org.mulgara.query.ModelExpression} from a
-   * {@link org.mulgara.itql.node.PModelFactor}.
-   *
-   * @param rawModelFactor a raw model factor from the parser
-   * @return a {@link org.mulgara.query.ModelExpression} suitable for use in
-   *      creating a {@link org.mulgara.query.Query}
-   * @throws QueryException if <code>rawModelExpression</code> does not
-   *      represent a valid query
-   * @throws URISyntaxException if the <code>rawModelExpression</code> contains
-   *      a resource whose text violates <a
-   *      href="http://www.isi.edu/in-notes/rfc2396.txt">RFC?2396</a>
-   */
-  private static ModelExpression buildModelExpression(
-        PModelFactor rawModelFactor, Map<String,URI> aliasMap
-      ) throws QueryException, URISyntaxException {
-
-    // validate the rawModelFactor parameter
-    if (rawModelFactor == null) {
-
-      throw new IllegalArgumentException("Null \"rawModelFactor\" parameter");
-    }
-
-    // end if
-    // logger that we're building a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Building model expression from " + rawModelFactor);
-    }
-
-    // create a new model expression that we can return
-    ModelExpression modelExpression = null;
-
-    // drill down into the model term
-    if (rawModelFactor instanceof AResourceModelFactor) {
-
-      // logger that we've got a model model factor
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found resource model factor " + rawModelFactor);
-      }
-
-      // get the resource
-      String resource = ((AResourceModelFactor)rawModelFactor).getResource().getText();
-
-      // logger that we've found a resource
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found resource " + resource);
-      }
-
-      // this resource is what we're looking for
-      URI modelURI = URIUtil.convertToURI(resource, aliasMap);
-      modelExpression = new ModelResource(ServerURIHandler.removePort(modelURI));
-    } else if (rawModelFactor instanceof AExpressionModelFactor) {
-
-      // logger that we've got an expression model factor
-      if (logger.isDebugEnabled()) {
-        logger.debug("Found factor expression model factor " + rawModelFactor);
-      }
-
-      // get the model expression
-      PModelExpression embeddedModelExpression = ((AExpressionModelFactor)rawModelFactor).getModelExpression();
-
-      // logger that we're recursing with a model expression
-      if (logger.isDebugEnabled()) {
-        logger.debug("Recursing with model factor " + modelExpression);
-      }
-
-      // build the model expression
-      modelExpression = buildModelExpression(embeddedModelExpression, aliasMap);
-    }
-
-    // end if
-    // we should not be returning null
-    if (modelExpression == null) {
-
-      throw new QueryException("Unable to parse ITQL model factor " +
-        "into a valid model expression");
-    }
-
-    // end if
-    // logger that we've created a model expression
-    if (logger.isDebugEnabled()) {
-      logger.debug("Created model expression " + modelExpression);
-    }
-
-    // return the built up expression
-    return modelExpression;
-  }
-
-  // buildModelExpression()
-}
-
-
-// ModelExpressionBuilder

Deleted: trunk/src/jar/querylang/java/org/mulgara/itql/ModelNameCompletor.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/ModelNameCompletor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/ModelNameCompletor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,56 +0,0 @@
-/*
- * The contents of this file are subject to the Open Software License
- * Version 3.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.opensource.org/licenses/osl-3.0.txt
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- */
-
-package org.mulgara.itql;
-
-import java.util.List;
-
-import jline.Completor;
-
-public class ModelNameCompletor implements Completor {
-	
-	private List<String> modelNames;
-	
-	public ModelNameCompletor(List<String> modelNames) {
-		this.modelNames = modelNames;
-	}
-
-	@SuppressWarnings("unchecked")
-	public int complete(String s, int idx, List completionList) {
-		int retValue = idx;
-		
-		if(s.endsWith("<")) {
-			completionList.addAll(modelNames);
-		} else {
-			int gtIdx = s.lastIndexOf("<");
-			boolean addedSomething = false;
-		
-			if(gtIdx >= 0) {
-				String partial = s.substring(gtIdx+1);
-				for(String s2 : modelNames) {
-					if(s2.startsWith(partial)) {
-						completionList.add(s2);
-						addedSomething = true;
-					}
-				}
-			}
-			
-			if(addedSomething) {
-				retValue = gtIdx + 1;
-			}
-		}
-		
-		// TODO Auto-generated method stub
-		return retValue ;
-	}
-
-}

Modified: trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/TqlInterpreter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -553,7 +553,7 @@
     // get the name of the model to create
     URI graphURI = toURI(node.getModel());
 
-    // get the type of model to create; default to mulgara:Model is unspecified
+    // get the type of model to create; default to mulgara:Graph is unspecified
     URI graphTypeURI = (node.getModelType() == null)
         ? Session.MULGARA_GRAPH_URI
         : toURI(node.getModelType());
@@ -563,7 +563,7 @@
 
     graphURI = getCanonicalUriAlias(graphURI);
 
-    if (logger.isDebugEnabled()) logger.debug("Model is alias for " + graphURI);
+    if (logger.isDebugEnabled()) logger.debug("Graph is alias for " + graphURI);
 
     lastCommand = new CreateGraph(graphURI, graphTypeURI);
   }
@@ -891,8 +891,8 @@
     PModelExpression rawModelExpression = fromClause.getModelExpression();
     if (logger.isDebugEnabled()) logger.debug("Building model expression from " + rawModelExpression);
     // parse the text into a model expression
-    ModelExpression modelExpression = ModelExpressionBuilder.build(this.getAliasMap(), rawModelExpression);
-    if (logger.isDebugEnabled()) logger.debug("Built model expression " + modelExpression);
+    GraphExpression graphExpression = GraphExpressionBuilder.build(this.getAliasMap(), rawModelExpression);
+    if (logger.isDebugEnabled()) logger.debug("Built model expression " + graphExpression);
   
     // get the constraint expression from the parser
     PConstraintExpression rawConstraintExpression = whereClause.getConstraintExpression();
@@ -920,7 +920,7 @@
     }
   
     // build a query using the information we've obtained from the parser
-    return new Query(variableList, modelExpression, constraintExpression,
+    return new Query(variableList, graphExpression, constraintExpression,
         havingExpression, orderList, limit, offset, new UnconstrainedAnswer());
   }
 

Modified: trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -391,7 +391,7 @@
 				history.setMaxSize(50);
 				reader.setBellEnabled(false);
 				reader.setDebug(new PrintWriter(new FileWriter("writer.debug", true)));
-				reader.addCompletor(new ModelNameCompletor(prefetchModels(getModelHost())));
+				reader.addCompletor(new GraphNameCompletor(prefetchModels(getModelHost())));
 
 				String line;
 				PrintWriter out = new PrintWriter(System.out);

Modified: trunk/src/jar/querylang/java/org/mulgara/sparql/SparqlInterpreter.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/sparql/SparqlInterpreter.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/sparql/SparqlInterpreter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -45,9 +45,9 @@
 import org.mulgara.query.ConstraintIs;
 import org.mulgara.query.ConstructQuery;
 import org.mulgara.query.GraphAnswer;
-import org.mulgara.query.ModelExpression;
-import org.mulgara.query.ModelResource;
-import org.mulgara.query.ModelUnion;
+import org.mulgara.query.GraphExpression;
+import org.mulgara.query.GraphResource;
+import org.mulgara.query.GraphUnion;
 import org.mulgara.query.Order;
 import org.mulgara.query.Query;
 import org.mulgara.query.SelectElement;
@@ -225,7 +225,7 @@
    */
   Query buildSelectQuery(QueryStructure queryStruct) throws MulgaraParserException {
     List<? extends SelectElement> selection = getSelection(queryStruct);
-    ModelExpression defaultGraphs = getFrom(queryStruct);
+    GraphExpression defaultGraphs = getFrom(queryStruct);
     ConstraintExpression whereClause = getWhere(queryStruct);
     if (whereClause == null) throw new MulgaraParserException("SELECT query must have a WHERE clause");
     List<Order> orderBy = getOrdering(queryStruct);
@@ -245,7 +245,7 @@
     List<Variable> selection = new ArrayList<Variable>();
     Collection<org.mulgara.sparql.parser.cst.Variable> allVars = queryStruct.getAllVariables();
     for (org.mulgara.sparql.parser.cst.Variable v: allVars) selection.add(new Variable(v.getName()));
-    ModelExpression defaultGraphs = getFrom(queryStruct);
+    GraphExpression defaultGraphs = getFrom(queryStruct);
     ConstraintExpression whereClause = getWhere(queryStruct);
     if (whereClause == null) throw new MulgaraParserException("ASK query must have a WHERE clause");
     return new AskQuery(selection, defaultGraphs, whereClause);
@@ -262,7 +262,7 @@
     if (selection.size() % 3 != 0) {
       throw new MulgaraParserException("CONSTRUCT queries require a multiple of 3 nodes in the template.");
     }
-    ModelExpression defaultGraphs = getFrom(queryStruct);
+    GraphExpression defaultGraphs = getFrom(queryStruct);
     ConstraintExpression whereClause = getWhere(queryStruct);
     if (whereClause == null) throw new MulgaraParserException("CONSTRUCT query must have a WHERE clause");
     List<Order> orderBy = getOrdering(queryStruct);
@@ -283,7 +283,7 @@
     List<? extends SelectElement> described = getSelection(queryStruct);
     ConstraintExpression whereClause = distributeIntoWhereClause(described, getWhere(queryStruct));
     whereClause = constraintToNonBlank(whereClause);
-    ModelExpression defaultGraphs = getFrom(queryStruct);
+    GraphExpression defaultGraphs = getFrom(queryStruct);
     // Ignore the order since its behavior is unspecified for DESCRIBE.
     //List<Order> orderBy = getOrdering(queryStruct);
     List<Order> orderBy = new ArrayList<Order>(0);
@@ -376,12 +376,12 @@
   }
 
   /**
-   * Gets the graph expression ({@link ModelExpression}) the represents the FROM clause, or the default
+   * Gets the graph expression ({@link GraphExpression}) the represents the FROM clause, or the default
    * graph if none was provided.
    * @param queryStruct The structure to query for the FROM clause.
-   * @return A ModelExpression containing all the required graphs as a union. TODO: this should be a merge.
+   * @return A GraphExpression containing all the required graphs as a union. TODO: this should be a merge.
    */
-  ModelExpression getFrom(QueryStructure queryStruct) {
+  GraphExpression getFrom(QueryStructure queryStruct) {
     List<IRIReference> iris = queryStruct.getDefaultFroms();
     // accumulate the graphs as a union, using the default if no graphs supplied
     return graphUnion(iris.isEmpty() ? getDefaultGraphIris() : iris);
@@ -391,17 +391,17 @@
    * Convert a list of IRIs into a model resource union of minimal depth. This recurses through construction
    * of a tree of binary unions, rather than creating a linear linked list of unions.
    * @param iris The list to convert.
-   * @return A ModelExpression which is a union of all the elements in the list,
-   *   or a {@link ModelResource} if the list contains only one element.
+   * @return A GraphExpression which is a union of all the elements in the list,
+   *   or a {@link GraphResource} if the list contains only one element.
    */
-  private ModelExpression graphUnion(List<IRIReference> iris) {
+  private GraphExpression graphUnion(List<IRIReference> iris) {
     int listSize = iris.size();
     // terminate on singleton lists
-    if (listSize == 1) return new ModelResource(iris.get(0).getUri());
+    if (listSize == 1) return new GraphResource(iris.get(0).getUri());
     // short circuit for 2 element lists - optimization
-    if (listSize == 2) return new ModelUnion(new ModelResource(iris.get(0).getUri()), new ModelResource(iris.get(1).getUri()));
+    if (listSize == 2) return new GraphUnion(new GraphResource(iris.get(0).getUri()), new GraphResource(iris.get(1).getUri()));
     // general case
-    return new ModelUnion(graphUnion(iris.subList(0, listSize / 2)), graphUnion(iris.subList(listSize / 2, listSize)));
+    return new GraphUnion(graphUnion(iris.subList(0, listSize / 2)), graphUnion(iris.subList(listSize / 2, listSize)));
   }
 
   /**

Modified: trunk/src/jar/querylang/java/org/mulgara/store/jxunit/LoadDataJX.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/store/jxunit/LoadDataJX.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/querylang/java/org/mulgara/store/jxunit/LoadDataJX.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -65,7 +65,7 @@
   /** Parameter name of the results of the load operation */
   public final static String LOAD_RESULT = "loadResult";
 
-  /** Parameter name of the "Clear Model" command */
+  /** Parameter name of the "Clear Graph" command */
   public final static String CLEAR = "clearModel";
 
   /**

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/AdvDatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/AdvDatabaseSessionUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/AdvDatabaseSessionUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -59,7 +59,7 @@
 import org.mulgara.query.ConstraintExpression;
 import org.mulgara.query.ConstraintImpl;
 import org.mulgara.query.ConstraintIs;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.query.Order;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
@@ -231,7 +231,7 @@
       Session session = database.newSession();
       try {
         session.createModel(modelURI, null);
-        session.setModel(modelURI, new ModelResource(fileURI));
+        session.setModel(modelURI, new GraphResource(fileURI));
       } finally {
         session.close();
       }
@@ -301,7 +301,7 @@
         selectList.add(subjectVariable);
         selectList.add(new Subquery(new Variable("k0"), new Query(
           Collections.singletonList(objectVariable),
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
                          predicateVariable,
                          objectVariable),
@@ -318,7 +318,7 @@
         // Evaluate the query
         Answer answer = session.query(new Query(
           selectList,                                       // SELECT
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
               new URIReferenceImpl(new URI("test:p03")),
               objectVariable),
@@ -376,7 +376,7 @@
         selectList.add(subjectVariable);
         selectList.add(new Subquery(new Variable("k0"), new Query(
           Collections.singletonList(objectVariable),
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
                          predicateVariable,
                          objectVariable),
@@ -393,7 +393,7 @@
         // Evaluate the query
         Answer answer = session.query(new Query(
           selectList,                                       // SELECT
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
               new URIReferenceImpl(new URI("test:p03")),
               objectVariable),
@@ -552,7 +552,7 @@
         try {
           session1.createModel(model3URI, null);
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new ModelResource(fileURI));
+          session1.setModel(model3URI, new GraphResource(fileURI));
 
           // Evaluate the query
           Answer answer = session2.query(createQuery(model3URI));
@@ -590,7 +590,7 @@
         try {
           session1.createModel(model3URI, null);
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new ModelResource(fileURI));
+          session1.setModel(model3URI, new GraphResource(fileURI));
 
           // Evaluate the query
           Answer answer = session2.query(createQuery(model3URI));
@@ -630,7 +630,7 @@
         try {
           session1.createModel(model3URI, null);
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new ModelResource(fileURI));
+          session1.setModel(model3URI, new GraphResource(fileURI));
 
           // Evaluate the query
           Answer answer = session2.query(createQuery(model3URI));
@@ -684,7 +684,7 @@
         Session session2 = database.newSession();
         try {
           session1.createModel(model4URI, null);
-          session1.setModel(model4URI, new ModelResource(fileURI));
+          session1.setModel(model4URI, new GraphResource(fileURI));
 
           // Check data loaded
           Answer answer = session1.query(createQuery(model4URI));
@@ -771,7 +771,7 @@
       try {
         session1.createModel(model3URI, null);
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -864,7 +864,7 @@
       try {
         session1.createModel(model3URI, null);
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         Thread t2 = new Thread("tx2Test") {
           public void run() {
@@ -984,7 +984,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");
@@ -1042,7 +1042,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");
@@ -1218,7 +1218,7 @@
       Session session = database.newSession();
       try {
         session.createModel(model5URI, null);
-        session.setModel(model5URI, new ModelResource(fileURI));
+        session.setModel(model5URI, new GraphResource(fileURI));
 
         Variable varA   = new Variable("a");
         Variable varB   = new Variable("b");
@@ -1231,7 +1231,7 @@
         // Check data loaded
         Answer answer = session.query(new Query(
           selectList,                                       // SELECT
-          new ModelResource(model5URI),                      // FROM
+          new GraphResource(model5URI),                      // FROM
           new ConstraintConjunction(Arrays.asList(
               new ConstraintExpression[] {
                   new ConstraintImpl(varB,
@@ -1327,7 +1327,7 @@
         // verify second setAutoCommit(false) is a no-op
         session.createModel(model3URI, null);
         session.setAutoCommit(false);
-        session.setModel(model3URI, new ModelResource(new File("data/xatest-model1.rdf").toURI()));
+        session.setModel(model3URI, new GraphResource(new File("data/xatest-model1.rdf").toURI()));
         session.setAutoCommit(false);
         session.commit();
 
@@ -1673,7 +1673,7 @@
 
     return new Query(
       selectList,                                       // SELECT
-      new ModelResource(model),                         // FROM
+      new GraphResource(model),                         // FROM
       new ConstraintImpl(subjectVariable,               // WHERE
                      predicateVariable,
                      objectVariable),

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -195,7 +195,7 @@
         // Evaluate the query
         Answer answer = new ArrayAnswer(session.query(new Query(
             selectList,                         // SELECT
-            new ModelResource(systemModelURI),  // FROM
+            new GraphResource(systemModelURI),  // FROM
             new ConstraintImpl(subjectVariable, // WHERE
                            predicateVariable,
                            objectVariable),
@@ -245,7 +245,7 @@
       Session session = database.newSession();
       try {
         session.createModel(modelURI, null);
-        session.setModel(modelURI, new ModelResource(fileURI));
+        session.setModel(modelURI, new GraphResource(fileURI));
         session.removeModel(modelURI);
       } finally {
         session.close();
@@ -284,8 +284,8 @@
         // Evaluate the query
         new ArrayAnswer(session.query(new Query(
           selectList,                                       // SELECT
-          new ModelUnion(new ModelResource(dcFileURI),      // FROM
-                         new ModelResource(rdfsFileURI)),
+          new GraphUnion(new GraphResource(dcFileURI),      // FROM
+                         new GraphResource(rdfsFileURI)),
           new ConstraintImpl(subjectVariable,               // WHERE
                          predicateVariable,
                          objectVariable),

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/ConstraintOperations.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ConstraintOperations.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ConstraintOperations.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -41,10 +41,10 @@
 import org.mulgara.query.*;
 import org.mulgara.resolver.spi.ConstraintBindingHandler;
 import org.mulgara.resolver.spi.ConstraintLocalization;
-import org.mulgara.resolver.spi.ConstraintModelRewrite;
+import org.mulgara.resolver.spi.ConstraintGraphRewrite;
 import org.mulgara.resolver.spi.ConstraintResolutionHandler;
 import org.mulgara.resolver.spi.ConstraintVariableRewrite;
-import org.mulgara.resolver.spi.ModelResolutionHandler;
+import org.mulgara.resolver.spi.GraphResolutionHandler;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
 import org.mulgara.store.tuples.Tuples;
 import org.mulgara.util.NVPair;
@@ -102,12 +102,12 @@
 
   static void addModelResolutionHandlers(NVPair<Class<? extends ConstraintExpression>,Object>[] resolutionHandlers) throws RuntimeException {
     addToMap(resolutionHandlers, modelResolutionHandlers,
-             ModelExpression.class, ModelResolutionHandler.class);
+             GraphExpression.class, GraphResolutionHandler.class);
   }
 
   static void addConstraintModelRewrites(NVPair<Class<? extends ConstraintExpression>,Object>[] resolutionHandlers) throws RuntimeException {
     addToMap(resolutionHandlers, constraintModelRewrites,
-             ConstraintExpression.class, ConstraintModelRewrite.class);
+             ConstraintExpression.class, ConstraintGraphRewrite.class);
   }
 
   static void addConstraintVariableRewrites(NVPair<Class<? extends ConstraintExpression>,Object>[] resolutionHandlers) throws RuntimeException {
@@ -146,21 +146,21 @@
   }
 
 
-  public static Tuples resolveModelExpression(QueryEvaluationContext context, ModelExpression modelExpr,
+  public static Tuples resolveModelExpression(QueryEvaluationContext context, GraphExpression modelExpr,
                                       Constraint constraint) throws QueryException {
     try {
       if (logger.isDebugEnabled()) {
-        logger.debug("Resolving " + constraint + " against ModelExpression[" + modelExpr.getClass() + "]");
+        logger.debug("Resolving " + constraint + " against GraphExpression[" + modelExpr.getClass() + "]");
       }
 
-      ModelResolutionHandler op = (ModelResolutionHandler)modelResolutionHandlers.get(modelExpr.getClass());
+      GraphResolutionHandler op = (GraphResolutionHandler)modelResolutionHandlers.get(modelExpr.getClass());
       if (op == null) {
-        throw new QueryException("Unknown ModelExpression type: " + modelExpr.getClass() + " known types: " + modelResolutionHandlers.keySet());
+        throw new QueryException("Unknown GraphExpression type: " + modelExpr.getClass() + " known types: " + modelResolutionHandlers.keySet());
       }
       Tuples result = op.resolve(context, modelExpr, constraint);
 
       if (logger.isDebugEnabled()) {
-        logger.debug("Resolved " + constraint + " against ModelExpression[" + modelExpr.getClass() + "] to: " + result);
+        logger.debug("Resolved " + constraint + " against GraphExpression[" + modelExpr.getClass() + "] to: " + result);
       }
 
       return result;
@@ -173,7 +173,7 @@
 
 
   public static Tuples resolveConstraintExpression(QueryEvaluationContext context,
-      ModelExpression modelExpr, ConstraintExpression constraintExpr) throws QueryException {
+      GraphExpression modelExpr, ConstraintExpression constraintExpr) throws QueryException {
     try {
       if (logger.isDebugEnabled()) {
         logger.debug("Resolving ConstraintExpression[" + constraintExpr.getClass() + "]");
@@ -251,17 +251,17 @@
       Constraint constraint) throws QueryException {
     try {
       if (logger.isDebugEnabled()) {
-        logger.debug("Rewriting Model" + newModel + " in " + constraint);
+        logger.debug("Rewriting Graph" + newModel + " in " + constraint);
       }
 
-      ConstraintModelRewrite op = (ConstraintModelRewrite)constraintModelRewrites.get(constraint.getClass());
+      ConstraintGraphRewrite op = (ConstraintGraphRewrite)constraintModelRewrites.get(constraint.getClass());
       if (op == null) {
         throw new QueryException("Unknown Constraint type: " + constraint.getClass() + " known types: " + constraintModelRewrites.keySet());
       }
       Constraint result = op.rewrite(newModel, constraint);
 
       if (logger.isDebugEnabled()) {
-        logger.debug("Rewrote Model" + newModel + " in " + constraint + " to " + result);
+        logger.debug("Rewrote Graph" + newModel + " in " + constraint + " to " + result);
       }
 
       return result;

Copied: trunk/src/jar/resolver/java/org/mulgara/resolver/CreateGraphOperation.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/CreateGraphOperation.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/CreateGraphOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,249 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver;
+
+// Java 2 standard packages
+import java.net.URI;
+import java.util.*;
+
+// Third party packages
+import org.apache.log4j.Logger;
+import org.jrdf.graph.*;
+
+// Local packages
+import org.mulgara.query.*;
+import org.mulgara.query.rdf.*;
+import org.mulgara.resolver.spi.*;
+import org.mulgara.store.nodepool.NodePool;
+
+/**
+ * An {@link Operation} that implements the {@link Session#createModel} method.
+ * TODO: Rename to CreateGraphOperation.
+ *
+ * @created 2004-11-24
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ * @version $Revision: 1.9 $
+ * @modified $Date: 2005/02/22 08:16:08 $ by $Author: newmana $
+ * @maintenanceAuthor $Author: newmana $
+ * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana  Technology, Inc</a>
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+class CreateGraphOperation implements Operation {
+  /** Logger. This is named after the class. */
+  @SuppressWarnings("unused")
+  private static final Logger logger = Logger.getLogger(CreateGraphOperation.class.getName());
+
+  /** The URI of the model to be created. */
+  private final URI graphURI;
+
+  /** The URI of the type of the model to be created. */
+  private URI graphTypeURI;
+
+
+  /**
+   * Sole constructor.
+   *
+   * @param graphURI  the {@link URI} of the graph to be created, never <code>null</code>
+   * @param graphTypeURI  thie {@link URI} of the type of graph to create, or
+   *       <code>null</code> for the same type as the system graph (<code>#</code>)
+   * @throws IllegalArgumentException if <var>graphURI</var> is <code>null</code>
+   */
+  CreateGraphOperation(URI graphURI, URI graphTypeURI) throws QueryException {
+    // Validate "graphURI" parameter
+    if (graphURI == null) throw new IllegalArgumentException("Null \"graphURI\" parameter");
+    if (!graphURI.isOpaque() && fragmentScheme(graphURI) && graphURI.getFragment() == null) {
+      throw new QueryException("Graph URI does not have a fragment (graphURI:\"" + graphURI + "\")");
+    }
+
+    // Initialize fields
+    this.graphURI     = graphURI;
+    this.graphTypeURI = graphTypeURI;
+  }
+
+  //
+  // Methods implementing Operation
+  //
+
+  public void execute(OperationContext       operationContext,
+                      SystemResolver         systemResolver,
+                      DatabaseMetadata       metadata) throws Exception {
+    // Default to the system graph type
+    if (graphTypeURI == null) graphTypeURI = metadata.getSystemModelTypeURI();
+
+    verifyGraphUri(graphURI, metadata);
+    
+    // Look up the resolver factory for the model type
+    ResolverFactory resolverFactory = operationContext.findModelTypeResolverFactory(graphTypeURI);
+    if (resolverFactory == null) {
+      throw new QueryException("Couldn't find resolver factory in internal resolver map " + graphTypeURI);
+    }
+
+    // PREVIOUSLY WITHIN TRANSACTION
+
+    // Obtain an appropriate resolver bound to this session
+    Resolver resolver = operationContext.obtainResolver(resolverFactory);
+    assert resolver != null;
+
+    // Find the local node identifying the model
+    long graph = systemResolver.localizePersistent(new URIReferenceImpl(graphURI));
+    assert graph != NodePool.NONE;
+
+    // Check model does not already exist with a different model type.
+    // TODO: there's a node leak here, if the model has already been created.
+    Resolution resolution = systemResolver.resolve(new ConstraintImpl(
+        new LocalNode(graph),
+        new LocalNode(metadata.getRdfTypeNode()),
+        new Variable("x"),
+        new LocalNode(metadata.getSystemModelNode())));
+
+    try {
+      resolution.beforeFirst();
+      if (resolution.next()) {
+        Node eNode = systemResolver.globalize(resolution.getColumnValue(0));
+        try {
+          URIReferenceImpl existing = (URIReferenceImpl)eNode;
+          if (!new URIReferenceImpl(graphTypeURI).equals(existing)) {
+            throw new QueryException(graphURI + " already exists with model type " + existing +
+                " in attempt to create it with type " + graphTypeURI);
+          }
+        } catch (ClassCastException ec) {
+          throw new QueryException("Invalid model type entry in system model: " + graphURI + " <rdf:type> " + eNode);
+        }
+      }
+    } finally {
+      resolution.close();
+    }
+
+
+    // TODO: there's a node leak here, because the model node was created
+    //       persistently, but may never end up linked into the graph if the
+    //       following security check doesn't succeed
+
+    // Make sure security adapters are satisfied
+    for (Iterator<SecurityAdapter> i = operationContext.getSecurityAdapterList().iterator(); i.hasNext();) {
+      SecurityAdapter securityAdapter = i.next();
+
+      // Tell the truth to the user
+      if (!securityAdapter.canCreateModel(graph, systemResolver) || !securityAdapter.canSeeModel(graph, systemResolver)) {
+        throw new QueryException("You aren't allowed to create " + graphURI);
+      }
+    }
+
+    // Use the session to create the model
+    resolver.createModel(graph, graphTypeURI);
+  }
+
+  /**
+   * @return <code>true</code>
+   */
+  public boolean isWriteOperation() {
+    return true;
+  }
+
+  /**
+   * Verify that the graph URI is relative to the database URI.  The graph
+   * URI can use one of the hostname aliases instead of the canonical
+   * hostname of the database URI.  No checking of the scheme specific part
+   * of the graph URI is performed if the database URI is opaque.
+   * @param graphURI
+   * @param metadata
+   * @throws QueryException
+   */
+  private void verifyGraphUri(URI graphURI, DatabaseMetadata metadata) throws QueryException {
+    // only both if this is a scheme which uses fragments - for the moment only RMI
+    if (!fragmentScheme(graphURI)) return;
+
+    boolean badModelURI = true;
+    URI databaseURI = metadata.getURI();
+    String scheme = graphURI.getScheme();
+    String fragment = graphURI.getFragment();
+
+    if (scheme != null && scheme.equals(databaseURI.getScheme()) && fragment != null) {
+      if (databaseURI.isOpaque()) {
+        // databaseURI is opaque.
+        if (graphURI.isOpaque()) {
+          // Strip out the query string.
+          String ssp = graphURI.getSchemeSpecificPart();
+          int qIndex = ssp.indexOf('?');
+          if (qIndex >= 0) ssp = ssp.substring(0, qIndex);
+
+          if (ssp.equals(databaseURI.getSchemeSpecificPart())) {
+            // graphURI is relative to databaseURI.
+            badModelURI = false;
+          }
+        }
+      } else {
+        // databaseURI is hierarchial.
+        String path;
+        String host;
+
+        if (
+            !graphURI.isOpaque() && (
+                graphURI.getSchemeSpecificPart().equals(
+                    databaseURI.getSchemeSpecificPart()
+                ) || (
+                    (host = graphURI.getHost()) != null &&
+                    graphURI.getPort() == databaseURI.getPort() &&
+                    (path = graphURI.getPath()) != null &&
+                    path.equals(databaseURI.getPath()) &&
+                    metadata.getHostnameAliases().contains(host.toLowerCase())
+                )
+            )
+        ) {
+          // graphURI is relative to databaseURI.
+          badModelURI = false;
+        }
+      }
+    } else {
+      badModelURI = !graphURI.isOpaque();
+    }
+
+    if (badModelURI) {
+      throw new QueryException(
+          "Graph URI is not relative to the database URI (graphURI:\"" +
+          graphURI + "\", databaseURI:\"" + databaseURI + "\")"
+      );
+    }
+  }
+
+  /** Schemes with fragments are handled for backward compatibility */
+  private static final Set<String> fragmentSchemes = new HashSet<String>();
+  static {
+    fragmentSchemes.add("rmi");
+    fragmentSchemes.add("beep");
+  }
+
+  /**
+   * Test if the given URI is in a scheme which differentiates graphs based on fragments.
+   * @param graphUri The URI to test for the graph.
+   * @return <code>true</code> only of the URI is in the known graph schemes.
+   */
+  private static boolean fragmentScheme(URI graphUri) {
+    return fragmentSchemes.contains(graphUri.getScheme());
+  }
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/resolver/CreateGraphOperation.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/CreateModelOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,249 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.net.URI;
-import java.util.*;
-
-// Third party packages
-import org.apache.log4j.Logger;
-import org.jrdf.graph.*;
-
-// Local packages
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.*;
-import org.mulgara.resolver.spi.*;
-import org.mulgara.store.nodepool.NodePool;
-
-/**
- * An {@link Operation} that implements the {@link Session#createModel} method.
- * TODO: Rename to CreateGraphOperation.
- *
- * @created 2004-11-24
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- * @version $Revision: 1.9 $
- * @modified $Date: 2005/02/22 08:16:08 $ by $Author: newmana $
- * @maintenanceAuthor $Author: newmana $
- * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana  Technology, Inc</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-class CreateModelOperation implements Operation {
-  /** Logger. This is named after the class. */
-  @SuppressWarnings("unused")
-  private static final Logger logger = Logger.getLogger(CreateModelOperation.class.getName());
-
-  /** The URI of the model to be created. */
-  private final URI graphURI;
-
-  /** The URI of the type of the model to be created. */
-  private URI graphTypeURI;
-
-
-  /**
-   * Sole constructor.
-   *
-   * @param graphURI  the {@link URI} of the graph to be created, never <code>null</code>
-   * @param graphTypeURI  thie {@link URI} of the type of graph to create, or
-   *       <code>null</code> for the same type as the system graph (<code>#</code>)
-   * @throws IllegalArgumentException if <var>graphURI</var> is <code>null</code>
-   */
-  CreateModelOperation(URI graphURI, URI graphTypeURI) throws QueryException {
-    // Validate "graphURI" parameter
-    if (graphURI == null) throw new IllegalArgumentException("Null \"graphURI\" parameter");
-    if (!graphURI.isOpaque() && fragmentScheme(graphURI) && graphURI.getFragment() == null) {
-      throw new QueryException("Graph URI does not have a fragment (graphURI:\"" + graphURI + "\")");
-    }
-
-    // Initialize fields
-    this.graphURI     = graphURI;
-    this.graphTypeURI = graphTypeURI;
-  }
-
-  //
-  // Methods implementing Operation
-  //
-
-  public void execute(OperationContext       operationContext,
-                      SystemResolver         systemResolver,
-                      DatabaseMetadata       metadata) throws Exception {
-    // Default to the system graph type
-    if (graphTypeURI == null) graphTypeURI = metadata.getSystemModelTypeURI();
-
-    verifyGraphUri(graphURI, metadata);
-    
-    // Look up the resolver factory for the model type
-    ResolverFactory resolverFactory = operationContext.findModelTypeResolverFactory(graphTypeURI);
-    if (resolverFactory == null) {
-      throw new QueryException("Couldn't find resolver factory in internal resolver map " + graphTypeURI);
-    }
-
-    // PREVIOUSLY WITHIN TRANSACTION
-
-    // Obtain an appropriate resolver bound to this session
-    Resolver resolver = operationContext.obtainResolver(resolverFactory);
-    assert resolver != null;
-
-    // Find the local node identifying the model
-    long graph = systemResolver.localizePersistent(new URIReferenceImpl(graphURI));
-    assert graph != NodePool.NONE;
-
-    // Check model does not already exist with a different model type.
-    // TODO: there's a node leak here, if the model has already been created.
-    Resolution resolution = systemResolver.resolve(new ConstraintImpl(
-        new LocalNode(graph),
-        new LocalNode(metadata.getRdfTypeNode()),
-        new Variable("x"),
-        new LocalNode(metadata.getSystemModelNode())));
-
-    try {
-      resolution.beforeFirst();
-      if (resolution.next()) {
-        Node eNode = systemResolver.globalize(resolution.getColumnValue(0));
-        try {
-          URIReferenceImpl existing = (URIReferenceImpl)eNode;
-          if (!new URIReferenceImpl(graphTypeURI).equals(existing)) {
-            throw new QueryException(graphURI + " already exists with model type " + existing +
-                " in attempt to create it with type " + graphTypeURI);
-          }
-        } catch (ClassCastException ec) {
-          throw new QueryException("Invalid model type entry in system model: " + graphURI + " <rdf:type> " + eNode);
-        }
-      }
-    } finally {
-      resolution.close();
-    }
-
-
-    // TODO: there's a node leak here, because the model node was created
-    //       persistently, but may never end up linked into the graph if the
-    //       following security check doesn't succeed
-
-    // Make sure security adapters are satisfied
-    for (Iterator<SecurityAdapter> i = operationContext.getSecurityAdapterList().iterator(); i.hasNext();) {
-      SecurityAdapter securityAdapter = i.next();
-
-      // Tell the truth to the user
-      if (!securityAdapter.canCreateModel(graph, systemResolver) || !securityAdapter.canSeeModel(graph, systemResolver)) {
-        throw new QueryException("You aren't allowed to create " + graphURI);
-      }
-    }
-
-    // Use the session to create the model
-    resolver.createModel(graph, graphTypeURI);
-  }
-
-  /**
-   * @return <code>true</code>
-   */
-  public boolean isWriteOperation() {
-    return true;
-  }
-
-  /**
-   * Verify that the graph URI is relative to the database URI.  The graph
-   * URI can use one of the hostname aliases instead of the canonical
-   * hostname of the database URI.  No checking of the scheme specific part
-   * of the graph URI is performed if the database URI is opaque.
-   * @param graphURI
-   * @param metadata
-   * @throws QueryException
-   */
-  private void verifyGraphUri(URI graphURI, DatabaseMetadata metadata) throws QueryException {
-    // only both if this is a scheme which uses fragments - for the moment only RMI
-    if (!fragmentScheme(graphURI)) return;
-
-    boolean badModelURI = true;
-    URI databaseURI = metadata.getURI();
-    String scheme = graphURI.getScheme();
-    String fragment = graphURI.getFragment();
-
-    if (scheme != null && scheme.equals(databaseURI.getScheme()) && fragment != null) {
-      if (databaseURI.isOpaque()) {
-        // databaseURI is opaque.
-        if (graphURI.isOpaque()) {
-          // Strip out the query string.
-          String ssp = graphURI.getSchemeSpecificPart();
-          int qIndex = ssp.indexOf('?');
-          if (qIndex >= 0) ssp = ssp.substring(0, qIndex);
-
-          if (ssp.equals(databaseURI.getSchemeSpecificPart())) {
-            // graphURI is relative to databaseURI.
-            badModelURI = false;
-          }
-        }
-      } else {
-        // databaseURI is hierarchial.
-        String path;
-        String host;
-
-        if (
-            !graphURI.isOpaque() && (
-                graphURI.getSchemeSpecificPart().equals(
-                    databaseURI.getSchemeSpecificPart()
-                ) || (
-                    (host = graphURI.getHost()) != null &&
-                    graphURI.getPort() == databaseURI.getPort() &&
-                    (path = graphURI.getPath()) != null &&
-                    path.equals(databaseURI.getPath()) &&
-                    metadata.getHostnameAliases().contains(host.toLowerCase())
-                )
-            )
-        ) {
-          // graphURI is relative to databaseURI.
-          badModelURI = false;
-        }
-      }
-    } else {
-      badModelURI = !graphURI.isOpaque();
-    }
-
-    if (badModelURI) {
-      throw new QueryException(
-          "Model URI is not relative to the database URI (graphURI:\"" +
-          graphURI + "\", databaseURI:\"" + databaseURI + "\")"
-      );
-    }
-  }
-
-  /** Schemes with fragments are handled for backward compatibility */
-  private static final Set<String> fragmentSchemes = new HashSet<String>();
-  static {
-    fragmentSchemes.add("rmi");
-    fragmentSchemes.add("beep");
-  }
-
-  /**
-   * Test if the given URI is in a scheme which differentiates graphs based on fragments.
-   * @param graphUri The URI to test for the graph.
-   * @return <code>true</code> only of the URI is in the known graph schemes.
-   */
-  private static boolean fragmentScheme(URI graphUri) {
-    return fragmentSchemes.contains(graphUri.getScheme());
-  }
-}

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/Database.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -203,7 +203,7 @@
   /**
    * The set of {@link SecurityAdapter} instances.
    *
-   * This will always contain the {@link SystemModelSecurityAdapter} which
+   * This will always contain the {@link SystemGraphSecurityAdapter} which
    * safeguards the system model (<code>#</code>).  It will additionally
    * contain any additional adapters registered via the
    * {@link #addSecurityAdapter} method.
@@ -233,7 +233,7 @@
     Collections.unmodifiableList(symbolicTransformationList);
 
   /**
-   * Model type to use to cache of external models.
+   * Graph type to use to cache of external models.
    */
   private final URI temporaryModelTypeURI;
 
@@ -811,7 +811,7 @@
 
     // Add the mandatory security adapter that protects the system model
     securityAdapterList.add(
-      new SystemModelSecurityAdapter(metadata.getSystemModelNode())
+      new SystemGraphSecurityAdapter(metadata.getSystemModelNode())
     );
 
     addSymbolicTransformation(new DuplicateVariableTransformer());
@@ -1062,7 +1062,7 @@
       // check if the other resolver factory is actually the current one
       InternalResolverFactory rf = internalResolverFactoryMap.get(modelTypeURI);
       if (!rf.resolverFactory.getClass().equals(resolverFactory.getClass())) {
-        throw new InitializerException("Model type " + modelTypeURI + " is already registered to " + rf.resolverFactory);
+        throw new InitializerException("Graph type " + modelTypeURI + " is already registered to " + rf.resolverFactory);
       } else {
         // already registered
         return;
@@ -1250,7 +1250,7 @@
           transactionManager,
           transactionManagerFactory,
           Collections.singletonList(
-            (SecurityAdapter)new SystemModelSecurityAdapter(metadata.getSystemModelNode())
+            (SecurityAdapter)new SystemGraphSecurityAdapter(metadata.getSystemModelNode())
           ),
           unmodifiableSymbolicTransformationList,
           spSessionFactory,
@@ -1281,7 +1281,7 @@
           transactionManager,
           transactionManagerFactory,
           Collections.singletonList(
-            new SystemModelSecurityAdapter(metadata.getSystemModelNode())
+            new SystemGraphSecurityAdapter(metadata.getSystemModelNode())
           ),
           unmodifiableSymbolicTransformationList,
           jrdfSessionFactory,

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -304,7 +304,7 @@
    * Used by Database *only* to bootstrap the system model on DB startup.
    */
   long bootstrapSystemModel(DatabaseMetadataImpl metadata) throws QueryException {
-    logger.debug("Bootstrapping System Model");
+    logger.debug("Bootstrapping System Graph");
     BootstrapOperation operation = new BootstrapOperation(metadata);
     execute(operation, "Failed to bootstrap system-model");
     systemResolverFactory.setDatabaseMetadata(metadata);
@@ -507,9 +507,9 @@
 
 
   public void createModel(URI modelURI, URI modelTypeURI) throws QueryException {
-    if (logger.isDebugEnabled()) logger.debug("Creating Model " + modelURI + " with type " + modelTypeURI);
+    if (logger.isDebugEnabled()) logger.debug("Creating Graph " + modelURI + " with type " + modelTypeURI);
 
-    execute(new CreateModelOperation(modelURI, modelTypeURI),
+    execute(new CreateGraphOperation(modelURI, modelTypeURI),
             "Could not commit creation of model " + modelURI + " of type " + modelTypeURI);
   }
 
@@ -527,12 +527,12 @@
     if (logger.isDebugEnabled()) logger.debug("REMOVE MODEL: " + modelURI);
     if (modelURI == null) throw new IllegalArgumentException("Null 'modelURI' parameter");
 
-    execute(new RemoveModelOperation(modelURI), "Unable to remove " + modelURI);
+    execute(new RemoveGraphOperation(modelURI), "Unable to remove " + modelURI);
   }
 
 
   public boolean modelExists(URI modelURI) throws QueryException {
-    ModelExistsOperation operation = new ModelExistsOperation(modelURI);
+    GraphExistsOperation operation = new GraphExistsOperation(modelURI);
     execute(operation, "Failed to determine model existence");
     return operation.getResult();
   }
@@ -541,12 +541,12 @@
   /**
    * Define the contents of a model.
    * @param uri the {@link URI} of the model to be redefined
-   * @param modelExpression the new content for the model
+   * @param graphExpression 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, ModelExpression modelExpression) throws QueryException {
-    return this.setModel(null, uri, modelExpression);
+  public synchronized long setModel(URI uri, GraphExpression graphExpression) throws QueryException {
+    return this.setModel(null, uri, graphExpression);
   }
 
 
@@ -554,34 +554,34 @@
    * Define the contents of a model via an inputstream
    * @param inputStream a remote inputstream
    * @param destinationModelURI the {@link URI} of the model to be redefined
-   * @param modelExpression the new content for the model
+   * @param graphExpression the new content for the model
    * @return RETURNED VALUE TO DO
    * @throws QueryException if the model can't be modified
    */
   public synchronized long setModel(InputStream inputStream,
-      URI destinationModelURI, ModelExpression modelExpression) throws QueryException {
+      URI destinationModelURI, GraphExpression graphExpression) throws QueryException {
     if (logger.isDebugEnabled()) {
-      logger.debug("SET-MODEL " + destinationModelURI + " to " + modelExpression + " from " + inputStream);
+      logger.debug("SET-MODEL " + destinationModelURI + " to " + graphExpression + " from " + inputStream);
     }
 
     // Validate parameters
     if (destinationModelURI == null) {
       throw new IllegalArgumentException("Null 'destinationModelURI' parameter");
-    } else if (modelExpression == null) {
+    } else if (graphExpression == null) {
       throw new IllegalArgumentException("Null 'modelExpression' parameter");
     }
 
     // Convert the model expression into the source model URI
-    if (!(modelExpression instanceof ModelResource)) {
-      throw new QueryException("Unsupported model expression " + modelExpression + " (" + modelExpression.getClass() + ")");
+    if (!(graphExpression instanceof GraphResource)) {
+      throw new QueryException("Unsupported model expression " + graphExpression + " (" + graphExpression.getClass() + ")");
     }
-    assert modelExpression instanceof ModelResource;
+    assert graphExpression instanceof GraphResource;
 
-    URI sourceModelURI = ((ModelResource)modelExpression).getURI();
+    URI sourceModelURI = ((GraphResource)graphExpression).getURI();
     assert sourceModelURI != null;
 
     // Perform the operation
-    SetModelOperation op = new SetModelOperation(sourceModelURI, destinationModelURI,
+    SetGraphOperation op = new SetGraphOperation(sourceModelURI, destinationModelURI,
                                   inputStream, contentHandlers, this);
     // preExcecute is a rather ugly hack, get rid of it once we support re-entrant transactions.
     if (op.preExecute()) {
@@ -725,7 +725,7 @@
     if (logger.isDebugEnabled()) logger.debug("Modifying (ins:" + insert + ") : " + modelURI);
     if (logger.isTraceEnabled()) logger.trace("Modifying statements: " + statements);
 
-    execute(new ModifyModelOperation(modelURI, statements, insert), "Could not commit modify");
+    execute(new ModifyGraphOperation(modelURI, statements, insert), "Could not commit modify");
   }
 
 
@@ -734,7 +734,7 @@
       logger.debug((insert ? "INSERT" : "DELETE") + " QUERY: " + query + " into " + modelURI);
     }
 
-    execute(new ModifyModelOperation(modelURI, query, insert, this), "Unable to modify " + modelURI);
+    execute(new ModifyGraphOperation(modelURI, query, insert, this), "Unable to modify " + modelURI);
   }
 
 

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionListQueryUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -290,7 +290,7 @@
     };
 
     //from <modelURI>
-    ModelResource model = new ModelResource(modelURI);
+    GraphResource model = new GraphResource(modelURI);
 
     //where $s $p $o
     ConstraintImpl varConstraint = new ConstraintImpl(vars[0], vars[1], vars[2]);
@@ -332,19 +332,19 @@
   }
 
   /**
-   * Creates the Model.
+   * Creates the Graph.
    *
    * @param modelURI URI
    * @param session Session
    * @throws Exception
    */
   private void createModel(URI modelURI, Session session) throws Exception {
-//    session.createModel(modelURI, new URI(Mulgara.NAMESPACE + "Model"));
+//    session.createModel(modelURI, new URI(Mulgara.NAMESPACE + "Graph"));
     session.createModel(modelURI, memoryModelURI);
   }
 
   /**
-   * Drops the Model.
+   * Drops the Graph.
    *
    * @param modelURI URI
    * @param session Session

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSessionUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -87,22 +87,22 @@
 
   private TestDef test;
 
-  protected static final ModelResource[] models;
+  protected static final GraphResource[] models;
   static {
     try {
-      models = new ModelResource[] {
-        new ModelResource(new URI("local:database#")),
-        new ModelResource(new File("data/test-model1.rdf").toURI()),
-        new ModelResource(new File("data/test-model2.rdf").toURI()),
-        new ModelResource(new File("data/test-model3.rdf").toURI()),
-        new ModelResource(new File("data/test-model4.rdf").toURI()),
-        new ModelResource(new File("data/test-model5.rdf").toURI()),
-        new ModelResource(new File("data/test-model6.rdf").toURI()),
-        new ModelResource(new File("data/test-model7.rdf").toURI()),
-        new ModelResource(new File("data/test-model8.rdf").toURI()),
-        new ModelResource(new File("data/test-model9.rdf").toURI()),
-        new ModelResource(new File("data/test-model10.rdf").toURI()),
-        new ModelResource(new File("data/test-model11.rdf").toURI()),
+      models = new GraphResource[] {
+        new GraphResource(new URI("local:database#")),
+        new GraphResource(new File("data/test-model1.rdf").toURI()),
+        new GraphResource(new File("data/test-model2.rdf").toURI()),
+        new GraphResource(new File("data/test-model3.rdf").toURI()),
+        new GraphResource(new File("data/test-model4.rdf").toURI()),
+        new GraphResource(new File("data/test-model5.rdf").toURI()),
+        new GraphResource(new File("data/test-model6.rdf").toURI()),
+        new GraphResource(new File("data/test-model7.rdf").toURI()),
+        new GraphResource(new File("data/test-model8.rdf").toURI()),
+        new GraphResource(new File("data/test-model9.rdf").toURI()),
+        new GraphResource(new File("data/test-model10.rdf").toURI()),
+        new GraphResource(new File("data/test-model11.rdf").toURI()),
       };
     } catch (URISyntaxException eu) {
       throw new IllegalArgumentException("Initialising ModelResources");

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -59,10 +59,10 @@
 import org.mulgara.query.rdf.URIReferenceImpl;
 import org.mulgara.resolver.spi.ConstraintBindingHandler;
 import org.mulgara.resolver.spi.ConstraintLocalization;
-import org.mulgara.resolver.spi.ConstraintModelRewrite;
+import org.mulgara.resolver.spi.ConstraintGraphRewrite;
 import org.mulgara.resolver.spi.ConstraintResolutionHandler;
 import org.mulgara.resolver.spi.ConstraintVariableRewrite;
-import org.mulgara.resolver.spi.ModelResolutionHandler;
+import org.mulgara.resolver.spi.GraphResolutionHandler;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
 import org.mulgara.store.tuples.Tuples;
 import org.mulgara.store.tuples.TuplesOperations;
@@ -95,13 +95,13 @@
   static void initializeModelResolutionHandlers() {
     ConstraintOperations.addModelResolutionHandlers(new NVPair[]
       {
-        new NVPair(ModelUnion.class, new ModelResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr,
+        new NVPair(GraphUnion.class, new GraphResolutionHandler() {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr,
                                 Constraint constraint) throws Exception {
             Tuples lhs = ConstraintOperations.
-                resolveModelExpression(context, ((ModelOperation)modelExpr).getLHS(), constraint);
+                resolveModelExpression(context, ((GraphOperation)modelExpr).getLHS(), constraint);
             Tuples rhs = ConstraintOperations.
-                resolveModelExpression(context, ((ModelOperation)modelExpr).getRHS(), constraint);
+                resolveModelExpression(context, ((GraphOperation)modelExpr).getRHS(), constraint);
             try {
               return TuplesOperations.append(lhs, rhs);
             } finally {
@@ -110,13 +110,13 @@
             }
           }
         }),
-        new NVPair(ModelIntersection.class, new ModelResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr,
+        new NVPair(GraphIntersection.class, new GraphResolutionHandler() {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr,
                                 Constraint constraint) throws Exception {
             Tuples lhs = ConstraintOperations.
-                resolveModelExpression(context, ((ModelOperation)modelExpr).getLHS(), constraint);
+                resolveModelExpression(context, ((GraphOperation)modelExpr).getLHS(), constraint);
             Tuples rhs = ConstraintOperations.
-                resolveModelExpression(context, ((ModelOperation)modelExpr).getRHS(), constraint);
+                resolveModelExpression(context, ((GraphOperation)modelExpr).getRHS(), constraint);
             try {
               return TuplesOperations.join(lhs, rhs);
             } finally {
@@ -125,16 +125,16 @@
             }
           }
         }),
-        new NVPair(ModelResource.class, new ModelResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr,
+        new NVPair(GraphResource.class, new GraphResolutionHandler() {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr,
                                 Constraint constraint) throws Exception {
-            return context.resolve((ModelResource)modelExpr, (Constraint)constraint);
+            return context.resolve((GraphResource)modelExpr, (Constraint)constraint);
           }
         }),
-        new NVPair(ModelVariable.class, new ModelResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr,
+        new NVPair(GraphVariable.class, new GraphResolutionHandler() {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr,
                                 Constraint constraint) throws Exception {
-            Variable modelVar = ((ModelVariable)modelExpr).getVariable();
+            Variable modelVar = ((GraphVariable)modelExpr).getVariable();
             if (constraint.getVariables().contains(modelVar)) {
               // need to change the re-write and wrap the result in a filter
               Variable newVar = new Variable("*" + modelVar.getName() + "0");
@@ -158,7 +158,7 @@
     ConstraintOperations.addConstraintResolutionHandlers(new NVPair[]
       {
         new NVPair(ConstraintConjunction.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             List l =
                 context.resolveConstraintOperation(modelExpr, (ConstraintOperation)constraintExpr);
             try {
@@ -172,7 +172,7 @@
           }
         }),
         new NVPair(ConstraintDisjunction.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             List l =
                 context.resolveConstraintOperation(modelExpr, (ConstraintOperation)constraintExpr);
             try {
@@ -186,7 +186,7 @@
           }
         }),
         new NVPair(ConstraintDifference.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             List args = context.resolveConstraintOperation(modelExpr, (ConstraintOperation)constraintExpr);
             assert args.size() == 2;
             try {
@@ -198,7 +198,7 @@
           }
         }),
         new NVPair(ConstraintOptionalJoin.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             List<Tuples> args = context.resolveConstraintOperation(modelExpr, (ConstraintOperation)constraintExpr);
             assert args.size() == 2;
             try {
@@ -210,27 +210,27 @@
           }
         }),
         new NVPair(ConstraintIs.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             ConstraintIs constraint = (ConstraintIs)constraintExpr;
             return TuplesOperations.assign((Variable)context.localize(constraint.getVariable()),
                                            ((LocalNode)context.localize(constraint.getValueNode())).getValue());
           }
         }),
         new NVPair(ConstraintImpl.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             ConstraintImpl constraint = (ConstraintImpl)constraintExpr;
             ConstraintElement constraintElem = constraint.getModel();
             assert constraintElem != null;
             if (constraintElem.equals(Variable.FROM)) {
               return ConstraintOperations.resolveModelExpression(context, modelExpr, constraint);
             } else if (constraintElem instanceof URIReference) {
-              return ConstraintOperations.resolveModelExpression(context, new ModelResource(((URIReference)constraintElem).getURI()), constraint);
+              return ConstraintOperations.resolveModelExpression(context, new GraphResource(((URIReference)constraintElem).getURI()), constraint);
             } else if (constraintElem instanceof LocalNode) {
               return context.resolve(null, constraint);
             } else if (constraintElem instanceof Variable) {
               for (int i = 0; i < 3; i++) {
                 if (constraintElem.equals(constraint.getElement(i))) {
-                  ModelVariable modelVar = new ModelVariable((Variable)constraintElem);
+                  GraphVariable modelVar = new GraphVariable((Variable)constraintElem);
                   return ConstraintOperations.resolveModelExpression(context, modelVar, constraint);
                 }
               }
@@ -242,12 +242,12 @@
           }
         }),
         new NVPair(WalkConstraint.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             return WalkFunction.walk(context, (WalkConstraint)constraintExpr, modelExpr, context.getResolverSession());
           }
         }),
         new NVPair(SingleTransitiveConstraint.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             SingleTransitiveConstraint constraint = (SingleTransitiveConstraint)constraintExpr;
             if (constraint.isAnchored()) {
               return DirectTransitiveFunction.infer(context, constraint, modelExpr, context.getResolverSession());
@@ -257,12 +257,12 @@
           }
         }),
         new NVPair(TransitiveConstraint.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             return ExhaustiveTransitiveFunction.infer(context, (TransitiveConstraint)constraintExpr, modelExpr, context.getResolverSession());
           }
         }),
         new NVPair(ConstraintFilter.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             Tuples unfiltered = ConstraintOperations.resolveConstraintExpression(context, modelExpr, ((ConstraintFilter)constraintExpr).getUnfilteredConstraint());
             try {
               return TuplesOperations.filter(unfiltered, ((ConstraintFilter)constraintExpr).getFilter(), context);
@@ -272,14 +272,14 @@
           }
         }),
         new NVPair(ConstraintIn.class, new ConstraintResolutionHandler() {
-          public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+          public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
             ConstraintIn constraint = (ConstraintIn)constraintExpr;
-            ModelExpression graph;
+            GraphExpression graph;
             if (constraint.getGraph() instanceof URIReferenceImpl) {
-              graph = new ModelResource(((URIReferenceImpl)constraint.getGraph()).getURI());
+              graph = new GraphResource(((URIReferenceImpl)constraint.getGraph()).getURI());
             } else {
               assert constraint.getGraph() instanceof Variable;
-              graph = new ModelVariable((Variable)constraint.getGraph());
+              graph = new GraphVariable((Variable)constraint.getGraph());
             }
             return ConstraintOperations.resolveConstraintExpression(context, graph, constraint.getConstraintParam());
           }
@@ -358,7 +358,7 @@
   static void initializeConstraintModelRewrites() {
     ConstraintOperations.addConstraintModelRewrites(new NVPair[]
       {
-        new NVPair(ConstraintImpl.class, new ConstraintModelRewrite() {
+        new NVPair(ConstraintImpl.class, new ConstraintGraphRewrite() {
           public Constraint rewrite(ConstraintElement newModel, Constraint constraint) throws Exception {
             return new ConstraintImpl(constraint.getElement(0), constraint.getElement(1), constraint.getElement(2), newModel);
           }

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -92,7 +92,7 @@
    * @param constraint a constraint describing a transitive predicate with a
    *      supported model type fourth element of the constraint is not a Variable
    *      or is a Variable with the name _from.
-   * @param modelExpression the ModelExpression to resolve the constraint against.
+   * @param graphExpression the GraphExpression to resolve the constraint against.
    * @param session the resolverSession against which to localize nodes.
    * @return the answer satisfying the <var>constraint</var>
    * @throws QueryException if the <var>constraint</var> has a model of an
@@ -101,7 +101,7 @@
    *      from various query resolutions.
    */
   public static Tuples infer(QueryEvaluationContext query, SingleTransitiveConstraint constraint,
-                             ModelExpression modelExpression, ResolverSession session)
+                             GraphExpression graphExpression, ResolverSession session)
       throws QueryException, TuplesException {
     if (logger.isDebugEnabled()) {
       logger.debug("Transitive Constraint is anchored");
@@ -129,7 +129,7 @@
     Constraint predConstraint = constraint.getTransConstraint();
 
     // ask for all statements for this predicate
-    Tuples initialTuples = query.resolve(modelExpression, predConstraint);
+    Tuples initialTuples = query.resolve(graphExpression, predConstraint);
 
     // prepare to iterate through anchor
     initialTuples.beforeFirst();
@@ -188,7 +188,7 @@
     }
 
     // find *all* statements with the given predicate
-    Tuples predTuples = query.resolve(modelExpression, openConstraint);
+    Tuples predTuples = query.resolve(graphExpression, openConstraint);
 
     // set up the final result [$x] built from [$x predicate anchor] or [anchor predicate $x]
     LiteralTuples inferredResult = new LiteralTuples(new Variable[] {variable});

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/ExhaustiveTransitiveFunction.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ExhaustiveTransitiveFunction.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ExhaustiveTransitiveFunction.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -100,7 +100,7 @@
    *      from various query resolutions.
    */
   public static Tuples infer(QueryEvaluationContext query, SingleTransitiveConstraint constraint,
-      ModelExpression modelExpression, ResolverSession session)
+      GraphExpression graphExpression, ResolverSession session)
       throws QueryException, TuplesException {
 
     if (logger.isDebugEnabled()) {
@@ -130,7 +130,7 @@
       Constraint predConstraint = constraint.getTransConstraint();
 
       // ask for all statements for this predicate
-      initialTuples = query.resolve(modelExpression, predConstraint);
+      initialTuples = query.resolve(graphExpression, predConstraint);
 
       // prepare to iterate through anchor, or set of all predicate statements
       initialTuples.beforeFirst();
@@ -248,7 +248,7 @@
    *      from various query resolutions.
    */
   public static Tuples infer(QueryEvaluationContext query, TransitiveConstraint constraint,
-      ModelExpression modelExpression, ResolverSession session)
+      GraphExpression graphExpression, ResolverSession session)
       throws QueryException, TuplesException {
 
     if (logger.isDebugEnabled()) {
@@ -304,7 +304,7 @@
 
       // Walk down the graph getting all the statements for the given predicate
       initialTuples = WalkFunction.walk(query, walkConstraint,
-          modelExpression, session);
+          graphExpression, session);
 
       // prepare to iterate through anchor, or set of all predicate statements
       initialTuples.beforeFirst();

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ExternalTransactionUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -276,7 +276,7 @@
       Xid xid = new TestXid(1);
       resource.start(xid, XAResource.TMNOFLAGS);
       try {
-        session.setModel(modelURI, new ModelResource(fileURI));
+        session.setModel(modelURI, new GraphResource(fileURI));
         resource.end(xid, XAResource.TMSUCCESS);
         resource.prepare(xid);
         resource.commit(xid, false);
@@ -600,7 +600,7 @@
         selectList.add(subjectVariable);
         selectList.add(new Subquery(new Variable("k0"), new Query(
           Collections.singletonList(objectVariable),
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
                          predicateVariable,
                          objectVariable),
@@ -617,7 +617,7 @@
         // Evaluate the query
         Answer answer = session.query(new Query(
           selectList,                                       // SELECT
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
               new URIReferenceImpl(new URI("test:p03")),
               objectVariable),
@@ -681,7 +681,7 @@
         selectList.add(subjectVariable);
         selectList.add(new Subquery(new Variable("k0"), new Query(
           Collections.singletonList(objectVariable),
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
                          predicateVariable,
                          objectVariable),
@@ -698,7 +698,7 @@
         // Evaluate the query
         Answer answer = session.query(new Query(
           selectList,                                       // SELECT
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
               new URIReferenceImpl(new URI("test:p03")),
               objectVariable),
@@ -782,7 +782,7 @@
 
         // Perform update
         rwResource.start(xid3, XAResource.TMNOFLAGS);
-        session.setModel(model3URI, new ModelResource(fileURI));
+        session.setModel(model3URI, new GraphResource(fileURI));
         rwResource.end(xid3, XAResource.TMSUSPEND);
 
         // Check uncommitted change not visible
@@ -887,7 +887,7 @@
 
           // Perform update
           rwResource.start(xid2, XAResource.TMNOFLAGS);
-          session1.setModel(model3URI, new ModelResource(fileURI));
+          session1.setModel(model3URI, new GraphResource(fileURI));
           rwResource.end(xid2, XAResource.TMSUSPEND);
 
           // Check uncommitted change not visible
@@ -946,7 +946,7 @@
 
           // Perform update with autocommit off
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new ModelResource(fileURI));
+          session1.setModel(model3URI, new GraphResource(fileURI));
 
           // Check uncommitted change not visible
           roResource.start(xid2, XAResource.TMNOFLAGS);
@@ -1034,7 +1034,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1134,7 +1134,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1229,7 +1229,7 @@
         session1.createModel(model3URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1339,7 +1339,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1435,7 +1435,7 @@
         session1.createModel(model3URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1544,7 +1544,7 @@
         rwResource.commit(new TestXid(1), true);
 
         rwResource.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session.setModel(model3URI, new ModelResource(fileURI));
+        session.setModel(model3URI, new GraphResource(fileURI));
         rwResource.end(new TestXid(2), XAResource.TMSUSPEND);
 
         roResource.start(new TestXid(3), XAResource.TMNOFLAGS);
@@ -1596,7 +1596,7 @@
         session1.createModel(model4URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model4URI, new ModelResource(fileURI));
+        session1.setModel(model4URI, new GraphResource(fileURI));
 
         session1.commit();
         session1.close();
@@ -1665,7 +1665,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");
@@ -1732,7 +1732,7 @@
         };
         t2.start();
 
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
         logger.debug("Sleeping for 1sec");
         Thread.sleep(1000);
         logger.debug("Slept for 1sec");
@@ -2576,7 +2576,7 @@
 
     return new Query(
       selectList,                                       // SELECT
-      new ModelResource(model),                         // FROM
+      new GraphResource(model),                         // FROM
       new ConstraintImpl(subjectVariable,               // WHERE
                      predicateVariable,
                      objectVariable),

Copied: trunk/src/jar/resolver/java/org/mulgara/resolver/GraphExistsOperation.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/resolver/ModelExistsOperation.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/GraphExistsOperation.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/GraphExistsOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,83 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): This file, excluding the two lines of the execute method 
+ *   is an original work developed by Netymon Pty Ltd.  Excluding these to
+ *   lines this file is:
+ *   Copyright (c) 2006 Netymon Pty Ltd.
+ *   All Rights Reserved.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver;
+
+// Java 2 standard packages
+import java.net.URI;
+
+// Third party packages
+import org.apache.log4j.Logger;
+
+// Local packages
+import org.mulgara.query.*;
+import org.mulgara.query.rdf.URIReferenceImpl;
+import org.mulgara.resolver.spi.*;
+
+class GraphExistsOperation implements Operation
+{
+  /** Logger.  */
+  private static final Logger logger = Logger.getLogger(GraphExistsOperation.class.getName());
+
+  private URI modelURI = null;
+
+  private boolean result;
+
+
+  GraphExistsOperation(URI modelURI) {
+    this.modelURI = modelURI;
+  }
+
+  //
+  // Methods implementing Operation
+  //
+
+  public void execute(OperationContext       operationContext,
+                      SystemResolver         systemResolver,
+                      DatabaseMetadata       metadata) throws Exception
+  {
+    try {
+      long model = systemResolver.lookupPersistent(new URIReferenceImpl(modelURI));
+      result = systemResolver.modelExists(model);
+    } catch (LocalizeException le) {
+      result = false;
+    }
+  }
+
+  public boolean isWriteOperation() {
+    return false;
+  }
+
+  
+  boolean getResult() {
+    return result;
+  }
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/resolver/GraphExistsOperation.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/InternalResolver.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/InternalResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/InternalResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -234,7 +234,7 @@
         if (resolution.next()) {
           long modelType = resolution.getColumnValue(
                              resolution.getColumnIndex(modelTypeVariable));
-          if (resolution.next()) {           throw new ResolverException("Model " + model + " has more than one type!");
+          if (resolution.next()) {           throw new ResolverException("Graph " + model + " has more than one type!");
           }
 
           return modelType;

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/JotmTransactionStandaloneTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -194,7 +194,7 @@
 
       try {
         try {
-          session.setModel(modelURI, new ModelResource(fileURI));
+          session.setModel(modelURI, new GraphResource(fileURI));
         } finally {
           session.close();
         }
@@ -224,7 +224,7 @@
       txManager.getTransaction().enlistResource(session.getXAResource());
 
       try {
-        session.setModel(modelURI, new ModelResource(fileURI));
+        session.setModel(modelURI, new GraphResource(fileURI));
         txManager.commit();
       } finally {
         session.close();
@@ -500,7 +500,7 @@
         selectList.add(subjectVariable);
         selectList.add(new Subquery(new Variable("k0"), new Query(
           Collections.singletonList(objectVariable),
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
                          predicateVariable,
                          objectVariable),
@@ -517,7 +517,7 @@
         // Evaluate the query
         Answer answer = session.query(new Query(
           selectList,                                       // SELECT
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
               new URIReferenceImpl(new URI("test:p03")),
               objectVariable),
@@ -583,7 +583,7 @@
         selectList.add(subjectVariable);
         selectList.add(new Subquery(new Variable("k0"), new Query(
           Collections.singletonList(objectVariable),
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
                          predicateVariable,
                          objectVariable),
@@ -600,7 +600,7 @@
         // Evaluate the query
         Answer answer = session.query(new Query(
           selectList,                                       // SELECT
-          new ModelResource(modelURI),                      // FROM
+          new GraphResource(modelURI),                      // FROM
           new ConstraintImpl(subjectVariable,               // WHERE
               new URIReferenceImpl(new URI("test:p03")),
               objectVariable),
@@ -684,7 +684,7 @@
 
         // Perform update
         rwResource.start(xid3, XAResource.TMNOFLAGS);
-        session.setModel(model3URI, new ModelResource(fileURI));
+        session.setModel(model3URI, new GraphResource(fileURI));
         rwResource.end(xid3, XAResource.TMSUSPEND);
 
         // Check uncommitted change not visible
@@ -789,7 +789,7 @@
 
           // Perform update
           rwResource.start(xid2, XAResource.TMNOFLAGS);
-          session1.setModel(model3URI, new ModelResource(fileURI));
+          session1.setModel(model3URI, new GraphResource(fileURI));
           rwResource.end(xid2, XAResource.TMSUSPEND);
 
           // Check uncommitted change not visible
@@ -848,7 +848,7 @@
 
           // Perform update with autocommit off
           session1.setAutoCommit(false);
-          session1.setModel(model3URI, new ModelResource(fileURI));
+          session1.setModel(model3URI, new GraphResource(fileURI));
 
           // Check uncommitted change not visible
           roResource.start(xid2, XAResource.TMNOFLAGS);
@@ -936,7 +936,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1036,7 +1036,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1131,7 +1131,7 @@
         session1.createModel(model3URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1241,7 +1241,7 @@
         resource1.commit(new TestXid(1), true);
 
         resource1.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1337,7 +1337,7 @@
         session1.createModel(model3URI, null);
 
         session1.setAutoCommit(false);
-        session1.setModel(model3URI, new ModelResource(fileURI));
+        session1.setModel(model3URI, new GraphResource(fileURI));
 
         final boolean[] tx2Started = new boolean[] { false };
 
@@ -1446,7 +1446,7 @@
         rwResource.commit(new TestXid(1), true);
 
         rwResource.start(new TestXid(2), XAResource.TMNOFLAGS);
-        session.setModel(model3URI, new ModelResource(fileURI));
+        session.setModel(model3URI, new GraphResource(fileURI));
         rwResource.end(new TestXid(2), XAResource.TMSUSPEND);
 
         roResource.start(new TestXid(3), XAResource.TMNOFLAGS);
@@ -1518,7 +1518,7 @@
 
     return new Query(
       selectList,                                       // SELECT
-      new ModelResource(model),                         // FROM
+      new GraphResource(model),                         // FROM
       new ConstraintImpl(subjectVariable,               // WHERE
                      predicateVariable,
                      objectVariable),

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/LocalJRDFDatabaseSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -145,7 +145,7 @@
     }
     catch (TuplesException tuplesException) {
 
-      throw new GraphException("Failed to determine if Model contains Triple.",
+      throw new GraphException("Failed to determine if Graph contains Triple.",
           tuplesException);
     }
     finally {
@@ -186,7 +186,7 @@
 
       Query query = new Query(
           Arrays.asList(vars),             // variable list
-          new ModelResource(modelURI),     // model expression
+          new GraphResource(modelURI),     // model expression
           constraint,                      // constraint expr
           null,                            // no having
           (List<Order>)Collections.EMPTY_LIST,          // no ordering

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -103,7 +103,7 @@
     this.resolverSession = resolverSession;
   }
 
-  public List<Tuples> resolveConstraintOperation(ModelExpression modelExpr,
+  public List<Tuples> resolveConstraintOperation(GraphExpression modelExpr,
                                          ConstraintOperation constraintOper)
       throws QueryException {
 
@@ -162,16 +162,16 @@
    * Localize and resolve the leaf node of the <code>FROM</code> and
    * <code>WHERE</code> clause product.
    *
-   * @param modelResource  the <code>FROM<code> clause to resolve, never
+   * @param graphResource  the <code>FROM<code> clause to resolve, never
    *   <code>null</codE>
    * @param constraint  the <code>WHERE</code> clause to resolve, which must
    *   have {@link Variable#FROM} as its fourth element, and never be
    *   <code>null</code>
    * @throws QueryException if resolution can't be obtained
    */
-  public Tuples resolve(ModelResource modelResource, Constraint constraint) throws QueryException
+  public Tuples resolve(GraphResource graphResource, Constraint constraint) throws QueryException
   {
-    assert modelResource != null || !constraint.getModel().equals(Variable.FROM);
+    assert graphResource != null || !constraint.getModel().equals(Variable.FROM);
     assert constraint != null;
 
     // Delegate constraint resolution back to the database session
@@ -181,25 +181,25 @@
       if (localized.getModel().equals(Variable.FROM)) {
         // create the URIReferenceImpl without checking if it is absolute
         localized = ConstraintOperations.rewriteConstraintModel(
-            localize(new URIReferenceImpl(modelResource.getURI(), false)), localized);
+            localize(new URIReferenceImpl(graphResource.getURI(), false)), localized);
       }
 
       Tuples result = operationContext.resolve(localized);
 
       return result;
     } catch (LocalizeException e) {
-      throw new QueryException("Unable to resolve FROM " + modelResource +
+      throw new QueryException("Unable to resolve FROM " + graphResource +
                                " WHERE " + constraint, e);
     } catch (QueryException eq) {
-      throw new QueryException("Error resolving " + constraint + " from " + modelResource, eq);
+      throw new QueryException("Error resolving " + constraint + " from " + graphResource, eq);
     } catch (Exception e) {
-      throw new QueryException("Unexpected error resolving " + constraint + " from " + modelResource, e);
+      throw new QueryException("Unexpected error resolving " + constraint + " from " + graphResource, e);
     }
   }
 
 
-  public Tuples resolve(ModelExpression modelExpression, ConstraintExpression constraintExpression) throws QueryException {
-    return ConstraintOperations.resolveConstraintExpression(this, modelExpression, constraintExpression);
+  public Tuples resolve(GraphExpression graphExpression, ConstraintExpression constraintExpression) throws QueryException {
+    return ConstraintOperations.resolveConstraintExpression(this, graphExpression, constraintExpression);
   }
 
 

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/ModelExistsOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ModelExistsOperation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ModelExistsOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,83 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): This file, excluding the two lines of the execute method 
- *   is an original work developed by Netymon Pty Ltd.  Excluding these to
- *   lines this file is:
- *   Copyright (c) 2006 Netymon Pty Ltd.
- *   All Rights Reserved.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.net.URI;
-
-// Third party packages
-import org.apache.log4j.Logger;
-
-// Local packages
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.URIReferenceImpl;
-import org.mulgara.resolver.spi.*;
-
-class ModelExistsOperation implements Operation
-{
-  /** Logger.  */
-  private static final Logger logger = Logger.getLogger(ModelExistsOperation.class.getName());
-
-  private URI modelURI = null;
-
-  private boolean result;
-
-
-  ModelExistsOperation(URI modelURI) {
-    this.modelURI = modelURI;
-  }
-
-  //
-  // Methods implementing Operation
-  //
-
-  public void execute(OperationContext       operationContext,
-                      SystemResolver         systemResolver,
-                      DatabaseMetadata       metadata) throws Exception
-  {
-    try {
-      long model = systemResolver.lookupPersistent(new URIReferenceImpl(modelURI));
-      result = systemResolver.modelExists(model);
-    } catch (LocalizeException le) {
-      result = false;
-    }
-  }
-
-  public boolean isWriteOperation() {
-    return false;
-  }
-
-  
-  boolean getResult() {
-    return result;
-  }
-}

Copied: trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyGraphOperation.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyModelOperation.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyGraphOperation.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyGraphOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,261 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver;
+
+// Java 2 standard packages
+import java.net.URI;
+import java.util.*;
+
+// Third party packages
+import org.apache.log4j.Logger;
+import org.jrdf.graph.Triple;
+
+// Local packages
+import org.mulgara.query.*;
+import org.mulgara.query.rdf.URIReferenceImpl;
+import org.mulgara.resolver.spi.*;
+
+/**
+ * An {@link Operation} that implements the {@link Session#insert} and
+ * {@link Session#delete} methods.
+ *
+ * The operation is really two closely-related operations combined into one
+ * class: modification by a specified set of {@link Triple}s, and modification
+ * by the result of a specified {@link Query}.
+ *
+ * @created 2004-11-24
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:24 $ by $Author: newmana $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana
+ *   Technology, Inc</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+class ModifyGraphOperation implements Operation
+{
+  /**
+   * Logger.
+   *
+   * This is named after the class.
+   */
+  private static final Logger logger =
+    Logger.getLogger(ModifyGraphOperation.class.getName());
+
+  /**
+   * The URI of the model to be removed.
+   */
+  private final URI modelURI;
+
+  /**
+   * The statements whose occurence is to be modified.
+   *
+   * If this field is not <code>null</code>, {@link #query} will be
+   * <code>null</code>
+   */
+  private final Set<? extends Triple> tripleSet;
+
+  /**
+   * The query generating the statements whose occurence is to be modified.
+   */
+  private final Query query;
+
+  /**
+   * Whether to insert or delete statements from the model.
+   */
+  private final boolean insert;
+
+  //
+  // Constructor
+  //
+
+  /**
+   * Construct a modification of a literal set of statements.
+   *
+   * @param modelURI  the {@link URI} of the model to be removed, never
+   *   <code>null</code>
+   * @param tripleSet  the statements to be modified, never <code>null</code>
+   * @param insert  whether to insert or delete the <var>tripleSet</var> from
+   *   the model
+   * @throws IllegalArgumentException if <var>modelURI</var> or
+   *   <var>tripleSet</var> are <code>null</code>
+   */
+  ModifyGraphOperation(URI modelURI, Set<? extends Triple> tripleSet, boolean insert)
+  {
+    // Validate "modelURI" parameter
+    if (modelURI == null) {
+      throw new IllegalArgumentException("Null \"modelURI\" parameter");
+    }
+
+    // Validate "statements" parameter
+    if (tripleSet == null) {
+      throw new IllegalArgumentException("Null \"tripleSet\" parameter");
+    }
+
+    // Initialize fields
+    this.modelURI  = modelURI;
+    this.tripleSet = tripleSet;
+    this.query     = null;
+    this.insert    = insert;
+  }
+
+  /**
+   * Construct a modification of a query-generated set of statements.
+   *
+   * @param modelURI  the {@link URI} of the model to be removed, never
+   *   <code>null</code>
+   * @param query  the query used to generate the statements to be modified,
+   *   never <code>null</code>
+   * @param insert  whether to insert or delete statements from the model
+   * @throws IllegalArgumentException if <var>modelURI</var> or
+   *   <var>query</var> are <code>null</code>
+   * @throws QueryException if <var>query</var> doesn't have exactly three
+   *   variables in its <code>SELECT</code> clause
+   */
+  ModifyGraphOperation(URI modelURI, Query query, boolean insert,
+                       DatabaseSession databaseSession)
+    throws QueryException
+  {
+    // Validate "modelURI" parameter
+    if (modelURI == null) {
+      throw new IllegalArgumentException("Null \"modelURI\" parameter");
+    }
+
+    // Validate "query" parameter
+    if (query == null) {
+      throw new IllegalArgumentException("Null \"query\" parameter");
+    }
+    if (query.getVariableList().size() != 3) {
+      throw new QueryException(
+          "Invalid select clause in insert/select.  Exactly 3 terms required");
+    }
+
+    // Validate "databaseSession" parameter
+    if (databaseSession == null) {
+      throw new IllegalArgumentException("Null \"databaseSession\" parameter");
+    }
+
+    // Initialize fields
+    this.modelURI  = modelURI;
+    this.tripleSet = null;
+    this.query     = query;
+    this.insert    = insert;
+  }
+
+  //
+  // Methods implementing Operation
+  //
+
+  public void execute(OperationContext       operationContext,
+                      SystemResolver         systemResolver,
+                      DatabaseMetadata       metadata) throws Exception
+  {
+    Statements statements;
+    if (tripleSet != null) {
+      assert query == null;
+
+      statements = new TripleSetWrapperStatements(
+        tripleSet, systemResolver, TripleSetWrapperStatements.PERSIST
+      );
+    } else {
+      assert query != null;
+
+      Answer answer = operationContext.doQuery(query);
+      try {
+        Variable[] vars = answer.getVariables();
+        assert vars.length == 3;
+        statements = new TuplesWrapperStatements(
+            new LocalizedTuples(systemResolver, answer, insert),
+            vars[0], vars[1], vars[2]);
+      } finally {
+        answer.close();
+      }
+    }
+    assert statements != null;
+
+    try {
+      doModify(operationContext, systemResolver, modelURI, statements, insert);
+    } finally {
+      statements.close();
+    }
+  }
+
+
+  protected void doModify(OperationContext operationContext,
+                          SystemResolver   systemResolver,
+                          URI              modelURI,
+                          Statements       statements,
+                          boolean          insert) throws Exception
+  {
+    long model = systemResolver.localize(new URIReferenceImpl(modelURI));
+    model = operationContext.getCanonicalModel(model);
+
+    // Make sure security adapters are satisfied
+    for (SecurityAdapter securityAdapter: (List<SecurityAdapter>)operationContext.getSecurityAdapterList()) {
+
+      // Lie to the user
+      if (!securityAdapter.canSeeModel(model, systemResolver)) {
+        throw new QueryException("No such model " + modelURI);
+      }
+
+      // Tell the truth to the user
+      if (!securityAdapter.canModifyModel(model, systemResolver)) {
+        throw new QueryException("You aren't allowed to modify " + modelURI);
+      }
+    }
+
+    // Obtain a resolver for the destination model type
+    Resolver resolver = operationContext.obtainResolver(
+                          operationContext.findModelResolverFactory(model));
+    assert resolver != null;
+
+    if (logger.isDebugEnabled()) {
+      logger.debug("Modifying " + modelURI + " using " + resolver);
+    }
+
+    resolver.modifyModel(model, statements, insert);
+
+    if (logger.isDebugEnabled()) {
+      logger.debug("Modified " + modelURI);
+    }
+  }
+
+  /**
+   * @return <code>true</code>
+   */
+  public boolean isWriteOperation()
+  {
+    return true;
+  }
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyGraphOperation.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyModelOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyModelOperation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ModifyModelOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,261 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.net.URI;
-import java.util.*;
-
-// Third party packages
-import org.apache.log4j.Logger;
-import org.jrdf.graph.Triple;
-
-// Local packages
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.URIReferenceImpl;
-import org.mulgara.resolver.spi.*;
-
-/**
- * An {@link Operation} that implements the {@link Session#insert} and
- * {@link Session#delete} methods.
- *
- * The operation is really two closely-related operations combined into one
- * class: modification by a specified set of {@link Triple}s, and modification
- * by the result of a specified {@link Query}.
- *
- * @created 2004-11-24
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:24 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana
- *   Technology, Inc</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-class ModifyModelOperation implements Operation
-{
-  /**
-   * Logger.
-   *
-   * This is named after the class.
-   */
-  private static final Logger logger =
-    Logger.getLogger(ModifyModelOperation.class.getName());
-
-  /**
-   * The URI of the model to be removed.
-   */
-  private final URI modelURI;
-
-  /**
-   * The statements whose occurence is to be modified.
-   *
-   * If this field is not <code>null</code>, {@link #query} will be
-   * <code>null</code>
-   */
-  private final Set<? extends Triple> tripleSet;
-
-  /**
-   * The query generating the statements whose occurence is to be modified.
-   */
-  private final Query query;
-
-  /**
-   * Whether to insert or delete statements from the model.
-   */
-  private final boolean insert;
-
-  //
-  // Constructor
-  //
-
-  /**
-   * Construct a modification of a literal set of statements.
-   *
-   * @param modelURI  the {@link URI} of the model to be removed, never
-   *   <code>null</code>
-   * @param tripleSet  the statements to be modified, never <code>null</code>
-   * @param insert  whether to insert or delete the <var>tripleSet</var> from
-   *   the model
-   * @throws IllegalArgumentException if <var>modelURI</var> or
-   *   <var>tripleSet</var> are <code>null</code>
-   */
-  ModifyModelOperation(URI modelURI, Set<? extends Triple> tripleSet, boolean insert)
-  {
-    // Validate "modelURI" parameter
-    if (modelURI == null) {
-      throw new IllegalArgumentException("Null \"modelURI\" parameter");
-    }
-
-    // Validate "statements" parameter
-    if (tripleSet == null) {
-      throw new IllegalArgumentException("Null \"tripleSet\" parameter");
-    }
-
-    // Initialize fields
-    this.modelURI  = modelURI;
-    this.tripleSet = tripleSet;
-    this.query     = null;
-    this.insert    = insert;
-  }
-
-  /**
-   * Construct a modification of a query-generated set of statements.
-   *
-   * @param modelURI  the {@link URI} of the model to be removed, never
-   *   <code>null</code>
-   * @param query  the query used to generate the statements to be modified,
-   *   never <code>null</code>
-   * @param insert  whether to insert or delete statements from the model
-   * @throws IllegalArgumentException if <var>modelURI</var> or
-   *   <var>query</var> are <code>null</code>
-   * @throws QueryException if <var>query</var> doesn't have exactly three
-   *   variables in its <code>SELECT</code> clause
-   */
-  ModifyModelOperation(URI modelURI, Query query, boolean insert,
-                       DatabaseSession databaseSession)
-    throws QueryException
-  {
-    // Validate "modelURI" parameter
-    if (modelURI == null) {
-      throw new IllegalArgumentException("Null \"modelURI\" parameter");
-    }
-
-    // Validate "query" parameter
-    if (query == null) {
-      throw new IllegalArgumentException("Null \"query\" parameter");
-    }
-    if (query.getVariableList().size() != 3) {
-      throw new QueryException(
-          "Invalid select clause in insert/select.  Exactly 3 terms required");
-    }
-
-    // Validate "databaseSession" parameter
-    if (databaseSession == null) {
-      throw new IllegalArgumentException("Null \"databaseSession\" parameter");
-    }
-
-    // Initialize fields
-    this.modelURI  = modelURI;
-    this.tripleSet = null;
-    this.query     = query;
-    this.insert    = insert;
-  }
-
-  //
-  // Methods implementing Operation
-  //
-
-  public void execute(OperationContext       operationContext,
-                      SystemResolver         systemResolver,
-                      DatabaseMetadata       metadata) throws Exception
-  {
-    Statements statements;
-    if (tripleSet != null) {
-      assert query == null;
-
-      statements = new TripleSetWrapperStatements(
-        tripleSet, systemResolver, TripleSetWrapperStatements.PERSIST
-      );
-    } else {
-      assert query != null;
-
-      Answer answer = operationContext.doQuery(query);
-      try {
-        Variable[] vars = answer.getVariables();
-        assert vars.length == 3;
-        statements = new TuplesWrapperStatements(
-            new LocalizedTuples(systemResolver, answer, insert),
-            vars[0], vars[1], vars[2]);
-      } finally {
-        answer.close();
-      }
-    }
-    assert statements != null;
-
-    try {
-      doModify(operationContext, systemResolver, modelURI, statements, insert);
-    } finally {
-      statements.close();
-    }
-  }
-
-
-  protected void doModify(OperationContext operationContext,
-                          SystemResolver   systemResolver,
-                          URI              modelURI,
-                          Statements       statements,
-                          boolean          insert) throws Exception
-  {
-    long model = systemResolver.localize(new URIReferenceImpl(modelURI));
-    model = operationContext.getCanonicalModel(model);
-
-    // Make sure security adapters are satisfied
-    for (SecurityAdapter securityAdapter: (List<SecurityAdapter>)operationContext.getSecurityAdapterList()) {
-
-      // Lie to the user
-      if (!securityAdapter.canSeeModel(model, systemResolver)) {
-        throw new QueryException("No such model " + modelURI);
-      }
-
-      // Tell the truth to the user
-      if (!securityAdapter.canModifyModel(model, systemResolver)) {
-        throw new QueryException("You aren't allowed to modify " + modelURI);
-      }
-    }
-
-    // Obtain a resolver for the destination model type
-    Resolver resolver = operationContext.obtainResolver(
-                          operationContext.findModelResolverFactory(model));
-    assert resolver != null;
-
-    if (logger.isDebugEnabled()) {
-      logger.debug("Modifying " + modelURI + " using " + resolver);
-    }
-
-    resolver.modifyModel(model, statements, insert);
-
-    if (logger.isDebugEnabled()) {
-      logger.debug("Modified " + modelURI);
-    }
-  }
-
-  /**
-   * @return <code>true</code>
-   */
-  public boolean isWriteOperation()
-  {
-    return true;
-  }
-}

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/PrimitiveConstraintDescriptor.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/PrimitiveConstraintDescriptor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/PrimitiveConstraintDescriptor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -44,9 +44,9 @@
 import org.mulgara.query.Constraint;
 import org.mulgara.query.ConstraintElement;
 import org.mulgara.query.ConstraintExpression;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.resolver.spi.ConstraintDescriptor;
-import org.mulgara.resolver.spi.ConstraintModelRewrite;
+import org.mulgara.resolver.spi.ConstraintGraphRewrite;
 import org.mulgara.resolver.spi.ConstraintResolutionHandler;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
 import org.mulgara.store.tuples.Tuples;
@@ -70,7 +70,7 @@
 
   private Class<? extends Constraint> constraintClass;
   private ConstraintResolutionHandler resolutionHandler;
-  private ConstraintModelRewrite rewriteHandler;
+  private ConstraintGraphRewrite rewriteHandler;
 
   /**
    * @param constraintClass  the class of the constraint described
@@ -81,7 +81,7 @@
    * @throws IllegalArgumentException if <var>constraintClass</var> is <code>null</code>
    */
   PrimitiveConstraintDescriptor(Class<? extends Constraint> constraintClass,
-        ConstraintResolutionHandler resolutionHandler, ConstraintModelRewrite rewriteHandler) {
+        ConstraintResolutionHandler resolutionHandler, ConstraintGraphRewrite rewriteHandler) {
 
     // Validate parameters
     if (!ConstraintExpression.class.isAssignableFrom(constraintClass)) {
@@ -107,7 +107,7 @@
   }
 
 
-  public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+  public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
     if (rewriteHandler == null) {
       throw new IllegalStateException("Attempt to resolve model for " + constraintClass + " no handler registered");
     }

Copied: trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveGraphOperation.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveModelOperation.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveGraphOperation.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveGraphOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,154 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver;
+
+// Java 2 standard packages
+import java.io.*;
+import java.net.URI;
+import java.util.*;
+
+// Third party packages
+import org.apache.log4j.Logger;
+import org.jrdf.graph.*;
+
+// Local packages
+import org.mulgara.query.*;
+import org.mulgara.query.rdf.*;
+import org.mulgara.resolver.spi.*;
+import org.mulgara.store.nodepool.NodePool;
+
+/**
+ * An {@link Operation} that implements the {@link Session#removeModel} method.
+ *
+ * @created 2004-11-24
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.10 $
+ *
+ * @modified $Date: 2005/05/02 20:07:56 $ by $Author: raboczi $
+ *
+ * @maintenanceAuthor $Author: raboczi $
+ *
+ * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana
+ *   Technology, Inc</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+class RemoveGraphOperation implements Operation
+{
+  /**
+   * Logger.
+   *
+   * This is named after the class.
+   */
+  private static final Logger logger =
+    Logger.getLogger(RemoveGraphOperation.class.getName());
+
+  /**
+   * The URI of the model to be removed.
+   */
+  private final URI modelURI;
+
+  //
+  // Constructor
+  //
+
+  /**
+   * Sole constructor.
+   *
+   * @param modelURI  the {@link URI} of the model to be removed, never
+   *   <code>null</code>
+   * @throws IllegalArgumentException if <var>modelURI</var> is
+   *   <code>null</code>
+   */
+  RemoveGraphOperation(URI modelURI)
+  {
+    // Validate "modelURI" parameter
+    if (modelURI == null) {
+      throw new IllegalArgumentException("Null \"modelURI\" parameter");
+    }
+
+    // Initialize fields
+    this.modelURI = modelURI;
+  }
+
+  //
+  // Methods implementing Operation
+  //
+
+  public void execute(OperationContext       operationContext,
+                      SystemResolver         systemResolver,
+                      DatabaseMetadata       metadata) throws Exception
+  {
+    long model = systemResolver.localize(new URIReferenceImpl(modelURI));
+    model = operationContext.getCanonicalModel(model);
+
+    // Make sure security adapters are satisfied
+    for (Iterator i = operationContext.getSecurityAdapterList().iterator();
+         i.hasNext(); )
+    {
+      SecurityAdapter securityAdapter = (SecurityAdapter) i.next();
+
+      // Lie to the user
+      if (model == NodePool.NONE || !securityAdapter.canSeeModel(model, systemResolver)) {
+        throw new QueryException("No such model " + modelURI);
+      }
+
+      // Tell the truth to the user
+      if (!securityAdapter.canRemoveModel(model, systemResolver)) {
+        throw new QueryException("You aren't allowed to remove " + modelURI);
+      }
+    }
+
+    // Look up the resolver factory for the model
+    ResolverFactory resolverFactory =
+      operationContext.findModelResolverFactory(model);
+
+    if (resolverFactory == null) {
+      throw new QueryException(
+        "Could not obtain a resolver factory for " + modelURI
+      );
+    }
+
+    // Obtain an appropriate resolver bound to this session
+    Resolver resolver = operationContext.obtainResolver(resolverFactory);
+    assert resolver != null;
+
+    // Use the resolver to remove the model
+    resolver.removeModel(model);
+  }
+
+  /**
+   * @return <code>true</code>
+   */
+  public boolean isWriteOperation()
+  {
+    return true;
+  }
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveGraphOperation.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveModelOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveModelOperation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/RemoveModelOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,154 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.io.*;
-import java.net.URI;
-import java.util.*;
-
-// Third party packages
-import org.apache.log4j.Logger;
-import org.jrdf.graph.*;
-
-// Local packages
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.*;
-import org.mulgara.resolver.spi.*;
-import org.mulgara.store.nodepool.NodePool;
-
-/**
- * An {@link Operation} that implements the {@link Session#removeModel} method.
- *
- * @created 2004-11-24
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.10 $
- *
- * @modified $Date: 2005/05/02 20:07:56 $ by $Author: raboczi $
- *
- * @maintenanceAuthor $Author: raboczi $
- *
- * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana
- *   Technology, Inc</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-class RemoveModelOperation implements Operation
-{
-  /**
-   * Logger.
-   *
-   * This is named after the class.
-   */
-  private static final Logger logger =
-    Logger.getLogger(RemoveModelOperation.class.getName());
-
-  /**
-   * The URI of the model to be removed.
-   */
-  private final URI modelURI;
-
-  //
-  // Constructor
-  //
-
-  /**
-   * Sole constructor.
-   *
-   * @param modelURI  the {@link URI} of the model to be removed, never
-   *   <code>null</code>
-   * @throws IllegalArgumentException if <var>modelURI</var> is
-   *   <code>null</code>
-   */
-  RemoveModelOperation(URI modelURI)
-  {
-    // Validate "modelURI" parameter
-    if (modelURI == null) {
-      throw new IllegalArgumentException("Null \"modelURI\" parameter");
-    }
-
-    // Initialize fields
-    this.modelURI = modelURI;
-  }
-
-  //
-  // Methods implementing Operation
-  //
-
-  public void execute(OperationContext       operationContext,
-                      SystemResolver         systemResolver,
-                      DatabaseMetadata       metadata) throws Exception
-  {
-    long model = systemResolver.localize(new URIReferenceImpl(modelURI));
-    model = operationContext.getCanonicalModel(model);
-
-    // Make sure security adapters are satisfied
-    for (Iterator i = operationContext.getSecurityAdapterList().iterator();
-         i.hasNext(); )
-    {
-      SecurityAdapter securityAdapter = (SecurityAdapter) i.next();
-
-      // Lie to the user
-      if (model == NodePool.NONE || !securityAdapter.canSeeModel(model, systemResolver)) {
-        throw new QueryException("No such model " + modelURI);
-      }
-
-      // Tell the truth to the user
-      if (!securityAdapter.canRemoveModel(model, systemResolver)) {
-        throw new QueryException("You aren't allowed to remove " + modelURI);
-      }
-    }
-
-    // Look up the resolver factory for the model
-    ResolverFactory resolverFactory =
-      operationContext.findModelResolverFactory(model);
-
-    if (resolverFactory == null) {
-      throw new QueryException(
-        "Could not obtain a resolver factory for " + modelURI
-      );
-    }
-
-    // Obtain an appropriate resolver bound to this session
-    Resolver resolver = operationContext.obtainResolver(resolverFactory);
-    assert resolver != null;
-
-    // Use the resolver to remove the model
-    resolver.removeModel(model);
-  }
-
-  /**
-   * @return <code>true</code>
-   */
-  public boolean isWriteOperation()
-  {
-    return true;
-  }
-}

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/RestoreOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/RestoreOperation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/RestoreOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -380,7 +380,7 @@
         if (meta == emptyGroupNode) {
           // Statements in the EMPTY_GROUP.
           if (node1 == tksIntModelNode) {
-            // Set up a mapping from each V4 Group node to (multiple) Model
+            // Set up a mapping from each V4 Group node to (multiple) Graph
             // nodes.
             Long groupL = new Long(node0);
             Set modelSet = (Set)g2mMap.get(groupL);

Copied: trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/resolver/SetModelOperation.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,233 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver;
+
+// Java 2 standard packages
+import java.io.*;
+import java.net.URI;
+import java.util.*;
+
+// Third party packages
+import org.apache.log4j.Logger;
+import org.jrdf.graph.*;
+
+// Local packages
+import org.mulgara.content.Content;
+import org.mulgara.content.ContentHandler;
+import org.mulgara.content.ContentHandlerException;
+import org.mulgara.content.ContentHandlerManager;
+import org.mulgara.content.ContentLoader;
+import org.mulgara.content.NotModifiedException;
+import org.mulgara.query.*;
+import org.mulgara.query.rdf.*;
+import org.mulgara.resolver.spi.*;
+
+/**
+ * An {@link Operation} that implements the {@link Session#setModel} method.
+ *
+ * @created 2004-11-04
+ *
+ * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
+ *
+ * @version $Revision: 1.10 $
+ *
+ * @modified $Date: 2005/05/02 20:07:56 $ by $Author: raboczi $
+ *
+ * @maintenanceAuthor $Author: raboczi $
+ *
+ * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana
+ *   Technology, Inc</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+class SetGraphOperation implements Operation
+{
+  /**
+   * Logger.
+   *
+   * This is named after the class.
+   */
+  private static final Logger logger =
+    Logger.getLogger(SetGraphOperation.class.getName());
+
+  private final URI         srcModelURI;
+  private final URI         destModelURI;
+  private final InputStream inputStream;
+
+  private Content               content;
+  private final ContentHandlerManager contentHandlers;
+  private final DatabaseSession databaseSession;
+
+  /**
+   * Number of statements loaded, or -1 if the {@link #execute} method hasn't yet been
+   * invoked.
+   */
+  private long statementCount = -1;
+
+  //
+  // Constructor
+  //
+
+  /**
+   * Sole constructor.
+   *
+   * @param srcModelURI the {@link URI} of the model to be redefined
+   * @param destModelURI the {@link URI} of the model to be redefined
+   * @param inputStream  a stream containing the content at the <var>srcModelURI</var>
+   *   or <code>null</code> if the content must be fetched
+   */
+  SetGraphOperation(URI         srcModelURI,
+                    URI         destModelURI,
+                    InputStream inputStream,
+                    ContentHandlerManager contentHandlers,
+                    DatabaseSession databaseSession)
+  {
+    this.srcModelURI      = srcModelURI;
+    this.destModelURI = destModelURI;
+    this.inputStream         = inputStream;
+    this.contentHandlers = contentHandlers;
+    this.databaseSession    = databaseSession;
+  }
+
+  //
+  // Methods implementing Operation
+  //
+
+  public void execute(OperationContext       operationContext,
+                      SystemResolver         systemResolver,
+                      DatabaseMetadata       metadata) throws Exception
+  {
+    // A prior call to execute will have set statementCount >= 0.
+    if (statementCount != -1) {
+      throw new IllegalStateException("SetGraphOperation already executed.  Cannot reexecute.");
+    }
+
+    long destinationModel = systemResolver.localize(new URIReferenceImpl(destModelURI));
+    try {
+      long sourceModel = systemResolver.localize(new URIReferenceImpl(srcModelURI, false));
+      if (destinationModel == sourceModel) throw new QueryException("Identical source and destination: " + destModelURI);
+    } catch (Exception e) {
+      // source and destinations cannot be equal, so ignore
+    }
+
+    // update the destination to the canonical form
+    destinationModel = operationContext.getCanonicalModel(destinationModel);
+
+    // Obtain a resolver for the destination model type
+    Resolver destinationResolver = operationContext.obtainResolver(
+      operationContext.findModelResolverFactory(destinationModel));
+    assert destinationResolver != null;
+
+    ContentHandler contentHandler = contentHandlers.getContentHandler(content);
+
+    Statements statements = contentHandler.parse(content,
+        new PersistentResolverSession(systemResolver));
+
+    if (logger.isDebugEnabled()) {
+      logger.debug("Modifying " + destModelURI + " using " + destinationResolver);
+    }
+
+    destinationResolver.modifyModel(destinationModel, statements, true);
+    if (logger.isDebugEnabled()) {
+      logger.debug("Modified " + destModelURI);
+    }
+
+    statementCount = statements.getRowCount();
+  }
+
+  /**
+   * @return <code>true</code>
+   */
+  public boolean isWriteOperation() {
+    return true;
+  }
+
+
+  //
+  // Operation result accessor
+  //
+
+  /**
+   * @return the number of statements loaded
+   * @throws IllegalStateException  if {@link #execute} hasn't yet been called
+   */
+  long getStatementCount()
+  {
+    if (statementCount == -1) {
+      throw new IllegalStateException("Statement count not available before execution.");
+    }
+
+    return statementCount;
+  }
+
+
+  /**
+   * This method is a refactoring hack, purely to get all the code which
+   * depends on content handler and resolver components out of the core
+   * <code>resolver</code> component.
+   *
+   * @return whether {@link #execute} should be called next
+   */
+  boolean preExecute() throws QueryException
+  {
+    // create a StreamContent if an inputStream has been supplied
+    if (inputStream != null) {
+      if (logger.isDebugEnabled()) {
+        logger.debug("Detected inputstream associated with " + srcModelURI );
+      }
+      content = new StreamContent(inputStream, srcModelURI);
+    } else {
+      try {
+        content = ContentFactory.getContent(srcModelURI);
+      } catch (ContentHandlerException ec) {
+        throw new QueryException("Failed to find Content for uri", ec);
+      }
+    }
+
+    ContentLoader loader;
+    try {
+      loader = contentHandlers.getContentLoader(content);
+    } catch (NotModifiedException e) {
+      throw new QueryException("Content is already cached", e);
+    } catch (ContentHandlerException ec) {
+      throw new QueryException("Failure finding contentLoader");
+    }
+
+    if (loader != null) {
+      try {
+        statementCount = loader.load(content, new GraphResource(destModelURI), databaseSession);
+
+        return false; // notifies caller that a call to execute will fail.
+      } catch (ContentHandlerException handlerException) {
+        throw new QueryException("Failed to setModel.", handlerException);
+      }
+    }
+
+    return true;
+  }
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/resolver/SetGraphOperation.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/SetModelOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/SetModelOperation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/SetModelOperation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,233 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Java 2 standard packages
-import java.io.*;
-import java.net.URI;
-import java.util.*;
-
-// Third party packages
-import org.apache.log4j.Logger;
-import org.jrdf.graph.*;
-
-// Local packages
-import org.mulgara.content.Content;
-import org.mulgara.content.ContentHandler;
-import org.mulgara.content.ContentHandlerException;
-import org.mulgara.content.ContentHandlerManager;
-import org.mulgara.content.ContentLoader;
-import org.mulgara.content.NotModifiedException;
-import org.mulgara.query.*;
-import org.mulgara.query.rdf.*;
-import org.mulgara.resolver.spi.*;
-
-/**
- * An {@link Operation} that implements the {@link Session#setModel} method.
- *
- * @created 2004-11-04
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.10 $
- *
- * @modified $Date: 2005/05/02 20:07:56 $ by $Author: raboczi $
- *
- * @maintenanceAuthor $Author: raboczi $
- *
- * @copyright &copy;2004 <a href="http://www.tucanatech.com/">Tucana
- *   Technology, Inc</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-class SetModelOperation implements Operation
-{
-  /**
-   * Logger.
-   *
-   * This is named after the class.
-   */
-  private static final Logger logger =
-    Logger.getLogger(SetModelOperation.class.getName());
-
-  private final URI         srcModelURI;
-  private final URI         destModelURI;
-  private final InputStream inputStream;
-
-  private Content               content;
-  private final ContentHandlerManager contentHandlers;
-  private final DatabaseSession databaseSession;
-
-  /**
-   * Number of statements loaded, or -1 if the {@link #execute} method hasn't yet been
-   * invoked.
-   */
-  private long statementCount = -1;
-
-  //
-  // Constructor
-  //
-
-  /**
-   * Sole constructor.
-   *
-   * @param srcModelURI the {@link URI} of the model to be redefined
-   * @param destModelURI the {@link URI} of the model to be redefined
-   * @param inputStream  a stream containing the content at the <var>srcModelURI</var>
-   *   or <code>null</code> if the content must be fetched
-   */
-  SetModelOperation(URI         srcModelURI,
-                    URI         destModelURI,
-                    InputStream inputStream,
-                    ContentHandlerManager contentHandlers,
-                    DatabaseSession databaseSession)
-  {
-    this.srcModelURI      = srcModelURI;
-    this.destModelURI = destModelURI;
-    this.inputStream         = inputStream;
-    this.contentHandlers = contentHandlers;
-    this.databaseSession    = databaseSession;
-  }
-
-  //
-  // Methods implementing Operation
-  //
-
-  public void execute(OperationContext       operationContext,
-                      SystemResolver         systemResolver,
-                      DatabaseMetadata       metadata) throws Exception
-  {
-    // A prior call to execute will have set statementCount >= 0.
-    if (statementCount != -1) {
-      throw new IllegalStateException("SetModelOperation already executed.  Cannot reexecute.");
-    }
-
-    long destinationModel = systemResolver.localize(new URIReferenceImpl(destModelURI));
-    try {
-      long sourceModel = systemResolver.localize(new URIReferenceImpl(srcModelURI, false));
-      if (destinationModel == sourceModel) throw new QueryException("Identical source and destination: " + destModelURI);
-    } catch (Exception e) {
-      // source and destinations cannot be equal, so ignore
-    }
-
-    // update the destination to the canonical form
-    destinationModel = operationContext.getCanonicalModel(destinationModel);
-
-    // Obtain a resolver for the destination model type
-    Resolver destinationResolver = operationContext.obtainResolver(
-      operationContext.findModelResolverFactory(destinationModel));
-    assert destinationResolver != null;
-
-    ContentHandler contentHandler = contentHandlers.getContentHandler(content);
-
-    Statements statements = contentHandler.parse(content,
-        new PersistentResolverSession(systemResolver));
-
-    if (logger.isDebugEnabled()) {
-      logger.debug("Modifying " + destModelURI + " using " + destinationResolver);
-    }
-
-    destinationResolver.modifyModel(destinationModel, statements, true);
-    if (logger.isDebugEnabled()) {
-      logger.debug("Modified " + destModelURI);
-    }
-
-    statementCount = statements.getRowCount();
-  }
-
-  /**
-   * @return <code>true</code>
-   */
-  public boolean isWriteOperation() {
-    return true;
-  }
-
-
-  //
-  // Operation result accessor
-  //
-
-  /**
-   * @return the number of statements loaded
-   * @throws IllegalStateException  if {@link #execute} hasn't yet been called
-   */
-  long getStatementCount()
-  {
-    if (statementCount == -1) {
-      throw new IllegalStateException("Statement count not available before execution.");
-    }
-
-    return statementCount;
-  }
-
-
-  /**
-   * This method is a refactoring hack, purely to get all the code which
-   * depends on content handler and resolver components out of the core
-   * <code>resolver</code> component.
-   *
-   * @return whether {@link #execute} should be called next
-   */
-  boolean preExecute() throws QueryException
-  {
-    // create a StreamContent if an inputStream has been supplied
-    if (inputStream != null) {
-      if (logger.isDebugEnabled()) {
-        logger.debug("Detected inputstream associated with " + srcModelURI );
-      }
-      content = new StreamContent(inputStream, srcModelURI);
-    } else {
-      try {
-        content = ContentFactory.getContent(srcModelURI);
-      } catch (ContentHandlerException ec) {
-        throw new QueryException("Failed to find Content for uri", ec);
-      }
-    }
-
-    ContentLoader loader;
-    try {
-      loader = contentHandlers.getContentLoader(content);
-    } catch (NotModifiedException e) {
-      throw new QueryException("Content is already cached", e);
-    } catch (ContentHandlerException ec) {
-      throw new QueryException("Failure finding contentLoader");
-    }
-
-    if (loader != null) {
-      try {
-        statementCount = loader.load(content, new ModelResource(destModelURI), databaseSession);
-
-        return false; // notifies caller that a call to execute will fail.
-      } catch (ContentHandlerException handlerException) {
-        throw new QueryException("Failed to setModel.", handlerException);
-      }
-    }
-
-    return true;
-  }
-}

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -610,7 +610,7 @@
     ) {
       URI uri = ((SPURI)spObject).getURI();
       if (!uri.isAbsolute()) {
-        // Model URIs are stored as a relative URI containing only a fragment.
+        // Graph URIs are stored as a relative URI containing only a fragment.
         // Relative URIs with both a query string and a fragment are also used
         // for views.
 

Copied: trunk/src/jar/resolver/java/org/mulgara/resolver/SystemGraphSecurityAdapter.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/resolver/SystemModelSecurityAdapter.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/SystemGraphSecurityAdapter.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/SystemGraphSecurityAdapter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,86 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver;
+
+// Local packages
+import org.mulgara.resolver.spi.NullSecurityAdapter;
+import org.mulgara.resolver.spi.ResolverSession;
+import org.mulgara.store.nodepool.NodePool;
+
+/**
+ * This {@link SecurityAdapter} enforces the sanctity of the system model
+ * (<code>#</code>).
+ *
+ * A {@link Session} may only modify the contents of the system model
+ * indirectly, via the <code>backup</code>, <code>create</code>,
+ * <code>drop</code> and <code>restore</code> methods.
+ *
+ * @created 2004-10-15
+ * @author <a href="http://www.pisoftware.com/raboczi">Simon Raboczi</a>
+ * @version $Revision: 1.8 $
+ * @modified $Date: 2005/01/05 04:58:24 $ 
+ * @maintenanceAuthor $Author: newmana $
+ * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
+ * @copyright &copy;2004 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+
+class SystemGraphSecurityAdapter extends NullSecurityAdapter
+{
+  /**
+   * The preallocated node representing the system model.
+   */
+  private final long systemModel;
+
+  /**
+   * Sole constructor.
+   *
+   * @param systemModel  the preallocated node representing the system model
+   */
+  SystemGraphSecurityAdapter(long systemModel)
+  {
+    assert systemModel != NodePool.NONE;
+
+    // Initialize fields
+    this.systemModel = systemModel;
+  }
+
+  //
+  // Methods overriding NullSecurityAdapter
+  //
+
+  /**
+   * @return <code>true</code> unless <var>model</var> represents the system
+   *   model
+   */
+  public boolean canModifyModel(long model, ResolverSession resolverSession)
+  {
+    return model != systemModel;
+  }
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/resolver/SystemGraphSecurityAdapter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver/java/org/mulgara/resolver/SystemModelSecurityAdapter.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/SystemModelSecurityAdapter.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/SystemModelSecurityAdapter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,86 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver;
-
-// Local packages
-import org.mulgara.resolver.spi.NullSecurityAdapter;
-import org.mulgara.resolver.spi.ResolverSession;
-import org.mulgara.store.nodepool.NodePool;
-
-/**
- * This {@link SecurityAdapter} enforces the sanctity of the system model
- * (<code>#</code>).
- *
- * A {@link Session} may only modify the contents of the system model
- * indirectly, via the <code>backup</code>, <code>create</code>,
- * <code>drop</code> and <code>restore</code> methods.
- *
- * @created 2004-10-15
- * @author <a href="http://www.pisoftware.com/raboczi">Simon Raboczi</a>
- * @version $Revision: 1.8 $
- * @modified $Date: 2005/01/05 04:58:24 $ 
- * @maintenanceAuthor $Author: newmana $
- * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
- * @copyright &copy;2004 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-class SystemModelSecurityAdapter extends NullSecurityAdapter
-{
-  /**
-   * The preallocated node representing the system model.
-   */
-  private final long systemModel;
-
-  /**
-   * Sole constructor.
-   *
-   * @param systemModel  the preallocated node representing the system model
-   */
-  SystemModelSecurityAdapter(long systemModel)
-  {
-    assert systemModel != NodePool.NONE;
-
-    // Initialize fields
-    this.systemModel = systemModel;
-  }
-
-  //
-  // Methods overriding NullSecurityAdapter
-  //
-
-  /**
-   * @return <code>true</code> unless <var>model</var> represents the system
-   *   model
-   */
-  public boolean canModifyModel(long model, ResolverSession resolverSession)
-  {
-    return model != systemModel;
-  }
-}

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/TestDef.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/TestDef.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/TestDef.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -55,14 +55,14 @@
   public String name;
   public String[] resolvers;
   public List<Variable> selectList;
-  public ModelExpression model;
+  public GraphExpression model;
   public ConstraintExpression query;
   public List<List<Object>> results;
   public String errorString;
 
   @SuppressWarnings("unchecked")
   public TestDef(String name, String[] resolvers, TestQuery query,
-                 ModelExpression model, List results, String errorString) {
+                 GraphExpression model, List results, String errorString) {
     this.name = name;
     this.resolvers = resolvers;
     this.model = model;
@@ -85,9 +85,9 @@
 
   static public class Parser {
     private ConstraintElement[] elements;
-    private ModelResource[] models;
+    private GraphResource[] models;
 
-    public Parser(ConstraintElement[] elements, ModelResource[] models) {
+    public Parser(ConstraintElement[] elements, GraphResource[] models) {
       this.elements = elements;
       this.models = models;
     }
@@ -113,7 +113,7 @@
     }
 
 
-    private ModelExpression parseModel(StringTokenizer tokenizer) {
+    private GraphExpression parseModel(StringTokenizer tokenizer) {
       String token = getToken(tokenizer);
 
       if ("(".equals(token)) {
@@ -126,34 +126,34 @@
     }
 
 
-    private ModelOperation parseModelOperation(StringTokenizer tokenizer) {
+    private GraphOperation parseModelOperation(StringTokenizer tokenizer) {
       String token = getToken(tokenizer);
-      ModelExpression lhs = parseModel(tokenizer);
-      ModelExpression rhs = parseModel(tokenizer);
+      GraphExpression lhs = parseModel(tokenizer);
+      GraphExpression rhs = parseModel(tokenizer);
       String terminator = getToken(tokenizer);
       if (!")".equals(terminator)) {
-        throw new IllegalArgumentException("Unterminated ModelOperation " + terminator);
+        throw new IllegalArgumentException("Unterminated GraphOperation " + terminator);
       }
       if ("union".equals(token)) {
-        return new ModelUnion(lhs, rhs);
+        return new GraphUnion(lhs, rhs);
       }
       if ("intersect".equals(token)) {
-        return new ModelIntersection(lhs, rhs);
+        return new GraphIntersection(lhs, rhs);
       }
-      throw new IllegalArgumentException("Unknown ModelOperation " + token);
+      throw new IllegalArgumentException("Unknown GraphOperation " + token);
     }
 
 
-    private ModelResource parseModelResource(String token) {
+    private GraphResource parseModelResource(String token) {
       try {
         int index = Integer.parseInt(token.substring(1));
         if (index > models.length) {
-          throw new IllegalArgumentException("Invalid ModelResource index " + index);
+          throw new IllegalArgumentException("Invalid GraphResource index " + index);
         }
 
         return models[index];
       } catch (NumberFormatException en) {
-        throw new IllegalArgumentException("Invalid ModelResource descriptor" + token);
+        throw new IllegalArgumentException("Invalid GraphResource descriptor" + token);
       }
     }
 

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -93,7 +93,7 @@
    * @param predConstraint a constraint describing a predicate to traverse with
    *     a supported model type fourth element of the constraint is not a Variable
    *     or is a Variable with the name _from.
-   * @param modelExpression  the Graph to resolve the constraint against if the
+   * @param graphExpression  the Graph to resolve the constraint against if the
    *     fourth element of the constraint is a Variable with the name _from.
    * @return the answer satisfying the <var>constraint</var>
    * @throws QueryException if the <var>constraint</var> has a model of an
@@ -102,7 +102,7 @@
    *     from various query resolutions.
    */
   public static Tuples walk(QueryEvaluationContext query, WalkConstraint predConstraint,
-      ModelExpression modelExpression, ResolverSession session)
+      GraphExpression graphExpression, ResolverSession session)
       throws QueryException, TuplesException {
 
     if (logger.isDebugEnabled()) {
@@ -149,7 +149,7 @@
     try {
 
       // ask for all statements for this predicate
-      initialTuples = query.resolve(modelExpression, predConstraint.getAnchoredConstraint());
+      initialTuples = query.resolve(graphExpression, predConstraint.getAnchoredConstraint());
 
       // prepare to iterate through anchor
       initialTuples.beforeFirst();
@@ -232,7 +232,7 @@
       }
 
       // find *all* statements with the given predicate
-      predTuples = query.resolve(modelExpression, openConstraint);
+      predTuples = query.resolve(graphExpression, openConstraint);
 
       // remember that the current value has been visited
       Set visited = new HashSet();

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/XADatabaseSessionUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -133,11 +133,11 @@
   };
 
 
-  protected static final ModelResource[] models;
+  protected static final GraphResource[] models;
   static {
-    models = new ModelResource[modelURIs.length];
+    models = new GraphResource[modelURIs.length];
     for (int i = 0; i < modelURIs.length; i++) {
-      models[i] = new ModelResource(modelURIs[i]);
+      models[i] = new GraphResource(modelURIs[i]);
     }
   };
 
@@ -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 ModelResource(modelDataURIs[i]));
+        session.setModel(modelURIs[i], new GraphResource(modelDataURIs[i]));
       }
     } catch (URISyntaxException e) {
       throw new Error("Bad hardcoded XA store model URI", e);

Copied: trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphN3Writer.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelN3Writer.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphN3Writer.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphN3Writer.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,204 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+package org.mulgara.store.exporter;
+
+// Java 2 standard packages
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+// Apache packages
+import org.apache.log4j.Logger;
+
+// JRDF
+import org.jrdf.vocabulary.*;
+
+// Local packages
+import org.jrdf.graph.GraphException;
+import org.jrdf.util.ClosableIterator;
+import org.jrdf.graph.*;
+import org.mulgara.store.*;
+
+/**
+ * A Writer used to write N3 for a Mulgara model.
+ *
+ * @created 2004-07-26
+ *
+ * @author <a href="mailto:pag at pisoftware.com">Paul Gearon</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:25 $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
+ *
+ * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphN3Writer implements GraphWriter {
+
+  /**
+   * Logger. This is named after the class.
+   */
+  private final static Logger log = Logger.getLogger(GraphN3Writer.class.
+      getName());
+
+
+  /**
+   * Default Constructor
+   */
+  public GraphN3Writer() {
+  }
+
+
+  /**
+   * Writes the contents of the JRDFGraph to a PrintWriter in N3 format.
+   *
+   * @param graph Graph Graph containing the Statements to be written.
+   * @param writer PrintWriter Where to write the statements.
+   * @throws GraphException
+   */
+  synchronized public void write(Graph graph, PrintWriter writer) throws
+      GraphException {
+
+    //write Header, Body and Footer
+    try {
+
+      //write document
+      writeHeader(writer);
+      writeBody(graph, writer);
+    }
+    catch (IOException ioException) {
+
+      throw new GraphException("Could not write Graph.", ioException);
+    }
+  }
+
+
+  /**
+   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format
+   * with the encoding specified in the opening XML tag.
+   *
+   * @param graph Graph Graph containing the Statements to be written.
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  synchronized public void write(Graph graph, OutputStreamWriter writer)
+      throws GraphException {
+
+    //wrap writer and enable auto flushing
+    PrintWriter out = new PrintWriter(writer, true);
+
+    write(graph, out);
+  }
+
+
+  /**
+   * Writes any desired comments as a header.
+   *
+   * @param out the writer to use to output.
+   * @throws IOException if there was an IO exception.
+   * @throws IllegalArgumentException if the given writer is null.
+   */
+  private void writeHeader(PrintWriter out) throws IOException {
+
+    //validate
+    if (out != null) {
+      out.println("# Mulgara graph in N3");
+    } else {
+      throw new IllegalArgumentException("Cannot write to null Writer.");
+    }
+  }
+
+
+  /**
+   * Writes the Graph's statements as N3 to the print Writer.
+   *
+   * @param graph Graph Graph containing the Statements to be written.
+   * @param out PrintWriter
+   * @throws IOException
+   */
+  private void writeBody(Graph graph, PrintWriter out) throws IOException,
+      GraphException {
+
+    //validate
+    if ( (out != null)
+        && (graph != null)) {
+
+      // iterator to access entire graph
+      ClosableIterator graphIter = graph.find(null, null, null);
+
+      while (graphIter.hasNext()) {
+        // extract the triple
+        Triple triple = (Triple)graphIter.next();
+        SubjectNode s = triple.getSubject();
+        PredicateNode p = triple.getPredicate();
+        ObjectNode o = triple.getObject();
+
+        out.println("<" + s.toString() + "> <" + ((URIReference)p).getURI().toString() + "> "+ getLabel(o));
+      }
+
+    } else {
+
+      //message for exception to be thrown
+      String message = "Could not write Graph. Invlaid arguments provided. ";
+
+      if (out == null) {
+        message += "Writer is null. ";
+      }
+
+      if (graph == null) {
+        message += "Graph is null. ";
+      }
+
+      throw new IllegalArgumentException(message);
+    }
+  }
+
+
+  /**
+   * Formats an object node appropriately at either a literal or a resource.
+   * For efficiency, a line termination character is appended.
+   *
+   * @param node The object node to format
+   * @throws GraphException
+   */
+  private String getLabel(ObjectNode node) {
+    if (node instanceof Literal) {
+      return "\"" + ((Literal)node).getLexicalForm() + "\" .";
+    } else if (node instanceof URIReference) {
+      return "<" + ((URIReference)node).getURI().toString() + "> .";
+    }
+    // node is a blank node
+    return "<" + node.toString() + "> .";
+  }
+
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphN3Writer.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphWriter.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelWriter.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphWriter.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphWriter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,77 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+package org.mulgara.store.exporter;
+
+// Java 2 standard packages
+import java.io.*;
+
+// Local packages
+import org.jrdf.graph.GraphException;
+import org.jrdf.graph.Graph;
+
+/**
+ * A Writer used to write a serialization for a Mulgara model.
+ *
+ * @created 2004-02-23
+ *
+ * @author <a href="mailto:pag at tucanatech.com">Paul Gearon</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:25 $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
+ *
+ * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public interface GraphWriter {
+
+  /**
+   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format.
+   *
+   * @param graph JRDF Graph containing the Statements to be written.
+   * @param writer PrintWriter Where to write the statements.
+   * @throws GraphException
+   */
+  public void write(Graph graph, PrintWriter writer) throws GraphException;
+
+  /**
+   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format
+   * with the encoding specified in the opening XML tag.
+   *
+   * @param graph JRDF Graph
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  public void write(Graph graph, OutputStreamWriter writer) throws GraphException;
+
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphWriter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphXMLWriter.java (from rev 1397, trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelXMLWriter.java)
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphXMLWriter.java	                        (rev 0)
+++ trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphXMLWriter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,1143 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+package org.mulgara.store.exporter;
+
+// Java 2 standard packages
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+// Apache packages
+import org.apache.log4j.Logger;
+import org.apache.xerces.util.EncodingMap;
+
+// JRDF
+import org.jrdf.graph.GraphException;
+import org.jrdf.util.ClosableIterator;
+import org.jrdf.vocabulary.*;
+
+// Local packages
+/*
+import org.mulgara.resolver.jrdf.ClosableIteratorImpl;
+import org.mulgara.resolver.jrdf.JRDFGraph;
+*/
+import org.jrdf.graph.*;
+import org.mulgara.query.Order;
+import org.mulgara.query.Value;
+import org.mulgara.store.*;
+import org.mulgara.store.statement.StatementStore;
+import org.mulgara.store.tuples.RowComparator;
+import org.mulgara.util.*;
+
+/**
+ * A Writer used to write RDF/XML for a Mulgara model.
+ *
+ * @created 2004-02-20
+ *
+ * @author <a href="mailto:robert.turner at tucanatech.com">Robert Turner</a>
+ *
+ * @version $Revision: 1.8 $
+ *
+ * @modified $Date: 2005/01/05 04:58:25 $
+ *
+ * @maintenanceAuthor $Author: newmana $
+ *
+ * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
+ *
+ * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ *
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+public class GraphXMLWriter
+    implements GraphWriter {
+
+  /**
+   * Logger. This is named after the class.
+   */
+  private final static Logger log = Logger.getLogger(GraphXMLWriter.class.
+      getName());
+
+  /** Prefix used to abbreviate RDF Namespace */
+  private static final String RDF_PREFIX = "rdf";
+
+  /** Prefix used to abbreviate RDFS Namespace */
+  private static final String RDFS_PREFIX = "rdfs";
+
+  /** Convenience reference to the new line character */
+  private static final String NEWLINE = System.getProperty("line.separator");
+
+  /** Map used to replace commonly used namespaces with prefixes */
+  protected Map namespaces = null;
+
+  /**
+   * Default Constructor
+   */
+  public GraphXMLWriter() {
+  }
+
+  /**
+   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format.
+   *
+   * @param graph JRDFGraph Graph containing the Statements to be written.
+   * @param writer PrintWriter Where to write the statements.
+   * @throws GraphException
+   */
+  synchronized public void write(Graph graph, PrintWriter writer) throws
+      GraphException {
+
+    /*
+    if (! (graph instanceof JRDFGraph)) {
+      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
+    }
+    */
+
+    //write Header, Body and Footer
+    try {
+
+      //initialize the namespaces first
+      this.populateNamespaces(graph);
+
+      //write document
+      this.writeHeader(writer);
+      this.writeBody(graph, writer);
+      this.writeFooter(writer);
+    }
+    catch (IOException ioException) {
+
+      throw new GraphException("Could not write Graph.", ioException);
+    }
+  }
+
+  /**
+   * Writes the contents of the JRDF Graph to a PrintWriter in RDF/XML format
+   * with the encoding specified in the opening XML tag.
+   *
+   * @param graph JRDFGraph
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  synchronized public void write(Graph graph, OutputStreamWriter writer) throws
+      GraphException {
+
+    /*
+    if (! (graph instanceof JRDFGraph)) {
+      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
+    }
+    */
+
+    //write Header, Body and Footer
+    try {
+
+      //wrap writer and enable auto flushing
+      PrintWriter out = new PrintWriter(writer, true);
+
+      //initialize the namespaces first
+      this.populateNamespaces(graph);
+
+      //write document
+      this.writeHeader(writer);
+      this.writeBody(graph, out);
+      this.writeFooter(out);
+    }
+    catch (IOException ioException) {
+
+      throw new GraphException("Could not write Graph.", ioException);
+    }
+  }
+
+  /**
+   * Writes the XML Declaration and the opening RDF tag to the print Writer.
+   * Encoding not specified.
+   *
+   * @param out PrintWriter
+   * @throws IOException
+   */
+  protected void writeHeader(PrintWriter out) throws IOException {
+
+    //validate
+    if (out != null) {
+
+      //print opening tags
+      out.println("<?xml version=\"1.0\"?>");
+
+      //print the opening RDF tag (including namespaces)
+      this.writeRDFHeader(out);
+    }
+    else {
+
+      throw new IllegalArgumentException("Cannot write to null Writer.");
+    }
+  }
+
+  /**
+   * Writes the XML Declaration and the opening RDF tag to the print Writer.
+   * Encoding attribute is specified as the encoding argument.
+   *
+   * @param out PrintWriter
+   * @throws IOException
+   */
+  protected void writeHeader(OutputStreamWriter out) throws IOException {
+
+    //validate
+    if (out != null) {
+
+      //wrapper for output stream writer (enable autoflushing)
+      PrintWriter writer = new PrintWriter(out, true);
+
+      //get encoding from the Encoding map
+      String encoding = EncodingMap.getJava2IANAMapping(out.getEncoding());
+
+      //only insert encoding if there is a value
+      if (encoding != null) {
+
+        //print opening tags <?xml version="1.0" encoding=*encoding*?>
+        writer.println("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>");
+      }
+      else {
+
+        //print opening tags <?xml version="1.0"?>
+        writer.println("<?xml version=\"1.0\"?>");
+      }
+
+      //print the Entities
+      this.writeXMLEntities(writer);
+
+      //print the opening RDF tag (including namespaces)
+      this.writeRDFHeader(writer);
+    }
+    else {
+
+      throw new IllegalArgumentException("Cannot write to null Writer.");
+    }
+  }
+
+  /**
+   * Writes the XML Entities (used for namespaces) to the print Writer.
+   *
+   * @param out PrintWriter
+   * @throws IOException
+   */
+  protected void writeXMLEntities(PrintWriter out) throws IOException {
+
+    //validate
+    if (out != null) {
+
+      //print opening DOCTYPE DECLARATION tag
+      out.print(NEWLINE + "<!DOCTYPE rdf:RDF [");
+
+      //print namespaces
+      Set keys = this.namespaces.keySet();
+
+      if (keys != null) {
+
+        Iterator keyIter = keys.iterator();
+        Object currentKey = null;
+        Object currentValue = null;
+
+        while (keyIter.hasNext()) {
+
+          currentKey = keyIter.next();
+          currentValue = this.namespaces.get(currentKey);
+
+          if ( (currentKey != null)
+              && (currentValue != null)) {
+
+            //write as: <!ENTITY ns 'http://example.org/abc#'>
+            out.print(NEWLINE + "  <!ENTITY " + currentKey + " '" +
+                      currentValue + "'>");
+          }
+        }
+      }
+
+      //close the opening tag (add a space for readability)
+      out.print("]>" + NEWLINE + NEWLINE);
+    }
+    else {
+
+      throw new IllegalArgumentException("Cannot write to null Writer.");
+    }
+  }
+
+  /**
+   * Writes the opening RDF tag (with namespaces) to the print Writer.
+   *
+   * @param out PrintWriter
+   * @throws IOException
+   */
+  protected void writeRDFHeader(PrintWriter out) throws IOException {
+
+    //validate
+    if (out != null) {
+
+      //print opening RDF tag (including namespaces)
+      out.print("<rdf:RDF ");
+
+      //print namespaces
+      Set keys = this.namespaces.keySet();
+
+      if (keys != null) {
+
+        Iterator keyIter = keys.iterator();
+        Object currentKey = null;
+        Object currentValue = null;
+
+        while (keyIter.hasNext()) {
+
+          currentKey = keyIter.next();
+          currentValue = this.namespaces.get(currentKey);
+
+          if ( (currentKey != null)
+              && (currentValue != null)) {
+
+           //use entities: xmlns:ns="&ns;"
+            out.print(NEWLINE + "  xmlns:" + currentKey + "=\"&" + currentKey +
+                      ";\"");
+          }
+        }
+      }
+
+      //close the opening tag (add a space for readability)
+      out.print(">" + NEWLINE + NEWLINE);
+    }
+    else {
+
+      throw new IllegalArgumentException("Cannot write to null Writer.");
+    }
+  }
+
+  /**
+   * Writes the Graph's statements as RDF/XML to the print Writer.
+   *
+   * @param out PrintWriter
+   * @throws IOException
+   */
+  protected void writeBody(Graph graph, PrintWriter out) throws IOException,
+      GraphException {
+
+    //validate
+    if ( (out != null)
+        && (graph != null)) {
+
+      //iterator used to access subjects
+      ClosableIterator subjectIter = graph.find(null, null, null);
+
+      //write every (unique) subject
+      if (subjectIter != null) {
+
+        //current Triple
+        Object triple = null;
+
+        //current Subject
+        SubjectNode subject = null;
+
+        Set writtenSubjectSet = new HashSet();
+
+        while (subjectIter.hasNext()) {
+
+          //get the next triple
+          triple = subjectIter.next();
+
+          if ( (triple != null)
+              && (triple instanceof Triple)) {
+
+            subject = ( (Triple) triple).getSubject();
+
+            if (!writtenSubjectSet.contains(subject)) {
+              this.writeSubject(graph, subject, out);
+              writtenSubjectSet.add(subject);
+            }
+          }
+        }
+
+        //close the Iterator
+        subjectIter.close();
+      }
+    }
+    else {
+
+      //message for exception to be thrown
+      String message = "Could not write Graph. Invlaid arguments provided. ";
+
+      if (out == null) {
+
+        message += "Writer is null. ";
+      }
+      if (graph == null) {
+
+        message += "Graph is null. ";
+      }
+
+      throw new IllegalArgumentException(message);
+    }
+  }
+
+  /**
+   * Writes the closing RDF tag to the writer.
+   *
+   * @param out PrintWriter
+   * @throws IOException
+   */
+  protected void writeFooter(PrintWriter out) throws IOException {
+
+    //validate
+    if (out != null) {
+
+      //print closing RDF tag
+      out.println("</" + RDF_PREFIX + ":RDF>");
+    }
+    else {
+
+      throw new IllegalArgumentException("Cannot write to null Writer.");
+    }
+  }
+
+  /**
+   * Writes a Subject to the writer
+   *
+   * @param graph JRDFGraph
+   * @param subject SubjectNode
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeSubject(Graph graph, SubjectNode subject,
+                              PrintWriter writer) throws GraphException {
+
+    //opening subject tag (includes literals)
+    this.writeOpeningTag(graph, subject, writer);
+
+    //subject contents
+    this.writeSubjectBody(graph, subject, writer);
+
+    //closing subject tag
+    this.writeClosingTag(graph, subject, writer);
+
+    //put a space between Subjects
+    writer.println("");
+  }
+
+  /**
+   * Writes the opening tag for the subject
+   *
+   * @param graph JRDFGraph
+   * @param subject SubjectNode
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeOpeningTag(Graph graph, SubjectNode subject,
+                                 PrintWriter writer) throws
+      GraphException {
+
+    if (writer != null) {
+
+      //write the subject type and rdf:about
+      if (subject != null) {
+
+        //open tag - BlankNodes are a special case
+        if (subject instanceof BlankNode) {
+
+          this.writeOpeningTag(graph, (BlankNode) subject, writer);
+        }
+        else {
+
+          writer.print("  <" + RDF_PREFIX + ":Description " + RDF_PREFIX +
+                       ":about=\"" + this.getNodeString(subject) + "\">" +
+                       NEWLINE);
+        }
+      }
+      else {
+
+        throw new IllegalArgumentException("Could not write opening tag for " +
+                                           "subject. Subject Node is null.");
+      }
+    }
+  }
+
+  /**
+   * Writes the opening tag for a blank node.
+   *
+   * @param graph JRDFGraph
+   * @param subject BlankNode
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeOpeningTag(Graph graph, BlankNode subject,
+                                 PrintWriter writer) throws GraphException {
+
+    ObjectNode subjectType = this.getSubjectType(graph, subject);
+
+    //only display as a subject if it can be found
+    if (subjectType != null) {
+
+      //opening tag
+      writer.print("  <" + this.getURI(subjectType) + ">" + NEWLINE);
+    }
+    else {
+
+      //opening tag
+      writer.print("  <" + RDF_PREFIX + ":Description>" + NEWLINE);
+    }
+  }
+
+  /**
+   * Writes the opening tag for the subject
+   *
+   * @param graph JRDFGraph
+   * @param subject SubjectNode
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeClosingTag(Graph graph, SubjectNode subject,
+                                 PrintWriter writer) throws
+      GraphException {
+
+    //Blank Nodes are written differently
+    if (subject instanceof BlankNode) {
+
+      this.writeClosingTag(graph, (BlankNode) subject, writer);
+    }
+    else {
+
+      //closing tag
+      writer.print("  </" + RDF_PREFIX + ":Description>" + NEWLINE);
+    }
+  }
+
+  /**
+   * Writes the opening tag for the subject
+   *
+   * @param graph JRDFGraph
+   * @param subject SubjectNode
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeClosingTag(Graph graph, BlankNode subject,
+                                 PrintWriter writer) throws
+      GraphException {
+
+    ObjectNode subjectType = this.getSubjectType(graph, subject);
+
+    //only display as a subject if it can be found
+    if (subjectType != null) {
+
+      //closing tag
+      writer.print("  </" + this.getURI(subjectType) + ">" + NEWLINE);
+    }
+    else {
+
+      //closing tag
+      writer.print("  </" + RDF_PREFIX + ":Description>" + NEWLINE);
+    }
+  }
+
+  /**
+   * Writes the Resources for a subject (one per line).
+   *
+   * eg. <predicateURI rdf:resource="resourceURI"/>
+   * (<predicateURI rdf:nodeID="resourceURI"/> for Blank Nodes)
+   *
+   * @param graph Graph
+   * @param subject SubjectNode
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeSubjectBody(Graph graph, SubjectNode subject,
+                                  PrintWriter writer) throws GraphException {
+
+    //validate graph
+    /*
+    if (! (graph instanceof JRDFGraph)) {
+
+      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
+    }
+    */
+
+    //get all statements for the Subject
+    //statements are sorted by predicate (for sequences).
+    List orderList = new ArrayList();
+    ClosableIterator tripleIter = graph.find(subject, null, null);
+
+    if (tripleIter != null) {
+
+      //current Triple
+      Object triple = null;
+
+      //current predicate
+      PredicateNode predicate = null;
+
+      //current object (URIReference)
+      ObjectNode object = null;
+
+      //evaluate all triples
+      while (tripleIter.hasNext()) {
+
+        triple = tripleIter.next();
+
+        //validate triple
+        if ( (triple != null)
+            && (triple instanceof Triple)) {
+
+          //retrieve Predicate and Object
+          predicate = ( (Triple) triple).getPredicate();
+          object = ( (Triple) triple).getObject();
+
+          //Literals and Resources are written differently
+          if (object != null) {
+
+            this.writeStatement(graph, subject, predicate, object, writer);
+          }
+        }
+      }
+
+      //close the Iterator
+      tripleIter.close();
+    }
+  }
+
+  /**
+   * Used to write Resources for a Subject. Literals will by-pass this method
+   * and use "Literal" method.
+   *
+   * @param predicate PredicateNode
+   * @param object ObjectNode
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeStatement(Graph graph, SubjectNode subject,
+                                PredicateNode predicate, ObjectNode object,
+                                PrintWriter writer) throws GraphException {
+
+    //Literals are written differently
+    if (object instanceof Literal) {
+
+      this.writeStatement(graph, subject, predicate, (Literal) object, writer);
+    }
+    else if (object instanceof BlankNode) {
+
+      //write as:  <predicateURI> *blank node as subject* </predicateURI>
+      writer.println("    <" + this.getURI(predicate) + ">");
+
+      //write blank node as a "subject"
+      this.writeSubject(graph, (BlankNode) object, writer);
+
+      writer.println("    </" + this.getURI(predicate) + ">");
+    }
+    else if (subject instanceof BlankNode) {
+
+      //predicatNode representing RDF Type
+      PredicateNode rdfTypeNode = null;
+
+      try {
+
+        rdfTypeNode = graph.getElementFactory().createResource(RDF.TYPE);
+      }
+      catch (GraphElementFactoryException factoryException) {
+
+        throw new GraphException("Could not create RDF Type node.",
+                                 factoryException);
+      }
+
+      //do not write the RDF Type element
+      if (!rdfTypeNode.equals(predicate)) {
+
+        //write as:  <predicateURI rdf:resource="resourceURI"/>
+        writer.println("    <" + this.getURI(predicate) + " " + RDF_PREFIX +
+                       ":resource=\"" + this.getNodeString(object) + "\"" +
+                       "/>");
+      }
+    }
+    else {
+
+      //write as:  <predicateURI rdf:resource="resourceURI"/>
+      writer.println("    <" + this.getURI(predicate) + " " + RDF_PREFIX +
+                     ":resource=\"" + this.getNodeString(object) + "\"" +
+                     "/>");
+    }
+  }
+
+  /**
+   * Used to write Resources for a Subject. Resources will use "ObjectNode"
+   * method.
+   *
+   * @param predicate PredicateNode
+   * @param object Literal
+   * @param writer PrintWriter
+   * @throws GraphException
+   */
+  protected void writeStatement(Graph graph, SubjectNode subject,
+                                PredicateNode predicate, Literal object,
+                                PrintWriter writer) throws GraphException {
+
+    //determine if the Literal has a datatype
+    URI datatype = object.getDatatypeURI();
+
+    // Get the lexical form of the literal
+    String literalObject = object.getLexicalForm();
+
+    // Create the StringBuffer to hold the resultant string
+    StringBuffer buffer = new StringBuffer();
+
+    // Escape the XML string
+    StringUtil.quoteAV(literalObject, buffer);
+
+    if (datatype != null) {
+
+      //write as:  <predicateURI rdf:datatype="datatype">"Literal value"
+      //           </predicateURI>
+      writer.println("    <" + this.getURI(predicate) + " " + RDF_PREFIX +
+                     ":datatype=\"" + datatype + "\">" +
+                     buffer.toString() +
+                     "</" + this.getURI(predicate) + ">");
+    }
+    else {
+
+      //write as:  <predicateURI>"Literal value"</predicateURI>
+      writer.println("    <" + this.getURI(predicate) + ">" +
+                     buffer.toString() + "</" +
+                     this.getURI(predicate) + ">");
+    }
+  }
+
+  /**
+   * Finds the RDF Type for a given subject.
+   *
+   * @param graph Graph
+   * @param subject SubjectNode
+   * @throws GraphException
+   * @return ObjectNode
+   */
+  protected ObjectNode getSubjectType(Graph graph, SubjectNode subject) throws
+      GraphException {
+
+    //value to be returned
+    ObjectNode type = null;
+
+    //validate graph
+    if ( (graph == null)) {
+
+      throw new IllegalArgumentException("Graph argument must not be null.");
+    }
+
+    //predicatNode representing RDF Type
+    PredicateNode rdfType = null;
+
+    try {
+
+      rdfType = graph.getElementFactory().createResource(RDF.TYPE);
+    }
+    catch (GraphElementFactoryException factoryException) {
+
+      throw new GraphException("Could not create RDF Type node.",
+                               factoryException);
+    }
+
+    //get the Subject's RDF type
+    ClosableIterator typeIter = graph.find(subject, rdfType, null);
+
+    if (typeIter != null) {
+
+      Object typeTriple = null;
+
+      //validate "first" triple and extract it's object (rdf type)
+      if (typeIter.hasNext()) {
+
+        typeTriple = typeIter.next();
+
+        if ( (typeTriple != null)
+            && (typeTriple instanceof Triple)) {
+
+          type = ( (Triple) typeTriple).getObject();
+        }
+        else {
+
+          throw new GraphException("Could not find RDF type for Subject: " +
+                                   subject + " . Invalid Triple returned.");
+        }
+      }
+
+      //close the Iterator
+      typeIter.close();
+    }
+
+    return type;
+  }
+
+  /**
+   * Returns a URI that represents the Node.
+   *
+   * @param node the node representing the URI.
+   * @throws GraphException
+   * @return URI
+   */
+  protected String getURI(Node node) throws GraphException {
+
+    //value to be returned
+    String uri = null;
+
+    //determine type of subject node and create uri from it
+    if (node != null) {
+
+      try {
+
+        if (node instanceof URIReference) {
+
+          uri = ( (URIReference) node).getURI().toString();
+        }
+        else if (node instanceof BlankNode) {
+
+          uri = new URI("#" + ( (BlankNode) node).toString()).toString();
+        }
+        else {
+
+          uri = node.toString();
+        }
+      }
+      catch (URISyntaxException uriException) {
+
+        throw new GraphException("Could not get URI for Node: " + node +
+                                 ".", uriException);
+      }
+    }
+    else {
+
+      throw new GraphException("Could not get URI for Node: " + node +
+                               ". Node is null.");
+    }
+
+    //return the URI with any namespaces replaced with prefixes
+    return this.replaceNamespace(uri);
+  }
+
+  /**
+   * Returns a String representation of an ObjectNode. Object values do not have
+   * to be escaped.
+   *
+   * @param node Node
+   * @throws GraphException
+   * @return String
+   */
+  protected String getNodeString(Node node) throws GraphException {
+
+    //value to be returned
+    String object = null;
+
+    //determine type of subject node and create uri from it
+    if (node != null) {
+
+      try {
+
+        if (node instanceof URIReference) {
+
+          object = ( (URIReference) node).getURI().toString();
+        }
+        else if (node instanceof BlankNode) {
+
+          object = new URI("#" + ( (BlankNode) node).toString()).toString();
+        }
+        else if (node instanceof Literal) {
+
+          object = ((Literal) node).getLexicalForm();
+        } else {
+
+          object = node.toString();
+        }
+      }
+      catch (URISyntaxException uriException) {
+
+        throw new GraphException("Could not get String for ObjectNode: " + node +
+                                 ".", uriException);
+      }
+    }
+    else {
+
+      throw new GraphException("Could not get String for ObjectNode: " + node +
+                               ". ObjectNode is null.");
+    }
+
+    return object;
+  }
+
+  /**
+   * If the URI contains the URI of a known namespace, it is replaced.
+   *
+   * @param original original URI.
+   * @return new URI with namespace references.
+   */
+  protected String replaceNamespace(String original) throws GraphException {
+
+    //value to be returned
+    String uri = original;
+
+    //validate URI (only replace uri's with fragments)
+    if (original != null) {
+
+      //replace any URI occurances with namespace prefixes
+      Set keys = this.namespaces.keySet();
+
+      Iterator keyIter = keys.iterator();
+      Object currentKey = null;
+      Object currentValue = null;
+
+      if (keyIter != null) {
+
+        while (keyIter.hasNext()) {
+
+          currentKey = keyIter.next();
+          currentValue = this.namespaces.get(currentKey);
+
+          //validate the Objects
+          if ( (currentKey != null)
+              && (currentValue != null)) {
+
+//            int index = uriAsString.indexOf(currentValue.toString());
+            //if the entire namespace is used, replace it with an entity
+            if (original.equals(currentValue.toString())) {
+
+              uri = "&" + currentKey + ";";
+            }
+            else if (original.startsWith(currentValue.toString())) {
+
+              //replace with namespace
+              uri = original.replaceAll(currentValue.toString(),
+                                        currentKey + ":");
+            }
+          }
+        }
+      }
+    }
+
+    //return the URI with any collection/container items renamed
+    return replaceCollection(uri);
+  }
+
+  /**
+   * If the URI has a fragment representing a collection (eg. Bag) item, it is
+   * replaced with li.
+   *
+   * @param original original URI.
+   * @return new URI with any necessary li.
+   */
+  protected String replaceCollection(String original) throws GraphException {
+
+    //value to be returned
+    String uri = original;
+
+    //validate URI
+    if (original != null) {
+
+      uri = original.replaceAll("_[0-9]+", "li");
+
+    }
+
+    return uri;
+  }
+
+  /**
+   * Populates the namespaces map with default namespaces and namespaces used
+   * by the graph.
+   *
+   * @param graph Graph
+   * @throws GraphException
+   */
+  protected void populateNamespaces(Graph graph) throws GraphException {
+
+    //default namespaces
+    this.namespaces = new HashMap();
+    this.namespaces.put(RDF_PREFIX, RDF.BASE_URI);
+    this.namespaces.put(RDFS_PREFIX, RDFS.BASE_URI);
+    this.namespaces.put("owl", "http://www.w3.org/2002/07/owl#");
+    this.namespaces.put("dc", "http://purl.org/dc/elements/1.1/");
+
+    //validate graph before reading
+    if (graph == null) {
+
+      throw new IllegalArgumentException("Graph argument is null.");
+    }
+
+    //get all statements
+    ClosableIterator tripleIter = graph.find(null, null, null);
+
+    if (tripleIter != null) {
+
+      //current Triple/Predicate
+      Triple triple = null;
+      SubjectNode subject = null;
+      PredicateNode predicate = null;
+      ObjectNode object = null;
+
+      while (tripleIter.hasNext()) {
+
+        //get the next triple
+        triple = (Triple) tripleIter.next();
+
+        if (triple != null) {
+
+          //evaluate subject
+          subject = triple.getSubject();
+          if (subject instanceof URIReference) {
+
+            this.addNamespaceURI(((URIReference) subject).getURI());
+          }
+
+          //evaluate predicate (must be URIReference)
+          predicate = triple.getPredicate();
+          this.addNamespaceURI(((URIReference) predicate).getURI());
+
+          //evaluate object
+          object = triple.getObject();
+          if (object instanceof URIReference) {
+
+            this.addNamespaceURI(((URIReference) object).getURI());
+          }
+        }
+      }
+
+      //close the Iterator
+      tripleIter.close();
+    }
+  }
+
+  /**
+   * Populates the namespaces map with default namespaces and namespaces used
+   * by the graph.
+   *
+   * @param graph Graph
+   * @throws GraphException
+   */
+/*  protected void populateNamespaces(Graph graph) throws GraphException {
+
+    //validate graph
+    if (! (graph instanceof JRDFGraph)) {
+
+      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
+    }
+
+    //default namespaces
+    this.namespaces = new HashMap();
+    this.namespaces.put(RDF_PREFIX, RDF.baseURI);
+    this.namespaces.put(RDFS_PREFIX, RDFS.baseURI);
+    this.namespaces.put("owl", "http://www.w3.org/2002/07/owl#");
+    this.namespaces.put("dc", "http://purl.org/dc/elements/1.1/");
+
+    //validate graph before reading
+    if (graph == null) {
+
+      throw new IllegalArgumentException("Graph argument is null.");
+    }
+
+    //iterator used to access predicates
+    ClosableIterator predicateIter = ( (JRDFGraph) graph).getUniquePredicates();
+
+    if (predicateIter != null) {
+
+      //current Triple/Predicate
+      Object triple = null;
+      PredicateNode predicate = null;
+      String predicateURI = null;
+
+      while (predicateIter.hasNext()) {
+
+        //get the next triple
+        triple = predicateIter.next();
+
+        if ( (triple != null)
+            && (triple instanceof Triple)) {
+
+          //get the predicate and evaluate
+          predicate = ( (Triple) triple).getPredicate();
+          predicateURI = this.getURI(predicate);
+
+          //add the namespace
+          try {
+
+            this.addNamespaceURI(new URI(predicateURI));
+          }
+          catch (URISyntaxException uriException) {
+
+            throw new GraphException("Could not add Namespace: " + predicateURI,
+                                     uriException);
+          }
+        }
+      }
+
+      //close the Iterator
+      predicateIter.close();
+    }
+  } */
+
+  /**
+   * Evaluates a URI and adds it to the namespace map as a namespace.
+   *
+   * @param uri URI
+   */
+  protected void addNamespaceURI(URI uri) {
+
+    if (uri == null) {
+
+      throw new IllegalArgumentException("URI argument is null.");
+    }
+
+    //extract URI without fragment
+    String uriString = uri.toString();
+    String newURI = null;
+
+    if (uriString != null) {
+
+      //determine what comes last a '#' or '/'
+      int hashindex = uriString.lastIndexOf('#');
+      int slashindex = uriString.lastIndexOf('/');
+
+      //validate (URI must contain a forward slash)
+      if (slashindex == -1) {
+
+        //namespace may have been evaluated already
+        return;
+      }
+
+      //is there a '/' after the '#'?
+      if (slashindex > hashindex) {
+
+        //remove everything after the last '/'
+        int index = uriString.lastIndexOf('/');
+        newURI = uriString.substring(0, index) + "/";
+      }
+      else {
+
+        //'#' comes after last '/' (remove entire fragment)
+        newURI = uriString.replaceAll(uri.getFragment(), "");
+      }
+
+      //only add namespace if it is new
+      if ( (newURI != null)
+          && (!this.namespaces.containsValue(newURI))) {
+
+        //add to namespaces
+        this.namespaces.put("ns" + this.namespaces.size(), newURI);
+      }
+    }
+  }
+}


Property changes on: trunk/src/jar/resolver/java/org/mulgara/store/exporter/GraphXMLWriter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelN3Writer.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelN3Writer.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelN3Writer.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,204 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-package org.mulgara.store.exporter;
-
-// Java 2 standard packages
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-// Apache packages
-import org.apache.log4j.Logger;
-
-// JRDF
-import org.jrdf.vocabulary.*;
-
-// Local packages
-import org.jrdf.graph.GraphException;
-import org.jrdf.util.ClosableIterator;
-import org.jrdf.graph.*;
-import org.mulgara.store.*;
-
-/**
- * A Writer used to write N3 for a Mulgara model.
- *
- * @created 2004-07-26
- *
- * @author <a href="mailto:pag at pisoftware.com">Paul Gearon</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:25 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelN3Writer implements ModelWriter {
-
-  /**
-   * Logger. This is named after the class.
-   */
-  private final static Logger log = Logger.getLogger(ModelN3Writer.class.
-      getName());
-
-
-  /**
-   * Default Constructor
-   */
-  public ModelN3Writer() {
-  }
-
-
-  /**
-   * Writes the contents of the JRDFGraph to a PrintWriter in N3 format.
-   *
-   * @param graph Graph Graph containing the Statements to be written.
-   * @param writer PrintWriter Where to write the statements.
-   * @throws GraphException
-   */
-  synchronized public void write(Graph graph, PrintWriter writer) throws
-      GraphException {
-
-    //write Header, Body and Footer
-    try {
-
-      //write document
-      writeHeader(writer);
-      writeBody(graph, writer);
-    }
-    catch (IOException ioException) {
-
-      throw new GraphException("Could not write Model.", ioException);
-    }
-  }
-
-
-  /**
-   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format
-   * with the encoding specified in the opening XML tag.
-   *
-   * @param graph Graph Graph containing the Statements to be written.
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  synchronized public void write(Graph graph, OutputStreamWriter writer)
-      throws GraphException {
-
-    //wrap writer and enable auto flushing
-    PrintWriter out = new PrintWriter(writer, true);
-
-    write(graph, out);
-  }
-
-
-  /**
-   * Writes any desired comments as a header.
-   *
-   * @param out the writer to use to output.
-   * @throws IOException if there was an IO exception.
-   * @throws IllegalArgumentException if the given writer is null.
-   */
-  private void writeHeader(PrintWriter out) throws IOException {
-
-    //validate
-    if (out != null) {
-      out.println("# Mulgara graph in N3");
-    } else {
-      throw new IllegalArgumentException("Cannot write to null Writer.");
-    }
-  }
-
-
-  /**
-   * Writes the Model's statements as N3 to the print Writer.
-   *
-   * @param graph Graph Graph containing the Statements to be written.
-   * @param out PrintWriter
-   * @throws IOException
-   */
-  private void writeBody(Graph graph, PrintWriter out) throws IOException,
-      GraphException {
-
-    //validate
-    if ( (out != null)
-        && (graph != null)) {
-
-      // iterator to access entire graph
-      ClosableIterator graphIter = graph.find(null, null, null);
-
-      while (graphIter.hasNext()) {
-        // extract the triple
-        Triple triple = (Triple)graphIter.next();
-        SubjectNode s = triple.getSubject();
-        PredicateNode p = triple.getPredicate();
-        ObjectNode o = triple.getObject();
-
-        out.println("<" + s.toString() + "> <" + ((URIReference)p).getURI().toString() + "> "+ getLabel(o));
-      }
-
-    } else {
-
-      //message for exception to be thrown
-      String message = "Could not write Model. Invlaid arguments provided. ";
-
-      if (out == null) {
-        message += "Writer is null. ";
-      }
-
-      if (graph == null) {
-        message += "Graph is null. ";
-      }
-
-      throw new IllegalArgumentException(message);
-    }
-  }
-
-
-  /**
-   * Formats an object node appropriately at either a literal or a resource.
-   * For efficiency, a line termination character is appended.
-   *
-   * @param node The object node to format
-   * @throws GraphException
-   */
-  private String getLabel(ObjectNode node) {
-    if (node instanceof Literal) {
-      return "\"" + ((Literal)node).getLexicalForm() + "\" .";
-    } else if (node instanceof URIReference) {
-      return "<" + ((URIReference)node).getURI().toString() + "> .";
-    }
-    // node is a blank node
-    return "<" + node.toString() + "> .";
-  }
-
-}

Deleted: trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelWriter.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelWriter.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelWriter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,77 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-package org.mulgara.store.exporter;
-
-// Java 2 standard packages
-import java.io.*;
-
-// Local packages
-import org.jrdf.graph.GraphException;
-import org.jrdf.graph.Graph;
-
-/**
- * A Writer used to write a serialization for a Mulgara model.
- *
- * @created 2004-02-23
- *
- * @author <a href="mailto:pag at tucanatech.com">Paul Gearon</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:25 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public interface ModelWriter {
-
-  /**
-   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format.
-   *
-   * @param graph JRDF Graph containing the Statements to be written.
-   * @param writer PrintWriter Where to write the statements.
-   * @throws GraphException
-   */
-  public void write(Graph graph, PrintWriter writer) throws GraphException;
-
-  /**
-   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format
-   * with the encoding specified in the opening XML tag.
-   *
-   * @param graph JRDF Graph
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  public void write(Graph graph, OutputStreamWriter writer) throws GraphException;
-
-}

Deleted: trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelXMLWriter.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelXMLWriter.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver/java/org/mulgara/store/exporter/ModelXMLWriter.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,1143 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-package org.mulgara.store.exporter;
-
-// Java 2 standard packages
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-// Apache packages
-import org.apache.log4j.Logger;
-import org.apache.xerces.util.EncodingMap;
-
-// JRDF
-import org.jrdf.graph.GraphException;
-import org.jrdf.util.ClosableIterator;
-import org.jrdf.vocabulary.*;
-
-// Local packages
-/*
-import org.mulgara.resolver.jrdf.ClosableIteratorImpl;
-import org.mulgara.resolver.jrdf.JRDFGraph;
-*/
-import org.jrdf.graph.*;
-import org.mulgara.query.Order;
-import org.mulgara.query.Value;
-import org.mulgara.store.*;
-import org.mulgara.store.statement.StatementStore;
-import org.mulgara.store.tuples.RowComparator;
-import org.mulgara.util.*;
-
-/**
- * A Writer used to write RDF/XML for a Mulgara model.
- *
- * @created 2004-02-20
- *
- * @author <a href="mailto:robert.turner at tucanatech.com">Robert Turner</a>
- *
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:25 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
- * @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
- * @copyright &copy;2001 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- *
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-public class ModelXMLWriter
-    implements ModelWriter {
-
-  /**
-   * Logger. This is named after the class.
-   */
-  private final static Logger log = Logger.getLogger(ModelXMLWriter.class.
-      getName());
-
-  /** Prefix used to abbreviate RDF Namespace */
-  private static final String RDF_PREFIX = "rdf";
-
-  /** Prefix used to abbreviate RDFS Namespace */
-  private static final String RDFS_PREFIX = "rdfs";
-
-  /** Convenience reference to the new line character */
-  private static final String NEWLINE = System.getProperty("line.separator");
-
-  /** Map used to replace commonly used namespaces with prefixes */
-  protected Map namespaces = null;
-
-  /**
-   * Default Constructor
-   */
-  public ModelXMLWriter() {
-  }
-
-  /**
-   * Writes the contents of the JRDFGraph to a PrintWriter in RDF/XML format.
-   *
-   * @param graph JRDFGraph Graph containing the Statements to be written.
-   * @param writer PrintWriter Where to write the statements.
-   * @throws GraphException
-   */
-  synchronized public void write(Graph graph, PrintWriter writer) throws
-      GraphException {
-
-    /*
-    if (! (graph instanceof JRDFGraph)) {
-      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
-    }
-    */
-
-    //write Header, Body and Footer
-    try {
-
-      //initialize the namespaces first
-      this.populateNamespaces(graph);
-
-      //write document
-      this.writeHeader(writer);
-      this.writeBody(graph, writer);
-      this.writeFooter(writer);
-    }
-    catch (IOException ioException) {
-
-      throw new GraphException("Could not write Model.", ioException);
-    }
-  }
-
-  /**
-   * Writes the contents of the JRDF Graph to a PrintWriter in RDF/XML format
-   * with the encoding specified in the opening XML tag.
-   *
-   * @param graph JRDFGraph
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  synchronized public void write(Graph graph, OutputStreamWriter writer) throws
-      GraphException {
-
-    /*
-    if (! (graph instanceof JRDFGraph)) {
-      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
-    }
-    */
-
-    //write Header, Body and Footer
-    try {
-
-      //wrap writer and enable auto flushing
-      PrintWriter out = new PrintWriter(writer, true);
-
-      //initialize the namespaces first
-      this.populateNamespaces(graph);
-
-      //write document
-      this.writeHeader(writer);
-      this.writeBody(graph, out);
-      this.writeFooter(out);
-    }
-    catch (IOException ioException) {
-
-      throw new GraphException("Could not write Model.", ioException);
-    }
-  }
-
-  /**
-   * Writes the XML Declaration and the opening RDF tag to the print Writer.
-   * Encoding not specified.
-   *
-   * @param out PrintWriter
-   * @throws IOException
-   */
-  protected void writeHeader(PrintWriter out) throws IOException {
-
-    //validate
-    if (out != null) {
-
-      //print opening tags
-      out.println("<?xml version=\"1.0\"?>");
-
-      //print the opening RDF tag (including namespaces)
-      this.writeRDFHeader(out);
-    }
-    else {
-
-      throw new IllegalArgumentException("Cannot write to null Writer.");
-    }
-  }
-
-  /**
-   * Writes the XML Declaration and the opening RDF tag to the print Writer.
-   * Encoding attribute is specified as the encoding argument.
-   *
-   * @param out PrintWriter
-   * @throws IOException
-   */
-  protected void writeHeader(OutputStreamWriter out) throws IOException {
-
-    //validate
-    if (out != null) {
-
-      //wrapper for output stream writer (enable autoflushing)
-      PrintWriter writer = new PrintWriter(out, true);
-
-      //get encoding from the Encoding map
-      String encoding = EncodingMap.getJava2IANAMapping(out.getEncoding());
-
-      //only insert encoding if there is a value
-      if (encoding != null) {
-
-        //print opening tags <?xml version="1.0" encoding=*encoding*?>
-        writer.println("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>");
-      }
-      else {
-
-        //print opening tags <?xml version="1.0"?>
-        writer.println("<?xml version=\"1.0\"?>");
-      }
-
-      //print the Entities
-      this.writeXMLEntities(writer);
-
-      //print the opening RDF tag (including namespaces)
-      this.writeRDFHeader(writer);
-    }
-    else {
-
-      throw new IllegalArgumentException("Cannot write to null Writer.");
-    }
-  }
-
-  /**
-   * Writes the XML Entities (used for namespaces) to the print Writer.
-   *
-   * @param out PrintWriter
-   * @throws IOException
-   */
-  protected void writeXMLEntities(PrintWriter out) throws IOException {
-
-    //validate
-    if (out != null) {
-
-      //print opening DOCTYPE DECLARATION tag
-      out.print(NEWLINE + "<!DOCTYPE rdf:RDF [");
-
-      //print namespaces
-      Set keys = this.namespaces.keySet();
-
-      if (keys != null) {
-
-        Iterator keyIter = keys.iterator();
-        Object currentKey = null;
-        Object currentValue = null;
-
-        while (keyIter.hasNext()) {
-
-          currentKey = keyIter.next();
-          currentValue = this.namespaces.get(currentKey);
-
-          if ( (currentKey != null)
-              && (currentValue != null)) {
-
-            //write as: <!ENTITY ns 'http://example.org/abc#'>
-            out.print(NEWLINE + "  <!ENTITY " + currentKey + " '" +
-                      currentValue + "'>");
-          }
-        }
-      }
-
-      //close the opening tag (add a space for readability)
-      out.print("]>" + NEWLINE + NEWLINE);
-    }
-    else {
-
-      throw new IllegalArgumentException("Cannot write to null Writer.");
-    }
-  }
-
-  /**
-   * Writes the opening RDF tag (with namespaces) to the print Writer.
-   *
-   * @param out PrintWriter
-   * @throws IOException
-   */
-  protected void writeRDFHeader(PrintWriter out) throws IOException {
-
-    //validate
-    if (out != null) {
-
-      //print opening RDF tag (including namespaces)
-      out.print("<rdf:RDF ");
-
-      //print namespaces
-      Set keys = this.namespaces.keySet();
-
-      if (keys != null) {
-
-        Iterator keyIter = keys.iterator();
-        Object currentKey = null;
-        Object currentValue = null;
-
-        while (keyIter.hasNext()) {
-
-          currentKey = keyIter.next();
-          currentValue = this.namespaces.get(currentKey);
-
-          if ( (currentKey != null)
-              && (currentValue != null)) {
-
-           //use entities: xmlns:ns="&ns;"
-            out.print(NEWLINE + "  xmlns:" + currentKey + "=\"&" + currentKey +
-                      ";\"");
-          }
-        }
-      }
-
-      //close the opening tag (add a space for readability)
-      out.print(">" + NEWLINE + NEWLINE);
-    }
-    else {
-
-      throw new IllegalArgumentException("Cannot write to null Writer.");
-    }
-  }
-
-  /**
-   * Writes the Model's statements as RDF/XML to the print Writer.
-   *
-   * @param out PrintWriter
-   * @throws IOException
-   */
-  protected void writeBody(Graph graph, PrintWriter out) throws IOException,
-      GraphException {
-
-    //validate
-    if ( (out != null)
-        && (graph != null)) {
-
-      //iterator used to access subjects
-      ClosableIterator subjectIter = graph.find(null, null, null);
-
-      //write every (unique) subject
-      if (subjectIter != null) {
-
-        //current Triple
-        Object triple = null;
-
-        //current Subject
-        SubjectNode subject = null;
-
-        Set writtenSubjectSet = new HashSet();
-
-        while (subjectIter.hasNext()) {
-
-          //get the next triple
-          triple = subjectIter.next();
-
-          if ( (triple != null)
-              && (triple instanceof Triple)) {
-
-            subject = ( (Triple) triple).getSubject();
-
-            if (!writtenSubjectSet.contains(subject)) {
-              this.writeSubject(graph, subject, out);
-              writtenSubjectSet.add(subject);
-            }
-          }
-        }
-
-        //close the Iterator
-        subjectIter.close();
-      }
-    }
-    else {
-
-      //message for exception to be thrown
-      String message = "Could not write Model. Invlaid arguments provided. ";
-
-      if (out == null) {
-
-        message += "Writer is null. ";
-      }
-      if (graph == null) {
-
-        message += "Graph is null. ";
-      }
-
-      throw new IllegalArgumentException(message);
-    }
-  }
-
-  /**
-   * Writes the closing RDF tag to the writer.
-   *
-   * @param out PrintWriter
-   * @throws IOException
-   */
-  protected void writeFooter(PrintWriter out) throws IOException {
-
-    //validate
-    if (out != null) {
-
-      //print closing RDF tag
-      out.println("</" + RDF_PREFIX + ":RDF>");
-    }
-    else {
-
-      throw new IllegalArgumentException("Cannot write to null Writer.");
-    }
-  }
-
-  /**
-   * Writes a Subject to the writer
-   *
-   * @param graph JRDFGraph
-   * @param subject SubjectNode
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeSubject(Graph graph, SubjectNode subject,
-                              PrintWriter writer) throws GraphException {
-
-    //opening subject tag (includes literals)
-    this.writeOpeningTag(graph, subject, writer);
-
-    //subject contents
-    this.writeSubjectBody(graph, subject, writer);
-
-    //closing subject tag
-    this.writeClosingTag(graph, subject, writer);
-
-    //put a space between Subjects
-    writer.println("");
-  }
-
-  /**
-   * Writes the opening tag for the subject
-   *
-   * @param graph JRDFGraph
-   * @param subject SubjectNode
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeOpeningTag(Graph graph, SubjectNode subject,
-                                 PrintWriter writer) throws
-      GraphException {
-
-    if (writer != null) {
-
-      //write the subject type and rdf:about
-      if (subject != null) {
-
-        //open tag - BlankNodes are a special case
-        if (subject instanceof BlankNode) {
-
-          this.writeOpeningTag(graph, (BlankNode) subject, writer);
-        }
-        else {
-
-          writer.print("  <" + RDF_PREFIX + ":Description " + RDF_PREFIX +
-                       ":about=\"" + this.getNodeString(subject) + "\">" +
-                       NEWLINE);
-        }
-      }
-      else {
-
-        throw new IllegalArgumentException("Could not write opening tag for " +
-                                           "subject. Subject Node is null.");
-      }
-    }
-  }
-
-  /**
-   * Writes the opening tag for a blank node.
-   *
-   * @param graph JRDFGraph
-   * @param subject BlankNode
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeOpeningTag(Graph graph, BlankNode subject,
-                                 PrintWriter writer) throws GraphException {
-
-    ObjectNode subjectType = this.getSubjectType(graph, subject);
-
-    //only display as a subject if it can be found
-    if (subjectType != null) {
-
-      //opening tag
-      writer.print("  <" + this.getURI(subjectType) + ">" + NEWLINE);
-    }
-    else {
-
-      //opening tag
-      writer.print("  <" + RDF_PREFIX + ":Description>" + NEWLINE);
-    }
-  }
-
-  /**
-   * Writes the opening tag for the subject
-   *
-   * @param graph JRDFGraph
-   * @param subject SubjectNode
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeClosingTag(Graph graph, SubjectNode subject,
-                                 PrintWriter writer) throws
-      GraphException {
-
-    //Blank Nodes are written differently
-    if (subject instanceof BlankNode) {
-
-      this.writeClosingTag(graph, (BlankNode) subject, writer);
-    }
-    else {
-
-      //closing tag
-      writer.print("  </" + RDF_PREFIX + ":Description>" + NEWLINE);
-    }
-  }
-
-  /**
-   * Writes the opening tag for the subject
-   *
-   * @param graph JRDFGraph
-   * @param subject SubjectNode
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeClosingTag(Graph graph, BlankNode subject,
-                                 PrintWriter writer) throws
-      GraphException {
-
-    ObjectNode subjectType = this.getSubjectType(graph, subject);
-
-    //only display as a subject if it can be found
-    if (subjectType != null) {
-
-      //closing tag
-      writer.print("  </" + this.getURI(subjectType) + ">" + NEWLINE);
-    }
-    else {
-
-      //closing tag
-      writer.print("  </" + RDF_PREFIX + ":Description>" + NEWLINE);
-    }
-  }
-
-  /**
-   * Writes the Resources for a subject (one per line).
-   *
-   * eg. <predicateURI rdf:resource="resourceURI"/>
-   * (<predicateURI rdf:nodeID="resourceURI"/> for Blank Nodes)
-   *
-   * @param graph Graph
-   * @param subject SubjectNode
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeSubjectBody(Graph graph, SubjectNode subject,
-                                  PrintWriter writer) throws GraphException {
-
-    //validate graph
-    /*
-    if (! (graph instanceof JRDFGraph)) {
-
-      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
-    }
-    */
-
-    //get all statements for the Subject
-    //statements are sorted by predicate (for sequences).
-    List orderList = new ArrayList();
-    ClosableIterator tripleIter = graph.find(subject, null, null);
-
-    if (tripleIter != null) {
-
-      //current Triple
-      Object triple = null;
-
-      //current predicate
-      PredicateNode predicate = null;
-
-      //current object (URIReference)
-      ObjectNode object = null;
-
-      //evaluate all triples
-      while (tripleIter.hasNext()) {
-
-        triple = tripleIter.next();
-
-        //validate triple
-        if ( (triple != null)
-            && (triple instanceof Triple)) {
-
-          //retrieve Predicate and Object
-          predicate = ( (Triple) triple).getPredicate();
-          object = ( (Triple) triple).getObject();
-
-          //Literals and Resources are written differently
-          if (object != null) {
-
-            this.writeStatement(graph, subject, predicate, object, writer);
-          }
-        }
-      }
-
-      //close the Iterator
-      tripleIter.close();
-    }
-  }
-
-  /**
-   * Used to write Resources for a Subject. Literals will by-pass this method
-   * and use "Literal" method.
-   *
-   * @param predicate PredicateNode
-   * @param object ObjectNode
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeStatement(Graph graph, SubjectNode subject,
-                                PredicateNode predicate, ObjectNode object,
-                                PrintWriter writer) throws GraphException {
-
-    //Literals are written differently
-    if (object instanceof Literal) {
-
-      this.writeStatement(graph, subject, predicate, (Literal) object, writer);
-    }
-    else if (object instanceof BlankNode) {
-
-      //write as:  <predicateURI> *blank node as subject* </predicateURI>
-      writer.println("    <" + this.getURI(predicate) + ">");
-
-      //write blank node as a "subject"
-      this.writeSubject(graph, (BlankNode) object, writer);
-
-      writer.println("    </" + this.getURI(predicate) + ">");
-    }
-    else if (subject instanceof BlankNode) {
-
-      //predicatNode representing RDF Type
-      PredicateNode rdfTypeNode = null;
-
-      try {
-
-        rdfTypeNode = graph.getElementFactory().createResource(RDF.TYPE);
-      }
-      catch (GraphElementFactoryException factoryException) {
-
-        throw new GraphException("Could not create RDF Type node.",
-                                 factoryException);
-      }
-
-      //do not write the RDF Type element
-      if (!rdfTypeNode.equals(predicate)) {
-
-        //write as:  <predicateURI rdf:resource="resourceURI"/>
-        writer.println("    <" + this.getURI(predicate) + " " + RDF_PREFIX +
-                       ":resource=\"" + this.getNodeString(object) + "\"" +
-                       "/>");
-      }
-    }
-    else {
-
-      //write as:  <predicateURI rdf:resource="resourceURI"/>
-      writer.println("    <" + this.getURI(predicate) + " " + RDF_PREFIX +
-                     ":resource=\"" + this.getNodeString(object) + "\"" +
-                     "/>");
-    }
-  }
-
-  /**
-   * Used to write Resources for a Subject. Resources will use "ObjectNode"
-   * method.
-   *
-   * @param predicate PredicateNode
-   * @param object Literal
-   * @param writer PrintWriter
-   * @throws GraphException
-   */
-  protected void writeStatement(Graph graph, SubjectNode subject,
-                                PredicateNode predicate, Literal object,
-                                PrintWriter writer) throws GraphException {
-
-    //determine if the Literal has a datatype
-    URI datatype = object.getDatatypeURI();
-
-    // Get the lexical form of the literal
-    String literalObject = object.getLexicalForm();
-
-    // Create the StringBuffer to hold the resultant string
-    StringBuffer buffer = new StringBuffer();
-
-    // Escape the XML string
-    StringUtil.quoteAV(literalObject, buffer);
-
-    if (datatype != null) {
-
-      //write as:  <predicateURI rdf:datatype="datatype">"Literal value"
-      //           </predicateURI>
-      writer.println("    <" + this.getURI(predicate) + " " + RDF_PREFIX +
-                     ":datatype=\"" + datatype + "\">" +
-                     buffer.toString() +
-                     "</" + this.getURI(predicate) + ">");
-    }
-    else {
-
-      //write as:  <predicateURI>"Literal value"</predicateURI>
-      writer.println("    <" + this.getURI(predicate) + ">" +
-                     buffer.toString() + "</" +
-                     this.getURI(predicate) + ">");
-    }
-  }
-
-  /**
-   * Finds the RDF Type for a given subject.
-   *
-   * @param graph Graph
-   * @param subject SubjectNode
-   * @throws GraphException
-   * @return ObjectNode
-   */
-  protected ObjectNode getSubjectType(Graph graph, SubjectNode subject) throws
-      GraphException {
-
-    //value to be returned
-    ObjectNode type = null;
-
-    //validate graph
-    if ( (graph == null)) {
-
-      throw new IllegalArgumentException("Graph argument must not be null.");
-    }
-
-    //predicatNode representing RDF Type
-    PredicateNode rdfType = null;
-
-    try {
-
-      rdfType = graph.getElementFactory().createResource(RDF.TYPE);
-    }
-    catch (GraphElementFactoryException factoryException) {
-
-      throw new GraphException("Could not create RDF Type node.",
-                               factoryException);
-    }
-
-    //get the Subject's RDF type
-    ClosableIterator typeIter = graph.find(subject, rdfType, null);
-
-    if (typeIter != null) {
-
-      Object typeTriple = null;
-
-      //validate "first" triple and extract it's object (rdf type)
-      if (typeIter.hasNext()) {
-
-        typeTriple = typeIter.next();
-
-        if ( (typeTriple != null)
-            && (typeTriple instanceof Triple)) {
-
-          type = ( (Triple) typeTriple).getObject();
-        }
-        else {
-
-          throw new GraphException("Could not find RDF type for Subject: " +
-                                   subject + " . Invalid Triple returned.");
-        }
-      }
-
-      //close the Iterator
-      typeIter.close();
-    }
-
-    return type;
-  }
-
-  /**
-   * Returns a URI that represents the Node.
-   *
-   * @param node the node representing the URI.
-   * @throws GraphException
-   * @return URI
-   */
-  protected String getURI(Node node) throws GraphException {
-
-    //value to be returned
-    String uri = null;
-
-    //determine type of subject node and create uri from it
-    if (node != null) {
-
-      try {
-
-        if (node instanceof URIReference) {
-
-          uri = ( (URIReference) node).getURI().toString();
-        }
-        else if (node instanceof BlankNode) {
-
-          uri = new URI("#" + ( (BlankNode) node).toString()).toString();
-        }
-        else {
-
-          uri = node.toString();
-        }
-      }
-      catch (URISyntaxException uriException) {
-
-        throw new GraphException("Could not get URI for Node: " + node +
-                                 ".", uriException);
-      }
-    }
-    else {
-
-      throw new GraphException("Could not get URI for Node: " + node +
-                               ". Node is null.");
-    }
-
-    //return the URI with any namespaces replaced with prefixes
-    return this.replaceNamespace(uri);
-  }
-
-  /**
-   * Returns a String representation of an ObjectNode. Object values do not have
-   * to be escaped.
-   *
-   * @param node Node
-   * @throws GraphException
-   * @return String
-   */
-  protected String getNodeString(Node node) throws GraphException {
-
-    //value to be returned
-    String object = null;
-
-    //determine type of subject node and create uri from it
-    if (node != null) {
-
-      try {
-
-        if (node instanceof URIReference) {
-
-          object = ( (URIReference) node).getURI().toString();
-        }
-        else if (node instanceof BlankNode) {
-
-          object = new URI("#" + ( (BlankNode) node).toString()).toString();
-        }
-        else if (node instanceof Literal) {
-
-          object = ((Literal) node).getLexicalForm();
-        } else {
-
-          object = node.toString();
-        }
-      }
-      catch (URISyntaxException uriException) {
-
-        throw new GraphException("Could not get String for ObjectNode: " + node +
-                                 ".", uriException);
-      }
-    }
-    else {
-
-      throw new GraphException("Could not get String for ObjectNode: " + node +
-                               ". ObjectNode is null.");
-    }
-
-    return object;
-  }
-
-  /**
-   * If the URI contains the URI of a known namespace, it is replaced.
-   *
-   * @param original original URI.
-   * @return new URI with namespace references.
-   */
-  protected String replaceNamespace(String original) throws GraphException {
-
-    //value to be returned
-    String uri = original;
-
-    //validate URI (only replace uri's with fragments)
-    if (original != null) {
-
-      //replace any URI occurances with namespace prefixes
-      Set keys = this.namespaces.keySet();
-
-      Iterator keyIter = keys.iterator();
-      Object currentKey = null;
-      Object currentValue = null;
-
-      if (keyIter != null) {
-
-        while (keyIter.hasNext()) {
-
-          currentKey = keyIter.next();
-          currentValue = this.namespaces.get(currentKey);
-
-          //validate the Objects
-          if ( (currentKey != null)
-              && (currentValue != null)) {
-
-//            int index = uriAsString.indexOf(currentValue.toString());
-            //if the entire namespace is used, replace it with an entity
-            if (original.equals(currentValue.toString())) {
-
-              uri = "&" + currentKey + ";";
-            }
-            else if (original.startsWith(currentValue.toString())) {
-
-              //replace with namespace
-              uri = original.replaceAll(currentValue.toString(),
-                                        currentKey + ":");
-            }
-          }
-        }
-      }
-    }
-
-    //return the URI with any collection/container items renamed
-    return replaceCollection(uri);
-  }
-
-  /**
-   * If the URI has a fragment representing a collection (eg. Bag) item, it is
-   * replaced with li.
-   *
-   * @param original original URI.
-   * @return new URI with any necessary li.
-   */
-  protected String replaceCollection(String original) throws GraphException {
-
-    //value to be returned
-    String uri = original;
-
-    //validate URI
-    if (original != null) {
-
-      uri = original.replaceAll("_[0-9]+", "li");
-
-    }
-
-    return uri;
-  }
-
-  /**
-   * Populates the namespaces map with default namespaces and namespaces used
-   * by the graph.
-   *
-   * @param graph Graph
-   * @throws GraphException
-   */
-  protected void populateNamespaces(Graph graph) throws GraphException {
-
-    //default namespaces
-    this.namespaces = new HashMap();
-    this.namespaces.put(RDF_PREFIX, RDF.BASE_URI);
-    this.namespaces.put(RDFS_PREFIX, RDFS.BASE_URI);
-    this.namespaces.put("owl", "http://www.w3.org/2002/07/owl#");
-    this.namespaces.put("dc", "http://purl.org/dc/elements/1.1/");
-
-    //validate graph before reading
-    if (graph == null) {
-
-      throw new IllegalArgumentException("Graph argument is null.");
-    }
-
-    //get all statements
-    ClosableIterator tripleIter = graph.find(null, null, null);
-
-    if (tripleIter != null) {
-
-      //current Triple/Predicate
-      Triple triple = null;
-      SubjectNode subject = null;
-      PredicateNode predicate = null;
-      ObjectNode object = null;
-
-      while (tripleIter.hasNext()) {
-
-        //get the next triple
-        triple = (Triple) tripleIter.next();
-
-        if (triple != null) {
-
-          //evaluate subject
-          subject = triple.getSubject();
-          if (subject instanceof URIReference) {
-
-            this.addNamespaceURI(((URIReference) subject).getURI());
-          }
-
-          //evaluate predicate (must be URIReference)
-          predicate = triple.getPredicate();
-          this.addNamespaceURI(((URIReference) predicate).getURI());
-
-          //evaluate object
-          object = triple.getObject();
-          if (object instanceof URIReference) {
-
-            this.addNamespaceURI(((URIReference) object).getURI());
-          }
-        }
-      }
-
-      //close the Iterator
-      tripleIter.close();
-    }
-  }
-
-  /**
-   * Populates the namespaces map with default namespaces and namespaces used
-   * by the graph.
-   *
-   * @param graph Graph
-   * @throws GraphException
-   */
-/*  protected void populateNamespaces(Graph graph) throws GraphException {
-
-    //validate graph
-    if (! (graph instanceof JRDFGraph)) {
-
-      throw new IllegalArgumentException("Graph must be of type JRDFGraph");
-    }
-
-    //default namespaces
-    this.namespaces = new HashMap();
-    this.namespaces.put(RDF_PREFIX, RDF.baseURI);
-    this.namespaces.put(RDFS_PREFIX, RDFS.baseURI);
-    this.namespaces.put("owl", "http://www.w3.org/2002/07/owl#");
-    this.namespaces.put("dc", "http://purl.org/dc/elements/1.1/");
-
-    //validate graph before reading
-    if (graph == null) {
-
-      throw new IllegalArgumentException("Graph argument is null.");
-    }
-
-    //iterator used to access predicates
-    ClosableIterator predicateIter = ( (JRDFGraph) graph).getUniquePredicates();
-
-    if (predicateIter != null) {
-
-      //current Triple/Predicate
-      Object triple = null;
-      PredicateNode predicate = null;
-      String predicateURI = null;
-
-      while (predicateIter.hasNext()) {
-
-        //get the next triple
-        triple = predicateIter.next();
-
-        if ( (triple != null)
-            && (triple instanceof Triple)) {
-
-          //get the predicate and evaluate
-          predicate = ( (Triple) triple).getPredicate();
-          predicateURI = this.getURI(predicate);
-
-          //add the namespace
-          try {
-
-            this.addNamespaceURI(new URI(predicateURI));
-          }
-          catch (URISyntaxException uriException) {
-
-            throw new GraphException("Could not add Namespace: " + predicateURI,
-                                     uriException);
-          }
-        }
-      }
-
-      //close the Iterator
-      predicateIter.close();
-    }
-  } */
-
-  /**
-   * Evaluates a URI and adds it to the namespace map as a namespace.
-   *
-   * @param uri URI
-   */
-  protected void addNamespaceURI(URI uri) {
-
-    if (uri == null) {
-
-      throw new IllegalArgumentException("URI argument is null.");
-    }
-
-    //extract URI without fragment
-    String uriString = uri.toString();
-    String newURI = null;
-
-    if (uriString != null) {
-
-      //determine what comes last a '#' or '/'
-      int hashindex = uriString.lastIndexOf('#');
-      int slashindex = uriString.lastIndexOf('/');
-
-      //validate (URI must contain a forward slash)
-      if (slashindex == -1) {
-
-        //namespace may have been evaluated already
-        return;
-      }
-
-      //is there a '/' after the '#'?
-      if (slashindex > hashindex) {
-
-        //remove everything after the last '/'
-        int index = uriString.lastIndexOf('/');
-        newURI = uriString.substring(0, index) + "/";
-      }
-      else {
-
-        //'#' comes after last '/' (remove entire fragment)
-        newURI = uriString.replaceAll(uri.getFragment(), "");
-      }
-
-      //only add namespace if it is new
-      if ( (newURI != null)
-          && (!this.namespaces.containsValue(newURI))) {
-
-        //add to namespaces
-        this.namespaces.put("ns" + this.namespaces.size(), newURI);
-      }
-    }
-  }
-}

Modified: trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/DistributedResolver.java
===================================================================
--- trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/DistributedResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/DistributedResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -78,7 +78,7 @@
 
 
   /**
-   * Model creation method.  Not supported in this resolver.
+   * Graph creation method.  Not supported in this resolver.
    * @throws ResolverException The server should not ask this resolver to create a model.
    */
   public void createModel(long model, URI modelType) throws ResolverException {

Modified: trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/NetworkDelegator.java
===================================================================
--- trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/NetworkDelegator.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-distributed/java/org/mulgara/resolver/distributed/NetworkDelegator.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -21,7 +21,7 @@
 import org.mulgara.query.ConstraintElement;
 import org.mulgara.query.ConstraintImpl;
 import org.mulgara.query.LocalNode;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
 import org.mulgara.query.TuplesException;
@@ -216,7 +216,7 @@
     // convert the variable set to a variable list - add types via unchecked casts
     List<Variable> variables = new ArrayList<Variable>((Set<Variable>)globalConstraint.getVariables());
     // build the new query
-    return new Query(variables, new ModelResource(model.getURI()), globalConstraint, null, Collections.EMPTY_LIST, null, 0, new UnconstrainedAnswer());
+    return new Query(variables, new GraphResource(model.getURI()), globalConstraint, null, Collections.EMPTY_LIST, null, 0, new UnconstrainedAnswer());
   }
 
 

Modified: trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileResolver.java
===================================================================
--- trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-file/java/org/mulgara/resolver/file/FileResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -102,7 +102,7 @@
       Node globalModel = resolverSession.globalize(model);
       if (!(globalModel instanceof URIReference)) {
         throw new ResolverException(
-          "Model parameter " + globalModel + " isn't a URI reference");
+          "Graph parameter " + globalModel + " isn't a URI reference");
       }
       modelURI = ((URIReference) globalModel).getURI();
     } catch (GlobalizeException e) {

Modified: trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java
===================================================================
--- trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -127,7 +127,7 @@
     // Validate "modelType" parameter
     if (modelTypeURI == null) {
 
-      throw new IllegalArgumentException("Model type can't be null");
+      throw new IllegalArgumentException("Graph type can't be null");
     }
 
     // Store the global variable values
@@ -359,7 +359,7 @@
           definitionURI(model)));
     } catch (LocalizeException localiseException) {
 
-      throw new QueryException("Model " + model +
+      throw new QueryException("Graph " + model +
                                " did not exist in FileSystem" +
                                " expansion", localiseException);
     } catch (ResolverException resolverException) {

Modified: trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/ReadOnlyGISResolver.java
===================================================================
--- trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/ReadOnlyGISResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-gis/java/org/mulgara/resolver/gis/ReadOnlyGISResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -87,7 +87,7 @@
   /** Used to handle content/manage content handlers */
   protected ContentHandlerManager contentManager;
 
-  /** Model type supported by this resolver */
+  /** Graph type supported by this resolver */
   public static final URI MODEL_TYPE = URI.create(Mulgara.NAMESPACE + "GISModel");
 
   /** Node ID for rdf:type */

Modified: trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java
===================================================================
--- trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -111,7 +111,7 @@
 
     if (!(globalModel instanceof URIReference)) {
       // Check that our node is a URIReference
-      throw new ResolverException("Model parameter " + globalModel + " isn't a URI reference");
+      throw new ResolverException("Graph parameter " + globalModel + " isn't a URI reference");
     }
 
     // Get the URI from the globalised node

Modified: trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarResolver.java
===================================================================
--- trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-jar/java/org/mulgara/resolver/jar/JarResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -120,7 +120,7 @@
 
       // Check that our node is a URIReference
       throw new ResolverException(
-          "Model parameter " + globalModel + " isn't a URI reference");
+          "Graph parameter " + globalModel + " isn't a URI reference");
     }
 
     // Get the URI from the globalised node

Modified: trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneConstraintDescriptor.java
===================================================================
--- trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneConstraintDescriptor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneConstraintDescriptor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -26,7 +26,7 @@
 import org.mulgara.resolver.spi.ConstraintDescriptor;
 import org.mulgara.resolver.spi.ConstraintLocalization;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.ConstraintExpression;
 import org.mulgara.query.ConstraintElement;
 import org.mulgara.query.Constraint;
@@ -50,7 +50,7 @@
   }
 
 
-  public Tuples resolve(QueryEvaluationContext queryContext, ModelExpression modelExpr,
+  public Tuples resolve(QueryEvaluationContext queryContext, GraphExpression modelExpr,
                         ConstraintExpression constraintExpr) throws Exception {
     return ConstraintOperations.resolveModelExpression(queryContext, modelExpr, (Constraint)constraintExpr);
   }

Modified: trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java
===================================================================
--- trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -358,7 +358,7 @@
       if (logger.isDebugEnabled()) logger.debug("Ignoring solutions for " + constraint);
       return new EmptyResolution(constraint, false);
     } else if (!(modelElement instanceof LocalNode)) {
-      throw new QueryException("Failed to localize Lucene Model before resolution " + constraint);
+      throw new QueryException("Failed to localize Lucene Graph before resolution " + constraint);
     }
 
     /* temporary hack because $_from is not resolved before transformation occurs, and hence

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	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolverUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -40,7 +40,7 @@
 import org.mulgara.query.Answer;
 import org.mulgara.query.ConstraintConjunction;
 import org.mulgara.query.ConstraintExpression;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.query.Query;
 import org.mulgara.query.Variable;
 import org.mulgara.query.operation.Modification;
@@ -175,7 +175,7 @@
         session.removeModel(modelURI);
       }
       session.createModel(modelURI, luceneModelType);
-      session.setModel(modelURI, new ModelResource(fileURI));
+      session.setModel(modelURI, new GraphResource(fileURI));
 
       // Run the queries
       try {

Modified: trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/ReadOnlyLuceneResolver.java
===================================================================
--- trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/ReadOnlyLuceneResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/ReadOnlyLuceneResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -88,7 +88,7 @@
   //
 
   /**
-   * Model creation is not allowed the via this read-only view.
+   * Graph creation is not allowed the via this read-only view.
    *
    * @throws ResolverException always
    */
@@ -98,7 +98,7 @@
   }
 
   /**
-   * Model modification is not supported via this read-only view.
+   * Graph modification is not supported via this read-only view.
    *
    * @throws ResolverException always
    */
@@ -108,7 +108,7 @@
   }
 
   /**
-   * Model deletion is not supported via this read-only view.
+   * Graph deletion is not supported via this read-only view.
    *
    * @throws ResolverException always
    */

Modified: trunk/src/jar/resolver-memory/java/org/mulgara/resolver/memory/MemoryResolver.java
===================================================================
--- trunk/src/jar/resolver-memory/java/org/mulgara/resolver/memory/MemoryResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-memory/java/org/mulgara/resolver/memory/MemoryResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -136,7 +136,7 @@
       throws ResolverFactoryException {
     // Validate "modelType" parameter
     if (modelTypeURI == null) {
-      throw new IllegalArgumentException("Model type can't be null");
+      throw new IllegalArgumentException("Graph type can't be null");
     }
 
     // Initialize fields

Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraintDescriptor.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraintDescriptor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraintDescriptor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -50,7 +50,7 @@
 import org.mulgara.resolver.spi.ConstraintDescriptor;
 import org.mulgara.resolver.spi.ConstraintLocalization;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.ConstraintExpression;
 import org.mulgara.query.ConstraintElement;
 import org.mulgara.query.Constraint;
@@ -72,7 +72,7 @@
 
 
   public Tuples resolve(QueryEvaluationContext queryContext,
-                        ModelExpression modelExpr,
+                        GraphExpression modelExpr,
                         ConstraintExpression constraintExpr) throws Exception {
     assert constraintExpr instanceof Constraint;
     return ConstraintOperations.resolveModelExpression(queryContext, modelExpr, (Constraint)constraintExpr);

Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -134,7 +134,7 @@
       throws ResolverFactoryException {
 
     if (modelTypeURI == null) {
-      throw new IllegalArgumentException("Model type can't be null");
+      throw new IllegalArgumentException("Graph type can't be null");
     }
 
     // Store the global variable values
@@ -266,7 +266,7 @@
       defModel = resolverSession.lookupPersistent(new URIReferenceImpl(
           definitionURI(model)));
     } catch (LocalizeException localiseException) {
-      throw new QueryException("Model " + model +
+      throw new QueryException("Graph " + model +
                                " did not exist in Relational" +
                                " expansion", localiseException);
     } catch (ResolverException resolverException) {

Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverFactory.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverFactory.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverFactory.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -81,7 +81,7 @@
   /** Node id for the relational model type */
   private long relationalModelTypeNode;
 
-  /** The URL associated with the Relational Model type.  */
+  /** The URL associated with the Relational Graph type.  */
   private static final URI modelTypeURI = URI.create(Mulgara.NAMESPACE + "RelationalModel");
 
 

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	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolverUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -370,7 +370,7 @@
   public void testLoadRelationalDef() throws Exception {
     Session session = database.newSession();
     try {
-      session.setModel(testModelDefURI, new ModelResource(new File("data/ISWC-d2rq.rdf").toURI()));
+      session.setModel(testModelDefURI, new GraphResource(new File("data/ISWC-d2rq.rdf").toURI()));
     } finally {
       session.close();
     }
@@ -385,7 +385,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintImpl(new Variable("s"),
                              new URIReferenceImpl(RDF.TYPE),
                              new URIReferenceImpl(new URI("http://annotation.semanticweb.org/iswc/iswc.daml#Person")),
@@ -422,7 +422,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -465,7 +465,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
             {
                 new ConstraintImpl(new Variable("s"),
@@ -506,7 +506,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
             {
                 new ConstraintImpl(new URIReferenceImpl(new URI("http://www.smith.id/albert")),
@@ -548,7 +548,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
             {
                 new ConstraintImpl(new Variable("s"),
@@ -595,7 +595,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintImpl(new Variable("s"),
                              new URIReferenceImpl(RDF.TYPE),
                              new URIReferenceImpl(new URI("http://annotation.semanticweb.org/iswc/iswc.daml#Conference")),
@@ -632,7 +632,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -676,7 +676,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -718,7 +718,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -797,7 +797,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
               {
                 new ConstraintImpl(new Variable("s"),
@@ -842,7 +842,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
               {
                 new ConstraintImpl(new Variable("s"),
@@ -891,7 +891,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
               {
                 new ConstraintImpl(new Variable("s"),
@@ -955,7 +955,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -1001,7 +1001,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
             {
                 new ConstraintImpl(new Variable("s"),
@@ -1042,7 +1042,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[]
             {
                 new ConstraintImpl(new URIReferenceImpl(new URI("http://www.conference.org/conf02004/paper#Paper3")),
@@ -1085,7 +1085,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[] {
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -1150,7 +1150,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[] {
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -1220,7 +1220,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[] {
               new ConstraintImpl(new Variable("p"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -1272,7 +1272,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[] {
               new ConstraintImpl(new Variable("per"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -1335,7 +1335,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[] {
               new ConstraintImpl(new Variable("per"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -1390,7 +1390,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[] {
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),
@@ -1441,7 +1441,7 @@
   public void testLoadRelationalDef2() throws Exception {
     Session session = database.newSession();
     try {
-      session.setModel(testModel2DefURI, new ModelResource(new File("data/ISWC-d2rq.rdf").toURI()));
+      session.setModel(testModel2DefURI, new GraphResource(new File("data/ISWC-d2rq.rdf").toURI()));
     } finally {
       session.close();
     }
@@ -1459,7 +1459,7 @@
 
       Answer answer = session.query(new Query(
           selectList,          // SELECT
-          new ModelResource(systemModelURI),               // FROM
+          new GraphResource(systemModelURI),               // FROM
           new ConstraintConjunction(Arrays.asList(new ConstraintExpression[] {
               new ConstraintImpl(new Variable("s"),
                                  new URIReferenceImpl(RDF.TYPE),

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentLoader.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentLoader.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentLoader.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -31,11 +31,11 @@
 import org.mulgara.content.Content;
 import org.mulgara.content.ContentHandler;
 import org.mulgara.content.ContentHandlerException;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.server.Session;
 
 /**
- * Interface for loading Content into a Model (ModelExpression). Similar to a
+ * Interface for loading Content into a Graph (GraphExpression). Similar to a
  * {@link ContentHandler} but is reponsible for inserting global statements
  * directly into the destination.
  *
@@ -61,15 +61,15 @@
 public interface ContentLoader extends ContentHandler {
   /**
    * Processes and Loads the content and inserts the statements into the
-   * ModelResource.
+   * GraphResource.
    *
    * @param content Content
-   * @param destination ModelResource
+   * @param destination GraphResource
    * @param session Session
    * @throws ContentHandlerException
    * @return long The number of statements loaded
    */
-  public long load(Content content, ModelResource destination,
+  public long load(Content content, GraphResource destination,
       Session session) throws ContentHandlerException;
 
 }

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintDescriptor.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintDescriptor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintDescriptor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -54,7 +54,7 @@
  * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
  */
 
-public interface ConstraintDescriptor extends ConstraintResolutionHandler, ConstraintModelRewrite {
+public interface ConstraintDescriptor extends ConstraintResolutionHandler, ConstraintGraphRewrite {
 
   public Class<? extends Constraint> getConstraintClass();
 
@@ -62,6 +62,6 @@
   // methods imported from the super-interfaces.
   /*
   public Constraint rewrite(ConstraintElement newModel, Constraint constraint) throws Exception;
-  public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception;
+  public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception;
   */
 }

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintExpansion.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintExpansion.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintExpansion.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -33,7 +33,7 @@
 
 // Local packages
 import org.mulgara.query.ConstraintExpression;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.QueryException;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
 import org.mulgara.store.tuples.Tuples;
@@ -53,6 +53,6 @@
 public interface ConstraintExpansion
 {
     public Tuples expand(QueryEvaluationContext queryContext,
-                         ModelExpression modelExpr,
+                         GraphExpression modelExpr,
                          ConstraintExpression constraintExpr) throws Exception;
 }

Copied: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintGraphRewrite.java (from rev 1397, trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintModelRewrite.java)
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintGraphRewrite.java	                        (rev 0)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintGraphRewrite.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,63 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver.spi;
+
+// Java 2 standard packages
+import javax.transaction.xa.XAResource;
+import java.net.URI;
+
+// Local packages
+import org.mulgara.query.Constraint;
+import org.mulgara.query.ConstraintElement;
+import org.mulgara.query.QueryException;
+
+/**
+ * Used to constrain a given constraint to a specified model
+ *
+ * @created 2003-12-01
+ * @author <a href="http://www.pisoftware.com/andrae">Andrae Muys</a>
+ * @version $Revision: 1.9 $
+ * @modified $Date: 2005/05/03 08:11:44 $ 
+ * @maintenanceAuthor $Author: amuys $
+ * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
+ * @copyright &copy;2003-2004 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+
+public interface ConstraintGraphRewrite
+{
+  /**
+   * Rewrite this constraintExpression to access the specified model
+   *
+   * @param newModel  the model with which to constrain the constraint
+   * @param constraint the constraint to constrain
+   */
+    public Constraint rewrite(ConstraintElement newModel,
+                              Constraint constraint) throws Exception;
+}


Property changes on: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintGraphRewrite.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintModelRewrite.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintModelRewrite.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintModelRewrite.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,63 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver.spi;
-
-// Java 2 standard packages
-import javax.transaction.xa.XAResource;
-import java.net.URI;
-
-// Local packages
-import org.mulgara.query.Constraint;
-import org.mulgara.query.ConstraintElement;
-import org.mulgara.query.QueryException;
-
-/**
- * Used to constrain a given constraint to a specified model
- *
- * @created 2003-12-01
- * @author <a href="http://www.pisoftware.com/andrae">Andrae Muys</a>
- * @version $Revision: 1.9 $
- * @modified $Date: 2005/05/03 08:11:44 $ 
- * @maintenanceAuthor $Author: amuys $
- * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
- * @copyright &copy;2003-2004 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-public interface ConstraintModelRewrite
-{
-  /**
-   * Rewrite this constraintExpression to access the specified model
-   *
-   * @param newModel  the model with which to constrain the constraint
-   * @param constraint the constraint to constrain
-   */
-    public Constraint rewrite(ConstraintElement newModel,
-                              Constraint constraint) throws Exception;
-}

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintResolutionHandler.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintResolutionHandler.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConstraintResolutionHandler.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -41,7 +41,7 @@
 
 // Local packages
 import org.mulgara.query.ConstraintExpression;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.QueryException;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
 import org.mulgara.store.tuples.Tuples;
@@ -71,6 +71,6 @@
    * @param constraintExpr the constraintExpression to resolve
    */
   public Tuples resolve(QueryEvaluationContext queryContext,
-                        ModelExpression modelExpr,
+                        GraphExpression modelExpr,
                         ConstraintExpression constraintExpr) throws Exception;
 }

Copied: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphExpansion.java (from rev 1397, trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelExpansion.java)
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphExpansion.java	                        (rev 0)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphExpansion.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,58 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver.spi;
+
+// Java 2 standard packages
+import javax.transaction.xa.XAResource;
+import java.net.URI;
+
+// Local packages
+import org.mulgara.query.Constraint;
+import org.mulgara.query.GraphExpression;
+import org.mulgara.query.QueryException;
+import org.mulgara.resolver.spi.QueryEvaluationContext;
+import org.mulgara.store.tuples.Tuples;
+
+/**
+ * @created 2003-12-01
+ * @author <a href="http://www.pisoftware.com/andrae">Andrae Muys</a>
+ * @version $Revision: 1.8 $
+ * @modified $Date: 2005/01/05 04:58:50 $ 
+ * @maintenanceAuthor $Author: newmana $
+ * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
+ * @copyright &copy;2003-2004 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+
+public interface GraphExpansion
+{
+    public Tuples expand(QueryEvaluationContext queryContext,
+                         GraphExpression modelExpr,
+                         Constraint constraint) throws Exception;
+}


Property changes on: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphExpansion.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphResolutionHandler.java (from rev 1397, trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelResolutionHandler.java)
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphResolutionHandler.java	                        (rev 0)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphResolutionHandler.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -0,0 +1,58 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Kowari Metadata Store.
+ *
+ * The Initial Developer of the Original Code is Plugged In Software Pty
+ * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
+ * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
+ * Plugged In Software Pty Ltd. All Rights Reserved.
+ *
+ * Contributor(s): N/A.
+ *
+ * [NOTE: The text of this Exhibit A may differ slightly from the text
+ * of the notices in the Source Code files of the Original Code. You
+ * should use the text of this Exhibit A rather than the text found in the
+ * Original Code Source Code for Your Modifications.]
+ *
+ */
+
+package org.mulgara.resolver.spi;
+
+// Java 2 standard packages
+import javax.transaction.xa.XAResource;
+import java.net.URI;
+
+// Local packages
+import org.mulgara.query.Constraint;
+import org.mulgara.query.GraphExpression;
+import org.mulgara.query.QueryException;
+import org.mulgara.resolver.spi.QueryEvaluationContext;
+import org.mulgara.store.tuples.Tuples;
+
+/**
+ * @created 2003-12-01
+ * @author <a href="http://www.pisoftware.com/andrae">Andrae Muys</a>
+ * @version $Revision: 1.1 $
+ * @modified $Date: 2005/04/17 03:00:40 $ 
+ * @maintenanceAuthor $Author: pgearon $
+ * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
+ * @copyright &copy;2003-2004 <a href="http://www.pisoftware.com/">Plugged In
+ *      Software Pty Ltd</a>
+ * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
+ */
+
+public interface GraphResolutionHandler
+{
+    public Tuples resolve(QueryEvaluationContext queryContext,
+                         GraphExpression modelExpr,
+                         Constraint constraint) throws Exception;
+}


Property changes on: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/GraphResolutionHandler.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelExpansion.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelExpansion.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelExpansion.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,58 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver.spi;
-
-// Java 2 standard packages
-import javax.transaction.xa.XAResource;
-import java.net.URI;
-
-// Local packages
-import org.mulgara.query.Constraint;
-import org.mulgara.query.ModelExpression;
-import org.mulgara.query.QueryException;
-import org.mulgara.resolver.spi.QueryEvaluationContext;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * @created 2003-12-01
- * @author <a href="http://www.pisoftware.com/andrae">Andrae Muys</a>
- * @version $Revision: 1.8 $
- * @modified $Date: 2005/01/05 04:58:50 $ 
- * @maintenanceAuthor $Author: newmana $
- * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
- * @copyright &copy;2003-2004 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-public interface ModelExpansion
-{
-    public Tuples expand(QueryEvaluationContext queryContext,
-                         ModelExpression modelExpr,
-                         Constraint constraint) throws Exception;
-}

Deleted: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelResolutionHandler.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelResolutionHandler.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ModelResolutionHandler.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -1,58 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the Kowari Metadata Store.
- *
- * The Initial Developer of the Original Code is Plugged In Software Pty
- * Ltd (http://www.pisoftware.com, mailto:info at pisoftware.com). Portions
- * created by Plugged In Software Pty Ltd are Copyright (C) 2001,2002
- * Plugged In Software Pty Ltd. All Rights Reserved.
- *
- * Contributor(s): N/A.
- *
- * [NOTE: The text of this Exhibit A may differ slightly from the text
- * of the notices in the Source Code files of the Original Code. You
- * should use the text of this Exhibit A rather than the text found in the
- * Original Code Source Code for Your Modifications.]
- *
- */
-
-package org.mulgara.resolver.spi;
-
-// Java 2 standard packages
-import javax.transaction.xa.XAResource;
-import java.net.URI;
-
-// Local packages
-import org.mulgara.query.Constraint;
-import org.mulgara.query.ModelExpression;
-import org.mulgara.query.QueryException;
-import org.mulgara.resolver.spi.QueryEvaluationContext;
-import org.mulgara.store.tuples.Tuples;
-
-/**
- * @created 2003-12-01
- * @author <a href="http://www.pisoftware.com/andrae">Andrae Muys</a>
- * @version $Revision: 1.1 $
- * @modified $Date: 2005/04/17 03:00:40 $ 
- * @maintenanceAuthor $Author: pgearon $
- * @company <a href="mailto:info at PIsoftware.com">Plugged In Software</a>
- * @copyright &copy;2003-2004 <a href="http://www.pisoftware.com/">Plugged In
- *      Software Pty Ltd</a>
- * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
- */
-
-public interface ModelResolutionHandler
-{
-    public Tuples resolve(QueryEvaluationContext queryContext,
-                         ModelExpression modelExpr,
-                         Constraint constraint) throws Exception;
-}

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/QueryEvaluationContext.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -72,19 +72,19 @@
    * Localize and resolve the leaf node of the <code>FROM</code> and
    * <code>WHERE</code> clause product.
    *
-   * @param modelResource  the <code>FROM</code> clause to resolve, never
+   * @param graphResource  the <code>FROM</code> clause to resolve, never
    *   <code>null</code>
    * @param constraint  the <code>WHERE</code> clause to resolve, which must
    *   have {@link Variable#FROM} as its fourth element, and never be
    *   <code>null</code>
    * @throws QueryException if resolution can't be obtained
    */
-  public Tuples resolve(ModelResource modelResource, Constraint constraint) throws QueryException;
+  public Tuples resolve(GraphResource graphResource, Constraint constraint) throws QueryException;
 
-  public Tuples resolve(ModelExpression modelExpression, ConstraintExpression constraintExpression) throws QueryException;
+  public Tuples resolve(GraphExpression graphExpression, ConstraintExpression constraintExpression) throws QueryException;
 
   public ResolverSession getResolverSession();
 
-  public List<Tuples> resolveConstraintOperation(ModelExpression modelExpr,
+  public List<Tuples> resolveConstraintOperation(GraphExpression modelExpr,
                                         ConstraintOperation constraintOper) throws QueryException;
 }

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolver.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -30,7 +30,7 @@
 import java.net.URI;
 
 /**
- * A {@link Resolver} that is currently hosting the System Model.
+ * A {@link Resolver} that is currently hosting the System Graph.
  *
  * @created 2004-03-28
  * @author <a href="http://staff.pisoftware.com/andrae">Andrae Muys</a>

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolverFactory.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolverFactory.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/SystemResolverFactory.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -35,7 +35,7 @@
 
 // Local packages
 import org.mulgara.query.Constraint;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.query.QueryException;
 import org.mulgara.store.tuples.Tuples;
 import org.mulgara.store.xa.SimpleXARecoveryHandler;

Modified: trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolver.java
===================================================================
--- trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -131,7 +131,7 @@
   {
     // Validate parameters
     if (modelTypeURI == null) {
-      throw new IllegalArgumentException("Model type can't be Null");
+      throw new IllegalArgumentException("Graph type can't be Null");
     }
     if (statementStore == null) {
       throw new IllegalArgumentException("Null 'statementStore' parameter");
@@ -163,7 +163,7 @@
   {
     // Validate parameters
     if (modelTypeURI == null) {
-      throw new IllegalArgumentException("Model type can't be Null");
+      throw new IllegalArgumentException("Graph type can't be Null");
     }
     if (statementStore == null) {
       throw new IllegalArgumentException("Null 'statementStore' parameter");
@@ -315,7 +315,7 @@
       Node node = resolverSession.globalize(model);
       if (!(node instanceof URIReference)) {
         throw new ResolverException(
-          "Model " + model + " is " + node + ", not a URI reference");
+          "Graph " + model + " is " + node + ", not a URI reference");
       }
       modelURIReference = (URIReference) node;
     } catch (GlobalizeException e) {

Modified: trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraintDescriptor.java
===================================================================
--- trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraintDescriptor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraintDescriptor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -42,7 +42,7 @@
 import org.mulgara.query.Constraint;
 import org.mulgara.query.ConstraintElement;
 import org.mulgara.query.ConstraintExpression;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.resolver.spi.ConstraintDescriptor;
 import org.mulgara.resolver.spi.QueryEvaluationContext;
 import org.mulgara.store.tuples.Tuples;
@@ -77,7 +77,7 @@
   }
 
 
-  public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
+  public Tuples resolve(QueryEvaluationContext context, GraphExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
     if (constraintExpr instanceof TestConstraint) {
       // FIXME: Need to find a clean way of enlisting the resolver in the transaction.
       // This will involve changes to LocalQueryResolver (the QEC/context passed to this method).

Modified: trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolver.java
===================================================================
--- trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -115,7 +115,7 @@
    * Remove the file containing the model.
    */
   public void removeModel(long model) throws ResolverException {
-    throw new ResolverException("Model removal not supported in TestResolver");
+    throw new ResolverException("Graph removal not supported in TestResolver");
   }
 
   /**

Modified: trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java
===================================================================
--- trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestResolverUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -49,7 +49,7 @@
 // locally written packages
 import org.mulgara.query.Answer;
 import org.mulgara.query.ConstraintConjunction;
-import org.mulgara.query.ModelResource;
+import org.mulgara.query.GraphResource;
 import org.mulgara.query.Order;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
@@ -135,7 +135,7 @@
 
     Answer answer = session.query(new Query(
       variables,                                                                // SELECT
-      new ModelResource(systemModelURI),                                        // FROM
+      new GraphResource(systemModelURI),                                        // FROM
       new TestConstraint(new Variable("a"), new Variable("b"), "test:a", ""),   // WHERE
       null,                                                                     // HAVING
       Arrays.asList(new Order[]
@@ -182,7 +182,7 @@
 
     Answer answer = session.query(new Query(
       variables,                                                                // SELECT
-      new ModelResource(systemModelURI),                                        // FROM
+      new GraphResource(systemModelURI),                                        // FROM
       new TestConstraint(new Variable("a"), new Variable("c"), "test:b", ""),   // WHERE
       null,                                                                     // HAVING
       Arrays.asList(new Order[]
@@ -227,7 +227,7 @@
 
     Answer answer = session.query(new Query(
       variables,                                                                // SELECT
-      new ModelResource(systemModelURI),                                        // FROM
+      new GraphResource(systemModelURI),                                        // FROM
       new ConstraintConjunction( 																								// WHERE
 				new TestConstraint(new Variable("a"), new Variable("c"), "test:b", ""),
 				new TestConstraint(new Variable("a"), new Variable("b"), "test:a", "")),
@@ -278,7 +278,7 @@
 
     Answer answer = session.query(new Query(
       variables,                                                                // SELECT
-      new ModelResource(systemModelURI),                                        // FROM
+      new GraphResource(systemModelURI),                                        // FROM
       new ConstraintConjunction( 																								// WHERE
 				new TestConstraint(new Variable("a"), new Variable("c"), "test:b", "a"),
 				new TestConstraint(new Variable("a"), new Variable("b"), "test:a", "")),
@@ -330,7 +330,7 @@
 		try {
 			session.query(new Query(
 				variables,                                                                // SELECT
-				new ModelResource(systemModelURI),                                        // FROM
+				new GraphResource(systemModelURI),                                        // FROM
 				new ConstraintConjunction( 																								// WHERE
 					new TestConstraint(new Variable("a"), new Variable("c"), "test:b", "b"), // non-prefix variable causes failure
 					new TestConstraint(new Variable("a"), new Variable("b"), "test:a", "")),

Modified: trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java
===================================================================
--- trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -138,7 +138,7 @@
       Node globalModel = resolverSession.globalize(model);
       if (!(globalModel instanceof URIReference)) {
         throw new ResolverException(
-            "Model parameter " + globalModel + " isn't a URI reference");
+            "Graph parameter " + globalModel + " isn't a URI reference");
       }
       modelURIReference = (URIReference) globalModel;
     }
@@ -241,7 +241,7 @@
       Node globalModel = resolverSession.globalize(model);
       if (!(globalModel instanceof URIReference)) {
         throw new ResolverException(
-            "Model parameter " + globalModel + " isn't a URI reference");
+            "Graph parameter " + globalModel + " isn't a URI reference");
       }
       modelURIReference = (URIReference) globalModel;
     }

Modified: trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java
===================================================================
--- trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -111,7 +111,7 @@
 
     // Validate "modelType" parameter
     if (modelTypeURI == null) {
-      throw new IllegalArgumentException("Model type can't be null");
+      throw new IllegalArgumentException("Graph type can't be null");
     }
     this.resolverSession = resolverSession;
     this.systemResolver = systemResolver;
@@ -257,7 +257,7 @@
 
       return definition.resolve(constraint, session);
     } catch (LocalizeException el) {
-      throw new QueryException("Model " + model + " did not exist in view expansion", el);
+      throw new QueryException("Graph " + model + " did not exist in view expansion", el);
     } catch (ResolverException er) {
       throw new QueryException("Failed to build view definition uri", er.getCause());
     }

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	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolverUnitTest.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -133,11 +133,11 @@
   };
 
 
-  protected static final ModelResource[] models;
+  protected static final GraphResource[] models;
   static {
-    models = new ModelResource[modelURIs.length];
+    models = new GraphResource[modelURIs.length];
     for (int i = 0; i < modelURIs.length; i++) {
-      models[i] = new ModelResource(modelURIs[i]);
+      models[i] = new GraphResource(modelURIs[i]);
     }
   };
 
@@ -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 ModelResource(modelDataURIs[i]));
+      session.setModel(modelURIs[i], new GraphResource(modelDataURIs[i]));
     }
   }
 

Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraintDescriptor.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraintDescriptor.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraintDescriptor.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -83,7 +83,7 @@
    *   an {@link IntervalConstraint}
    */
   public Tuples resolve(QueryEvaluationContext queryEvaluationContext,
-                        ModelExpression        modelExpression,
+                        GraphExpression        graphExpression,
                         ConstraintExpression   constraintExpression)
     throws Exception {
 

Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -238,7 +238,7 @@
       throw new SymbolicTransformationException("Unable to check model on constraint", eq);
     }
 
-    logger.debug("Model suitable for IntervalTransformation");
+    logger.debug("Graph suitable for IntervalTransformation");
 
     // Figure out the direction of bounding, assuming [$var op value] order
     if (constraint.getElement(1).equals(lessThan)) {

Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -129,13 +129,13 @@
   }
 
   /**
-   * @param modelResource  a model identified in the <code>FROM</code> clause
+   * @param graphResource  a model identified in the <code>FROM</code> clause
    * @return <code>true</code> only if this resource is the unique XML Schema
    *   model
    * @throws QueryException always, because it's not implemented
    * @deprecated XSDResolver.canResolve is not implemented
    */
-  public boolean canResolve(ModelResource modelResource) throws QueryException {
+  public boolean canResolve(GraphResource graphResource) throws QueryException {
 
     throw new QueryException(getClass() + ".canResolve not implemented");
   }

Modified: trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java
===================================================================
--- trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/server/java/org/mulgara/server/EmbeddedMulgaraServer.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -146,7 +146,6 @@
    * where this class was run.</p>
    * @param args command line arguments
    */
-  @SuppressWarnings("unchecked")
   public static void main(String[] args) {
     // report the version and build number
     System.out.println("@@build.label@@");

Modified: trunk/src/jar/server-local/java/org/mulgara/server/local/LocalSessionFactory.java
===================================================================
--- trunk/src/jar/server-local/java/org/mulgara/server/local/LocalSessionFactory.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/server-local/java/org/mulgara/server/local/LocalSessionFactory.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -41,7 +41,7 @@
 
 // Locally written packages
 import java.lang.reflect.*;
-import org.mulgara.query.ModelLiteral;
+import org.mulgara.query.GraphLiteral;
 import org.mulgara.query.QueryException;
 import org.mulgara.server.Session;
 import org.mulgara.server.SessionFactory;

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteJRDFSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteJRDFSession.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteJRDFSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -41,7 +41,7 @@
 
 // Locally written packages
 import org.mulgara.query.Answer;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
 

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	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -38,7 +38,7 @@
 import org.jrdf.graph.Triple;
 import org.mulgara.query.AskQuery;
 import org.mulgara.query.ConstructQuery;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
 import org.mulgara.rules.InitializerException;
@@ -235,25 +235,25 @@
    * Define the contents of a model.
    *
    * @param uri the {@link URI} of the model to be redefined
-   * @param modelExpression the new content for the model
+   * @param graphExpression 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,
-      ModelExpression modelExpression) throws QueryException, RemoteException;
+      GraphExpression graphExpression) 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 modelExpression the new content for the model
+   * @param graphExpression 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,
-                      ModelExpression modelExpression) throws QueryException,
+                      GraphExpression graphExpression) 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	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -46,7 +46,7 @@
 import org.mulgara.query.AskQuery;
 import org.mulgara.query.ConstructQuery;
 import org.mulgara.query.GraphAnswer;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
 import org.mulgara.rules.RulesRef;
@@ -133,19 +133,19 @@
    * Sets the contents of a model, via a model expression.
    *
    * @param uri The name of the model to set.
-   * @param modelExpression The expression describing the data to put in the model.
+   * @param graphExpression 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, ModelExpression modelExpression) throws QueryException {
+  public long setModel(URI uri, GraphExpression graphExpression) throws QueryException {
 
     try {
-      long r = remoteSession.setModel(uri, modelExpression);
+      long r = remoteSession.setModel(uri, graphExpression);
       resetRetries();
       return r;
     } catch (RemoteException e) {
       testRetry(e);
-      return setModel(uri, modelExpression);
+      return setModel(uri, graphExpression);
     }
   }
 
@@ -155,20 +155,20 @@
    *
    * @param inputStream a remote inputstream
    * @param uri the {@link URI} of the model to be redefined
-   * @param modelExpression the new content for the model
+   * @param graphExpression 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, ModelExpression modelExpression) throws QueryException {
+  public long setModel(InputStream inputStream, URI uri, GraphExpression graphExpression) throws QueryException {
 
     try {
 
-      long r = remoteSession.setModel(inputStream, uri, modelExpression);
+      long r = remoteSession.setModel(inputStream, uri, graphExpression);
       resetRetries();
       return r;
     } catch (RemoteException e) {
       testRetry(e);
-      return setModel(inputStream, uri, modelExpression);
+      return setModel(inputStream, uri, graphExpression);
     }
   }
 

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	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -44,7 +44,7 @@
 import org.mulgara.query.ArrayAnswer;
 import org.mulgara.query.AskQuery;
 import org.mulgara.query.ConstructQuery;
-import org.mulgara.query.ModelExpression;
+import org.mulgara.query.GraphExpression;
 import org.mulgara.query.Query;
 import org.mulgara.query.QueryException;
 import org.mulgara.query.TuplesException;
@@ -93,17 +93,17 @@
   }
 
   /**
-   * Sets the Model attribute of the SessionWrapperRemoteSession object
+   * Sets the Graph attribute of the SessionWrapperRemoteSession object
    *
-   * @param uri The new Model value
-   * @param modelExpression The new Model value
+   * @param uri The new Graph value
+   * @param graphExpression The new Graph value
    * @return RETURNED VALUE TO DO
    * @throws QueryException EXCEPTION TO DO
    * @throws RemoteException EXCEPTION TO DO
    */
-  public long setModel(URI uri, ModelExpression modelExpression) throws QueryException, RemoteException {
+  public long setModel(URI uri, GraphExpression graphExpression) throws QueryException, RemoteException {
     try {
-      return session.setModel(uri, modelExpression);
+      return session.setModel(uri, graphExpression);
     } catch (Throwable t) {
       throw convertToQueryException(t);
     }
@@ -114,13 +114,13 @@
    *
    * @param inputStream a remote inputstream
    * @param uri the {@link URI} of the model to be redefined
-   * @param modelExpression the new content for the model
+   * @param graphExpression 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, ModelExpression modelExpression) throws QueryException {
+  public long setModel(InputStream inputStream, URI uri, GraphExpression graphExpression) throws QueryException {
     try {
-      return session.setModel(inputStream, uri, modelExpression);
+      return session.setModel(inputStream, uri, graphExpression);
     } catch (Throwable t) {
       throw convertToQueryException(t);
     }

Modified: trunk/src/jar/tag/java/org/mulgara/extractor/tag/InitTag.java
===================================================================
--- trunk/src/jar/tag/java/org/mulgara/extractor/tag/InitTag.java	2008-12-04 23:38:27 UTC (rev 1398)
+++ trunk/src/jar/tag/java/org/mulgara/extractor/tag/InitTag.java	2008-12-05 05:42:29 UTC (rev 1399)
@@ -295,7 +295,7 @@
 
       if (model == null) {
 
-        throw new JspTagException("init: Model URI cannot be null");
+        throw new JspTagException("init: Graph URI cannot be null");
       }
 
       // end if




More information about the Mulgara-svn mailing list