JENA-1492: Pass transactions down from general datasets

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/4e724c2f
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/4e724c2f
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/4e724c2f

Branch: refs/heads/master
Commit: 4e724c2f82f7b9ef38dbeca4294c42ea6aa919a1
Parents: 4a819f4
Author: Andy Seaborne <a...@apache.org>
Authored: Sat Mar 3 16:25:48 2018 +0000
Committer: Andy Seaborne <a...@apache.org>
Committed: Sun Mar 4 00:21:08 2018 +0000

----------------------------------------------------------------------
 .../arq/examples/riot/ExJsonLD.java             |  14 +-
 .../org/apache/jena/query/DatasetFactory.java   |  32 ++-
 .../jena/query/QueryExecutionFactory.java       |   4 +-
 .../org/apache/jena/riot/system/RiotLib.java    |  19 +-
 .../org/apache/jena/sparql/algebra/Algebra.java |   4 +-
 .../jena/sparql/core/DatasetGraphFactory.java   |  21 +-
 .../jena/sparql/core/DatasetGraphMap.java       |   2 +-
 .../jena/sparql/core/DatasetGraphMapLink.java   | 101 ++++-----
 .../jena/sparql/core/DatasetGraphOne.java       |  22 +-
 .../apache/jena/sparql/core/DatasetImpl.java    |   6 +-
 .../org/apache/jena/sparql/core/DatasetOne.java |  84 +++++++
 .../jena/sparql/core/TxnDataset2Graph.java      | 224 +++++++++++++++++++
 .../core/assembler/DatasetAssemblerVocab.java   |   3 +
 .../assembler/DatasetGraphOneAssembler.java     |  82 +++++++
 .../apache/jena/sparql/util/QueryExecUtils.java |   2 +-
 .../query/TestParameterizedSparqlString.java    |   2 +-
 .../jena/riot/lang/ParserTestBaseLib.java       |   2 +-
 .../jena/riot/writer/TestJsonLDWriter.java      |   4 +-
 .../sparql/api/TestQueryExecutionTimeout1.java  |   2 +-
 .../sparql/api/TestQueryExecutionTimeout2.java  |   2 +-
 .../transaction/TestTransactionSupport.java     |   4 +-
 .../jena/dboe/trans/bplustree/BPTreeNode.java   |  18 --
 .../apache/jena/tdb2/store/DatasetGraphTDB.java |  17 +-
 .../jena/tdb2/store/GraphViewSwitchable.java    |  11 +
 .../jena/test/txn/TS_TranactionIntegration.java |  31 +++
 .../apache/jena/test/txn/TestDataset2Graph.java | 157 +++++++++++++
 .../jena/rdfconnection/RDFConnection.java       |   2 -
 .../jena/rdfconnection/RDFConnectionLocal.java  |   3 +-
 28 files changed, 750 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java
----------------------------------------------------------------------
diff --git a/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java 
b/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java
index 677e584..21e5d67 100644
--- a/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java
+++ b/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java
@@ -23,6 +23,8 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.StringReader;
 
+import com.github.jsonldjava.core.JsonLdOptions;
+
 import org.apache.jena.query.DatasetFactory;
 import org.apache.jena.rdf.model.Model ;
 import org.apache.jena.rdf.model.ModelFactory;
@@ -38,8 +40,6 @@ import org.apache.jena.sparql.util.Context;
 import org.apache.jena.vocabulary.RDF;
 import org.apache.jena.vocabulary.RDFS;
 
-import com.github.jsonldjava.core.JsonLdOptions;
-
 /** Example writing as JSON-LD */
 public class ExJsonLD
 {
@@ -123,7 +123,7 @@ public class ExJsonLD
 
         // the write method takes a DatasetGraph as input to represent the 
data that we want to output
         // Let's create one from our model:
-        DatasetGraph g = DatasetFactory.create(m).asDatasetGraph();
+        DatasetGraph g = DatasetFactory.wrap(m).asDatasetGraph();
 
         // and let's use the write method to output the data in json-ld 
compact format,
         // passing a null Context for the moment
@@ -161,7 +161,7 @@ public class ExJsonLD
         Model m = aSimpleModel();
         m.setNsPrefix("ex", "http://www.ex.com/";);
         m.setNsPrefix("sh", "http://schema.org/";);
-        DatasetGraph g = DatasetFactory.create(m).asDatasetGraph();
+        DatasetGraph g = DatasetFactory.wrap(m).asDatasetGraph();
         JsonLDWriteContext ctx = new JsonLDWriteContext();
 
         // When no value for the "@context" is provided, 
@@ -199,7 +199,7 @@ public class ExJsonLD
         // "@context" : "http://schema.org/";
 
         Model m = aModelThatOnlyUsesSchemaDotOrg();
-        DatasetGraph g = DatasetFactory.create(m).asDatasetGraph();
+        DatasetGraph g = DatasetFactory.wrap(m).asDatasetGraph();
         JsonLDWriteContext ctx = new JsonLDWriteContext();
 
         // The following should work, but unfortunately it doesn't (with 
JSONLD-java 0.8.3):
@@ -270,7 +270,7 @@ public class ExJsonLD
         m.add(s, m.createProperty(ns + "name"), "Not a person");
         m.add(s, RDF.type, m.createResource(ns + "Event"));
 
-        DatasetGraph g = DatasetFactory.create(m).asDatasetGraph();
+        DatasetGraph g = DatasetFactory.wrap(m).asDatasetGraph();
         JsonLDWriteContext ctx = new JsonLDWriteContext();
 
         // only output the persons using a frame
@@ -289,7 +289,7 @@ public class ExJsonLD
         Model m = aSimpleModel();
         m.setNsPrefix("ex", "http://www.ex.com/";);
         m.setNsPrefix("sh", "http://schema.org/";);
-        DatasetGraph g = DatasetFactory.create(m).asDatasetGraph();
+        DatasetGraph g = DatasetFactory.wrap(m).asDatasetGraph();
         JsonLDWriteContext ctx = new JsonLDWriteContext();
         JsonLdOptions opts = new JsonLdOptions();
         ctx.setOptions(opts);

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/query/DatasetFactory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/query/DatasetFactory.java 
b/jena-arq/src/main/java/org/apache/jena/query/DatasetFactory.java
index 7ec58b8..45dac4a 100644
--- a/jena-arq/src/main/java/org/apache/jena/query/DatasetFactory.java
+++ b/jena-arq/src/main/java/org/apache/jena/query/DatasetFactory.java
@@ -28,6 +28,7 @@ import org.apache.jena.sparql.ARQException;
 import org.apache.jena.sparql.core.DatasetGraph;
 import org.apache.jena.sparql.core.DatasetGraphFactory;
 import org.apache.jena.sparql.core.DatasetImpl;
+import org.apache.jena.sparql.core.DatasetOne;
 import org.apache.jena.sparql.core.assembler.DatasetAssembler;
 import org.apache.jena.sparql.util.DatasetUtils;
 import org.apache.jena.sparql.util.graph.GraphUtils;
@@ -109,9 +110,15 @@ public class DatasetFactory {
     }
 
     /**
-        * @param model The model for the default graph
-        * @return a dataset with the given model as the default graph
-        */
+     * Create a dataset, starting with the model argument as the default graph 
of the
+     * dataset. Named graphs can be added. 
+     * <p> 
+     * Use {@link #wrap(Model)} to put dataset functionality around a single
+     * model when named graphs will not be added.
+     * 
+     * @param model The model for the default graph
+     * @return a dataset with the given model as the default graph
+     */
        public static Dataset create(Model model) {
            Objects.requireNonNull(model, "Default model must be provided") ;
                return new DatasetImpl(model);
@@ -135,11 +142,26 @@ public class DatasetFactory {
         * @return Dataset
         */
        public static Dataset wrap(DatasetGraph dataset) {
-           Objects.requireNonNull(dataset, "Can't wrap a null reference") ;
+           Objects.requireNonNull(dataset, "Can't wrap a null DatasetGraph 
reference") ;
                return DatasetImpl.wrap(dataset);
        }
 
-       /**
+    /**
+     * Wrap a {@link Model} to make a dataset; the model is the default graph 
of the RDF Dataset. 
+     * 
+     * This dataset can not have additional models
+     * added to it, including indirectly through SPARQL Update
+     * adding new graphs.
+     *
+     * @param model
+     * @return Dataset
+     */
+    public static Dataset wrap(Model model) {
+        Objects.requireNonNull(model, "Can't wrap a null Model reference") ;
+        return DatasetOne.create(model);
+    }
+
+    /**
         * Wrap a {@link DatasetGraph} to make a dataset
         *
         * @param dataset DatasetGraph

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/query/QueryExecutionFactory.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/query/QueryExecutionFactory.java 
b/jena-arq/src/main/java/org/apache/jena/query/QueryExecutionFactory.java
index 7e2adf1..2414d3a 100644
--- a/jena-arq/src/main/java/org/apache/jena/query/QueryExecutionFactory.java
+++ b/jena-arq/src/main/java/org/apache/jena/query/QueryExecutionFactory.java
@@ -126,7 +126,7 @@ public class QueryExecutionFactory
     static public QueryExecution create(Query query, Model model) {
         checkArg(query) ;
         checkArg(model) ;
-        return make(query, DatasetFactory.create(model)) ;
+        return make(query, DatasetFactory.wrap(model)) ;
     }
 
     /** Create a QueryExecution to execute over the Model.
@@ -201,7 +201,7 @@ public class QueryExecutionFactory
      */
     static public QueryExecution create(Query query, Model model, 
QuerySolution initialBinding) {
         checkArg(model) ;
-        return create(query, DatasetFactory.create(model), initialBinding) ;
+        return create(query, DatasetFactory.wrap(model), initialBinding) ;
     }
     
     /** Create a QueryExecution to execute over the Model, 

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java 
b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java
index 8966735..359f746 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/RiotLib.java
@@ -327,14 +327,17 @@ public class RiotLib
         }
     }
 
-    /** Returns dataset that wraps a graph */
-    public static DatasetGraph dataset(Graph graph)
-    {
-        return DatasetGraphFactory.createOneGraph(graph);
+    /** Returns dataset that wraps a graph
+     * @deprecated Use {@link DatasetGraphFactory#wrap(Graph)}
+     * @param graph
+     * @return DatasetGraph
+     */
+    @Deprecated
+    public static DatasetGraph xdataset(Graph graph) {
+        return DatasetGraphFactory.wrap(graph);
     }
 
-    public static PrefixMap prefixMap(DatasetGraph dsg)
-    {
+    public static PrefixMap prefixMap(DatasetGraph dsg) {
         return 
PrefixMapFactory.create(dsg.getDefaultGraph().getPrefixMapping());
     }
 
@@ -413,10 +416,10 @@ public class RiotLib
     
         @Override
         public void write(OutputStream out, Graph graph, PrefixMap prefixMap, 
String baseURI, Context context)
-        { writer.write(out, RiotLib.dataset(graph), prefixMap, baseURI, 
context); }
+        { writer.write(out, DatasetGraphFactory.wrap(graph), prefixMap, 
baseURI, context); }
         
         @Override
         public void write(Writer out, Graph graph, PrefixMap prefixMap, String 
baseURI, Context context)
-        { writer.write(out, RiotLib.dataset(graph), prefixMap, baseURI, 
context); }
+        { writer.write(out, DatasetGraphFactory.wrap(graph), prefixMap, 
baseURI, context); }
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Algebra.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Algebra.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Algebra.java
index ed3af57..7657c6d 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Algebra.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/Algebra.java
@@ -136,7 +136,7 @@ public class Algebra
 
     static public QueryIterator exec(Op op, Graph graph)
     {
-        return exec(op, DatasetGraphFactory.createOneGraph(graph)) ;
+        return exec(op, DatasetGraphFactory.wrap(graph)) ;
     }
 
     static public QueryIterator exec(Op op, DatasetGraph ds)
@@ -160,7 +160,7 @@ public class Algebra
 
     static public QueryIterator execRef(Op op, Graph graph)
     {
-        return execRef(op, DatasetGraphFactory.createOneGraph(graph)) ;
+        return execRef(op, DatasetGraphFactory.wrap(graph)) ;
     }
 
     static public QueryIterator execRef(Op op, DatasetGraph dsg)

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java
index 18060fc..29af401 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java
@@ -36,7 +36,8 @@ public class DatasetGraphFactory
      * <p>
      * This implementation copies models when {@link 
Dataset#addNamedModel(String, Model)} is called.
      * <p>
-     * This implementation does not support serialized transactions (it only 
provides MRSW locking). 
+     * This implementation provides "best effort" transactions; it only 
provides MRSW locking.
+     * Use {@link #createTxnMem} for a proper in-memeory transactional {@code 
DatasetGraph}.
      * 
      * @see #createTxnMem
      */
@@ -45,7 +46,7 @@ public class DatasetGraphFactory
     }
 
     /**
-     * Create an in-memory. transactional {@link Dataset}.
+     * Create an in-memory, transactional {@link Dataset}.
      * <p> 
      * This fully supports transactions, including abort to roll-back changes.
      * It provides "autocommit" if operations are performed
@@ -60,7 +61,7 @@ public class DatasetGraphFactory
 
     /**
      * Create a general-purpose  {@link Dataset}.<br/>
-     * Any graphs needed are in-memory unless explciitly added with {@link 
Dataset#addNamedModel}.
+     * Any graphs needed are in-memory unless explicitly added with {@link 
Dataset#addNamedModel}.
      * </p>
      * This dataset type can contain graphs from any source when added via 
{@link Dataset#addNamedModel}.
      * These are held as links to the supplied graph and not copied.
@@ -73,7 +74,9 @@ public class DatasetGraphFactory
      * @see #createTxnMem
      * @return a general-purpose Dataset
      */
-    public static DatasetGraph createGeneral() { return new 
DatasetGraphMapLink(graphMakerMem) ; }
+    public static DatasetGraph createGeneral() { 
+        return new DatasetGraphMapLink(graphMakerMem.create(null), 
graphMakerMem) ;
+    }
 
     /** Create an in-memory {@link Dataset}.
      * <p>
@@ -137,7 +140,15 @@ public class DatasetGraphFactory
     /**
      * Create a DatasetGraph which only ever has a single default graph.
      */
-    public static DatasetGraph createOneGraph(Graph graph) { return new 
DatasetGraphOne(graph) ; }
+    public static DatasetGraph wrap(Graph graph) { return 
DatasetGraphOne.create(graph) ; }
+
+    
+    /**
+     * Create a DatasetGraph which only ever has a single default graph.
+     * @deprecated Use {#wrap(Graph)} 
+     */
+    @Deprecated
+    public static DatasetGraph createOneGraph(Graph graph) { return 
wrap(graph) ; }
 
     /** Interface for making graphs when a dataset needs to add a new graph.
      *  Return null for no graph created.

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMap.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMap.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMap.java
index 6eebbcf..c01f250 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMap.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMap.java
@@ -152,7 +152,7 @@ public class DatasetGraphMap extends 
DatasetGraphTriplesQuads
         if ( g == null ) {
             g = getGraphCreate(graphNode);
             if ( g != null )
-                addGraph(graphNode, g);
+                graphs.put(graphNode, g);
         }
         return g;
     }

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMapLink.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMapLink.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMapLink.java
index 90efd0e..a0d834c 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMapLink.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphMapLink.java
@@ -28,11 +28,12 @@ import org.apache.jena.query.ReadWrite ;
 import org.apache.jena.query.TxnType;
 import org.apache.jena.sparql.SystemARQ ;
 import org.apache.jena.sparql.core.DatasetGraphFactory.GraphMaker ;
+import org.apache.jena.sparql.graph.GraphFactory;
 import org.apache.jena.sparql.graph.GraphUnionRead ;
+import org.apache.jena.sparql.graph.GraphZero;
 
-/** Implementation of a DatasetGraph as an extensible set of graphs.
- *  <p>
- *  Graphs are held by reference. Care is needed when manipulating their 
contents
+/** Implementation of a DatasetGraph as an extensible set of graphs where 
graphs are held by reference.
+ *  Care is needed when manipulating their contents
  *  especially if they are also in another {@code DatasetGraph}.
  *  <p> 
  *  See {@link DatasetGraphMap} for an implementation that copies graphs
@@ -44,11 +45,13 @@ import org.apache.jena.sparql.graph.GraphUnionRead ;
  */
 public class DatasetGraphMapLink extends DatasetGraphCollection
 {
-    
     private final GraphMaker graphMaker ;
     private final Map<Node, Graph> graphs = new HashMap<>() ;
 
     private Graph defaultGraph ;
+    private final Transactional txn;
+    private final TxnDataset2Graph txnDsg2Graph;
+    private static GraphMaker dftGraphMaker = (name) -> 
GraphFactory.createDefaultGraph();
 
     /**
      * Create a new {@code DatasetGraph} that copies the dataset structure of 
default
@@ -56,7 +59,7 @@ public class DatasetGraphMapLink extends 
DatasetGraphCollection
      * Any new graphs needed are separate from the original dataset and 
created in-memory. 
      */
     public static DatasetGraph cloneStructure(DatasetGraph dsg) {
-        return new DatasetGraphMapLink(dsg);
+        return cloneStructure(dsg, dftGraphMaker);
     }
     
     /**
@@ -66,64 +69,44 @@ public class DatasetGraphMapLink extends 
DatasetGraphCollection
      * to the {@link GraphMaker}.
      */
     public static DatasetGraph cloneStructure(DatasetGraph dsg, GraphMaker 
graphMaker) {
-        return new DatasetGraphMapLink(dsg, graphMaker);
+        DatasetGraphMapLink dsg2 = new DatasetGraphMapLink((Graph)null, 
graphMaker);
+        linkGraphs(dsg, dsg2);
+        return dsg2;
     }
 
-    /** Create a new DatasetGraph that initially shares the graphs of the
-     * given DatasetGraph.  Adding/removing graphs will only affect this
-     * object, not the argument DatasetGraph but changes to shared
-     * graphs are seen by both objects.
-     */
-    private DatasetGraphMapLink(DatasetGraph dsg, GraphMaker graphMaker) {
-        this.graphMaker = graphMaker ; 
-        this.defaultGraph = dsg.getDefaultGraph() ;
-        for ( Iterator<Node> names = dsg.listGraphNodes() ; names.hasNext() ; 
) {
+    private static void linkGraphs(DatasetGraph srcDsg, DatasetGraphMapLink 
dstDsg) {
+        dstDsg.defaultGraph = srcDsg.getDefaultGraph();
+        for ( Iterator<Node> names = srcDsg.listGraphNodes() ; names.hasNext() 
; ) {
             Node gn = names.next() ;
-            addGraph(gn, dsg.getGraph(gn)) ;
+            dstDsg.addGraph(gn, srcDsg.getGraph(gn)) ;
         }
     }
 
-    /** 
-     *  A {@code DatasetGraph} with graphs for default and named graphs as 
given
-     *  but new graphs are created in memory.
-     */
-    private DatasetGraphMapLink(DatasetGraph dsg) {
-        this(dsg, DatasetGraphFactory.graphMakerMem) ;
-    }
-
-    private DatasetGraphMapLink(Graph dftGraph, GraphMaker graphMaker) {
-        this.graphMaker = graphMaker;
-        this.defaultGraph = dftGraph ;
-    }
-    
-//    /** A {@code DatasetGraph} with in-memory graphs for default and named 
graphs as needed */ 
-//    private DatasetGraphMapLink() {
-//        this(DatasetGraphFactory.memGraphMaker) ; 
-//    }
-    
-    /**
-     * A {@code DatasetGraph} with graph from the gve {@link GraphMaker} for 
default and
-     * named graphs as needed. This is the constructor used for
-     * DatasetFactory.createGeneral.
-     */
-    /*package*/ DatasetGraphMapLink(GraphMaker graphMaker) {
-        this(graphMaker.create(null), graphMaker) ;
-    }
-
     /** A {@code DatasetGraph} that uses the given graph for the default graph
      *  and create in-memory graphs for named graphs as needed
      */
     public DatasetGraphMapLink(Graph dftGraph) {
-        this.defaultGraph = dftGraph ;
-        this.graphMaker = DatasetGraphFactory.graphMakerMem ;
+        this(dftGraph, dftGraphMaker);
     }
 
-    // ----
-    private final Transactional txn                     = 
TransactionalLock.createMRSW() ;
+    // This is the root constructor. 
+    @SuppressWarnings("deprecation")
+    /*package*/DatasetGraphMapLink(Graph dftGraph, GraphMaker graphMaker) {
+        this.graphMaker = graphMaker;
+        this.defaultGraph = dftGraph;
+        if ( TxnDataset2Graph.TXN_DSG_GRAPH ) {
+            txnDsg2Graph = new TxnDataset2Graph(dftGraph);
+            txn = txnDsg2Graph;
+        } else {
+            txnDsg2Graph = null;
+            txn = TransactionalLock.createMRSW();
+        }
+    }
 
     @Override
     public void commit() {
-        SystemARQ.sync(this);
+        if ( txnDsg2Graph == null )
+            SystemARQ.sync(this);
         txn.commit() ;
     }
 
@@ -131,7 +114,7 @@ public class DatasetGraphMapLink extends 
DatasetGraphCollection
     @Override public void begin(TxnType txnType)        { txn.begin(txnType); }
     @Override public void begin(ReadWrite mode)         { txn.begin(mode); }
     @Override public boolean promote(Promote txnType)   { return 
txn.promote(txnType); }
-    //@Override public void commit()                      { txn.commit(); }
+    //Above: commit()
     @Override public void abort()                       { txn.abort(); }
     @Override public boolean isInTransaction()          { return 
txn.isInTransaction(); }
     @Override public void end()                         { txn.end(); }
@@ -155,7 +138,7 @@ public class DatasetGraphMapLink extends 
DatasetGraphCollection
 
     @Override
     public Graph getGraph(Node graphNode) {
-        // Same as DatasetMap.getGraph but we inherit differently.
+        // Same as DatasetGraphMap.getGraph but we inherit differently.
         if ( Quad.isUnionGraph(graphNode) ) 
             return new GraphUnionRead(this) ;
         if ( Quad.isDefaultGraph(graphNode))
@@ -165,30 +148,40 @@ public class DatasetGraphMapLink extends 
DatasetGraphCollection
         if ( g == null ) {
             g = getGraphCreate(graphNode);
             if ( g != null )
-                graphs.put(graphNode, g);
+                addGraph(graphNode, g);
         }
         return g;
     }
 
-    /** Called from getGraph when a nonexistent graph is asked for.
+    /**
+     * Called from getGraph when a nonexistent graph is asked for.
      * Return null for "nothing created as a graph"
      */
-    protected Graph getGraphCreate(Node graphNode) { 
+    protected Graph getGraphCreate(Node graphNode) {
         return graphMaker.create(graphNode) ;
     }
 
     @Override
     public void addGraph(Node graphName, Graph graph) {
+        if ( txnDsg2Graph != null )
+            txnDsg2Graph.addGraph(graph);
         graphs.put(graphName, graph);
     }
 
     @Override
     public void removeGraph(Node graphName) {
-        graphs.remove(graphName);
+        Graph g = graphs.remove(graphName);
+        if ( g != null && txnDsg2Graph != null )
+            txnDsg2Graph.removeGraph(g);
     }
 
     @Override
     public void setDefaultGraph(Graph g) {
+        if ( g == null )
+            // Always have a default graph of some kind.
+            g = GraphZero.instance();
+        if ( txnDsg2Graph != null )
+            txnDsg2Graph.addGraph(g);
         defaultGraph = g;
     }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java
index 89d76cb..faf37c7 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java
@@ -32,10 +32,11 @@ import org.apache.jena.query.TxnType;
 
 /** DatasetGraph of a single graph as default graph.
  * <p>
- *  Fixed as one graph (the default) - can not add named graphs.
+ *  Fixed as one graph (the default) - named graphs can notbe added nor the 
default graph changed, only the contents modified. 
  *  <p>
- *  Passes transactions down to a nominated backing {@link DatasetGraph}
- *  
+ *  Ths dataset passes transactions down to a nominated backing {@link 
DatasetGraph}
+ *  <p>
+ *  It is particular suitable for use with an interference graph.
  */
 public class DatasetGraphOne extends DatasetGraphBaseFind {
     private final Graph graph;
@@ -43,21 +44,30 @@ public class DatasetGraphOne extends DatasetGraphBaseFind {
     private final Transactional txn;
     private final boolean supportsAbort;
 
-    public DatasetGraphOne(Graph graph, DatasetGraph backing) {
+    public static DatasetGraph create(Graph graph) {
+        return new DatasetGraphOne(graph);
+    }
+    
+    private DatasetGraphOne(Graph graph, DatasetGraph backing) {
         this.graph = graph;
         backingDGS = backing;
         supportsAbort = backing.supportsTransactionAbort();
         txn = backing;
     }
     
-    public DatasetGraphOne(Graph graph) {
+    @SuppressWarnings("deprecation")
+    private DatasetGraphOne(Graph graph) {
         this.graph = graph;
         if ( graph instanceof GraphView ) {
             backingDGS = ((GraphView)graph).getDataset();
             txn = backingDGS;
             supportsAbort = backingDGS.supportsTransactionAbort();
         } else {
-            txn = TransactionalLock.createMRSW();
+            // JENA-1492 - pass down transactions.
+            if ( TxnDataset2Graph.TXN_DSG_GRAPH )
+                txn = new TxnDataset2Graph(graph);
+            else
+                txn = TransactionalLock.createMRSW();
             backingDGS = null;
             supportsAbort = false;
         }

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetImpl.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetImpl.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetImpl.java
index 2a145b1..614b82f 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetImpl.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetImpl.java
@@ -63,8 +63,7 @@ public class DatasetImpl implements Dataset
     /** Create a Dataset with the model as default model.
      *  Named models must be explicitly added to identify the storage to be 
used.
      */
-    public DatasetImpl(Model model)
-    {
+    public DatasetImpl(Model model) {
         this.dsg = DatasetGraphFactory.create(model.getGraph()) ;
         this.transactional = dsg ;
     }
@@ -73,8 +72,7 @@ public class DatasetImpl implements Dataset
      * while sharing the graphs themselves.  
      */
     @Deprecated
-    public DatasetImpl(Dataset ds)
-    {
+    public DatasetImpl(Dataset ds) {
         this(DatasetGraphFactory.cloneStructure(ds.asDatasetGraph())) ;
     }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetOne.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetOne.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetOne.java
new file mode 100644
index 0000000..27b597a
--- /dev/null
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetOne.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sparql.core;
+
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.query.Dataset;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.sparql.core.DatasetGraphOne;
+import org.apache.jena.sparql.core.DatasetImpl;
+
+/**
+ * A dataset that just hold a single model as the default graph. 
+ * It is particularly appropriate for use with inference models.
+ * 
+ * @apiNote
+ * This class makes the use of DatasetImpl with one fixed model clearer. It may
+ * become useful to have a separate implementation altogether at some time.
+ */
+public class DatasetOne extends DatasetImpl {
+    public static Dataset create(Model model) {
+        return new DatasetOne(model);
+    }
+
+    private final Model defaultModel;
+
+    public DatasetOne(Model model) {
+        super(DatasetGraphOne.create(model.getGraph()));
+        this.defaultModel = model;
+    }
+
+
+    @Override
+    public Model getDefaultModel() {
+        return defaultModel;
+    }
+
+    @Override
+    public Dataset setDefaultModel(Model model) {
+        throw new UnsupportedOperationException("Can not set the default model 
after a DatasetOne has been created");
+    }
+
+    @Override
+    public Model getNamedModel(String uri) {
+        checkGraphName(uri) ;
+        Node n = NodeFactory.createURI(uri) ;
+        return graph2model(dsg.getGraph(n)) ;
+    }
+
+    @Override
+    public Dataset addNamedModel(String uri, Model model) {
+        throw new UnsupportedOperationException("Can not add a named mode to 
DatasetOne");
+    }
+
+    @Override
+    public Dataset removeNamedModel(String uri) {
+        return this;
+    }
+
+    @Override
+    public Dataset replaceNamedModel(String uri, Model model) {
+        throw new UnsupportedOperationException("Can not replace a named model 
in DatasetOne");
+    }
+    @Override
+    public boolean containsNamedModel(String uri) {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java
new file mode 100644
index 0000000..d03cc6e
--- /dev/null
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sparql.core;
+
+import java.util.*;
+import java.util.function.Consumer;
+
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.TransactionHandler;
+import org.apache.jena.query.ReadWrite;
+import org.apache.jena.query.TxnType;
+import org.apache.jena.reasoner.InfGraph;
+import org.apache.jena.shared.LockMRSW;
+import org.apache.jena.sparql.JenaTransactionException;
+
+/**
+ * A {@link Transactional} that passes the transaction operations down to 
transactions on
+ * independent graphs.
+ * <p>
+ * There are limitations:
+ * <ul>
+ * <li>we can't atomically do all the commits together in the crash situation.
+ * <li>This {@code Transactional} maintains a MRSW policy because that is all 
that is
+ * required of graphs in general.
+ * </ul>
+ * It does cover the important case of one graph ({@link DatasetGraphOne}) 
where the one
+ * graph is an InfGraph and should work when the graphs in the dataset is not 
changing or
+ * when a new memory graph is added mid-transaction.
+ * <p>
+ * This is not "nested transactions" - theer is no overall "commit" or 
"abort". If
+ * failure/restart occurs, some graphs may have commited and others not. It is 
the best
+ * that can be done given for an arbitrary collection of graphs, backed by 
different
+ * storage and having different capabilities.
+ * <p>
+ * Best practice is to change the graph membership outside of any transaction,
+ * ideally at setup time of the object using this class. (Caution: SPARQL 
Update
+ * can create graphs.   
+ * @See {@link DatasetGraphMapLink}
+ * @See {@link DatasetGraphOne}
+ */
+public class TxnDataset2Graph extends TransactionalLock {
+    /** Control whether to pass down transactions from the dataset to the 
graph in the dataset.
+     *  This should be set to "true".
+     *  This is temporary flag during the transition because the change at 
Jena 3.7.0
+     *  needs to be proven in real deployments as well as testing. 
+     *  "false" restores the Jena 3.6.0 and before behaviour (transactions not 
passed down).
+     *  See JENA-1492.
+     *  @deprecated This flag will be removed.  
+     */
+    @Deprecated
+    public static boolean TXN_DSG_GRAPH = true;
+    
+    private Graph primary;
+    // Object key may be a graph or a DSG is the graph is a GraphView.
+    // This avoids starting a tranasction on the same storage unit twice. 
+    private Map<Object, TransactionHandler> handlers = new HashMap<>();
+        
+    private Object lock = new Object();
+    
+    public TxnDataset2Graph(Graph primaryGraph, Graph ... otherGraphs) {
+        super(new LockMRSW());
+        primary = primaryGraph;
+        handlers = buildHandlerSet(primary, Arrays.asList(otherGraphs));
+    }
+    
+    private static Map<Object, TransactionHandler> buildHandlerSet(Graph 
primary, Collection<Graph> graphs) {
+        Map<Object, TransactionHandler> handlers = new HashMap<>();
+        addHandler(handlers, primary);
+        graphs.forEach(g->addHandler(handlers,g));
+        return handlers;
+    }
+    
+    private static void addHandler(Map<Object, TransactionHandler> handlers, 
Graph graph) {
+        TransactionHandler th = graph.getTransactionHandler();
+        if ( ! th.transactionsSupported() )
+            return;
+        Object key = calcKey(graph);
+        if ( th.transactionsSupported() )
+            handlers.put(key, th) ;
+    }
+
+    // Determine the key - an object that is the unit of transactions.
+    // For two graphs form the same DatasetGraph, i.e. GraphView, there should 
be one transaction.
+    private static Object calcKey(Graph graph) {
+        if ( graph instanceof GraphView )
+            // Use the database as the key so that transactions are started 
once-per-storage.
+            // This the case of a graph from some storage being plavced in a 
general dataset.  
+            return ((GraphView)graph).getDataset();
+        if ( graph instanceof InfGraph )
+            // InfGraph does actual pass done in its TransactionHandler.
+            // This allows the base graph to be included in the dataset as 
well as the InfGraph. 
+            return calcKey(((InfGraph)graph).getRawGraph());
+        
+//        if ( graph instanceof GraphWrapper )
+//            return calcKey(((GraphWrapper)graph).get());
+//        if ( graph instanceof WrappedGraph )
+//            return calcKey(((WrappedGraph)graph).getWrapped());
+        return graph;
+    }
+
+    private static void removeHandler(Map<Object, TransactionHandler> 
handlers, Graph graph) {
+        Object key = calcKey(graph);
+        handlers.remove(graph);
+    }
+
+    // Attempt to manage the graph transactions during a transaction.
+    // Imperfect for removal, we don't know whether to call commit() or 
abort().
+    // Works for adding.
+    // Generally better not to change the graphs during a transaction, just 
set them once
+    // on creation.
+    
+    public void addGraph(Graph graph) {
+        checkNotReadMode();
+        if ( graph == null )
+            return;
+        if ( ! handlers.containsKey(graph) ) {
+            // Add if new.
+            addHandler(handlers, graph) ;
+            if ( super.isInTransaction() ) {
+                // If we are in a transaction, start the subtransaction. 
+                TransactionHandler th = handlers.get(graph);
+                if ( th != null )
+                    th.begin();
+            }
+        }
+    }
+    
+    public void removeGraph(Graph graph) {
+        checkNotReadMode();
+        if ( graph == null )
+            return;
+        if ( ! super.isInTransaction() ) {
+            // Not in transaction, do now. 
+            removeHandler(handlers, graph);
+            return;
+        }
+        // Queue to be removed at the end.
+        Set<Graph> toBeRemoved = removedGraphs.get();
+        if ( toBeRemoved == null ) {
+            // Lazy set of the HashSet. 
+            toBeRemoved = new HashSet<>();
+            removedGraphs.set(toBeRemoved);
+        }
+        removedGraphs.get().add(graph);
+    }
+
+    public void setPrimaryGraph(Graph graph) {
+        checkNotReadMode();
+        if ( graph == null )
+            return;
+        removeGraph(graph);
+        addGraph(graph);
+    }
+    
+    private void handlers(Consumer<TransactionHandler> action) {
+        synchronized (lock) {
+            handlers.forEach((g,th)->action.accept(th));
+        }
+    }
+
+    private void checkNotReadMode() {
+        if ( !super.isInTransaction() )
+            return;
+        if ( super.isTransactionMode(ReadWrite.READ) )
+            throw new JenaTransactionException("In READ mode in transaction");
+    }
+
+    private ThreadLocal<Set<Graph>> removedGraphs = 
ThreadLocal.withInitial(()->null);
+    private void start() {}
+    private void finish() {
+        if ( ! super.isTransactionMode(ReadWrite.WRITE) )
+            return;
+        // This is called inside the lock of super.
+        Set<Graph> toBeRemoved = removedGraphs.get();
+        removedGraphs.remove();
+        if ( toBeRemoved == null )
+            return ;
+        toBeRemoved.forEach(g->removeHandler(handlers, g));
+    }
+    
+    // TransactionalLock.begin(ReadWrite) calls begin(TxnType)
+    @Override
+    public void begin(TxnType type) {
+        super.begin(type);
+        // Whatever the type. Graph Transactions do not allow for "read-only".
+        start();
+        handlers(h->h.begin());
+    }
+
+    // The MRSW lock means this isn't possible. See super.promote.
+//    @Override
+//    public boolean promote(Promote mode)
+
+    @Override
+    public void commit() {
+        handlers(h->h.commit());
+        // Before super.commit - we stil hold the lock.
+        finish();
+        super.commit();
+    }
+
+    @Override
+    public void abort() {
+        handlers(h -> h.abort());
+        finish();
+        super.abort();
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssemblerVocab.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssemblerVocab.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssemblerVocab.java
index 17d13c0..5d26abe 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssemblerVocab.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssemblerVocab.java
@@ -30,6 +30,9 @@ public class DatasetAssemblerVocab
     
     // General dataset
     public static final Resource tDataset            = 
ResourceFactory.createResource(NS+"RDFDataset") ;
+    // Dataset to hold exactly one model.
+    public static final Resource tDatasetOne         = 
ResourceFactory.createResource(NS+"RDFDatasetOne") ;
+
     // In-memory dataset
     public static final Resource tDatasetTxnMem      = 
ResourceFactory.createResource(NS+"DatasetTxnMem") ;
     public static final Resource tMemoryDataset      = 
ResourceFactory.createResource(NS+"MemoryDataset") ;

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetGraphOneAssembler.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetGraphOneAssembler.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetGraphOneAssembler.java
new file mode 100644
index 0000000..ed33ebf
--- /dev/null
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetGraphOneAssembler.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.sparql.core.assembler;
+
+import java.util.List;
+
+import org.apache.jena.assembler.Assembler;
+import org.apache.jena.assembler.Mode;
+import org.apache.jena.assembler.assemblers.AssemblerBase;
+import org.apache.jena.assembler.exceptions.AssemblerException;
+import org.apache.jena.query.Dataset;
+import org.apache.jena.query.DatasetFactory;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.sparql.graph.GraphFactory;
+import org.apache.jena.sparql.util.graph.GraphUtils;
+
+/**
+ * An assembler that creates a dataset around a single graph. The dataset 
created is
+ * fixed; graphs can not be added or removed. The wrapped graph is the default 
graph of
+ * the dataset.
+ * <p>
+ * General datasets and SPARQL Update can create graphs by inserting a quad.
+ * The dataset returned by this assembler does not support that.
+ * 
+ * @see DatasetAssembler {@code DatasetAssembler}, for a general dataset.
+ * @see InMemDatasetAssembler {@code InMemDatasetAssembler}, for a fully 
transactional, in-memory dataset.
+ */
+public class DatasetGraphOneAssembler extends AssemblerBase {
+    public static Resource getType() {
+        return DatasetAssemblerVocab.tDatasetOne;
+    }
+
+    @Override
+    public Object open(Assembler a, Resource root, Mode mode) {
+        Dataset ds = createDataset(a, root, mode);
+        return ds;
+    }
+
+    public Dataset createDataset(Assembler a, Resource root, Mode mode) {
+        // Can use ja:graph or ja:defaultGraph but not both.
+        Resource dftGraphDesc1 = GraphUtils.getResourceValue(root, 
DatasetAssemblerVocab.pDefaultGraph);
+        Resource dftGraphDesc2 = GraphUtils.getResourceValue(root, 
DatasetAssemblerVocab.pGraph);
+        
+        if ( dftGraphDesc1 != null && dftGraphDesc2 != null )
+            throw new AssemblerException(root, "Found both ja:graph and 
ja:defaultGraph"); 
+        
+        Resource graphDesc = ( dftGraphDesc1 != null) ? dftGraphDesc1 : 
dftGraphDesc2 ;
+        Model model;
+        if ( graphDesc != null )
+            model = a.openModel(graphDesc);
+        else
+            // Assembler description did not define one.
+            model = GraphFactory.makeDefaultModel();
+        Dataset ds = DatasetFactory.wrap(model);
+        
+        List<RDFNode> nodes = GraphUtils.multiValue(root, 
DatasetAssemblerVocab.pNamedGraph);
+        if ( ! nodes.isEmpty() ) {
+            String x = DatasetAssemblerVocab.tDatasetOne.getLocalName();
+            throw new AssemblerException(root, "A "+x+" dataset can only hold 
a default graph, and no named graphs");
+        }
+        AssemblerUtils.setContext(root, ds.getContext());
+        return ds;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
index 61f2730..e2cbcef 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
@@ -302,7 +302,7 @@ public class QueryExecUtils {
      * that one RDFNode
      */
     public static RDFNode getExactlyOne(String qs, Model model) {
-        return getExactlyOne(qs, DatasetFactory.create(model)) ;
+        return getExactlyOne(qs, DatasetFactory.wrap(model)) ;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
 
b/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
index 7335f75..81e4ad7 100644
--- 
a/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
+++ 
b/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
@@ -245,7 +245,7 @@ public class TestParameterizedSparqlString {
         bnode.addProperty(RDF.type, OWL.Thing);
         Assert.assertEquals(1, model.size());
 
-        Dataset ds = DatasetFactory.create(model);
+        Dataset ds = DatasetFactory.wrap(model);
 
         // Use a parameterized query to check the data can be found
         ParameterizedSparqlString pq = new ParameterizedSparqlString();

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/test/java/org/apache/jena/riot/lang/ParserTestBaseLib.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/riot/lang/ParserTestBaseLib.java 
b/jena-arq/src/test/java/org/apache/jena/riot/lang/ParserTestBaseLib.java
index fbe32ed..00e851e 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/ParserTestBaseLib.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/ParserTestBaseLib.java
@@ -43,7 +43,7 @@ class ParserTestBaseLib {
     static DatasetGraph parseDataset(Lang lang, String ...strings) {
         DatasetGraph dsg = DatasetGraphFactory.create() ;
         StreamRDF dest = StreamRDFLib.dataset(dsg) ;
-        parse(lang, dest, strings) ;
+        parse(lang, dest, strings);
         return dsg ;
     }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java 
b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java
index cc8aff9..77a41fe 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestJsonLDWriter.java
@@ -507,7 +507,7 @@ public class TestJsonLDWriter extends BaseTest {
 
         m.setNsPrefix("", ns);
 
-        DatasetGraph g = DatasetFactory.create(m).asDatasetGraph();
+        DatasetGraph g = DatasetFactory.wrap(m).asDatasetGraph();
         PrefixMap pm = RiotLib.prefixMap(g);
         String base = null;
         Context jenaContext = null;
@@ -551,7 +551,7 @@ public class TestJsonLDWriter extends BaseTest {
     private String toString(Model m, RDFFormat f, Context jenaContext) {
         try(ByteArrayOutputStream out = new ByteArrayOutputStream()) {
             WriterDatasetRIOT w = RDFDataMgr.createDatasetWriter(f) ;
-            DatasetGraph g = DatasetFactory.create(m).asDatasetGraph();
+            DatasetGraph g = DatasetFactory.wrap(m).asDatasetGraph();
             PrefixMap pm = RiotLib.prefixMap(g);
             String base = null;
             w.write(out, g, pm, base, jenaContext) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout1.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout1.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout1.java
index c6fa162..c23f08e 100644
--- 
a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout1.java
+++ 
b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout1.java
@@ -38,7 +38,7 @@ import org.junit.Test ;
 public class TestQueryExecutionTimeout1 extends BaseTest
 {
     static Graph                g   = SSE.parseGraph("(graph (<s> <p> <o1>) 
(<s> <p> <o2>) (<s> <p> <o3>))") ;
-    static DatasetGraph         dsg = DatasetGraphFactory.createOneGraph(g) ;
+    static DatasetGraph         dsg = DatasetGraphFactory.wrap(g) ;
     static Dataset              ds  = DatasetFactory.wrap(dsg) ;
 
     private static final String ns  = "http://example/ns#"; ;

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout2.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout2.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout2.java
index 49d562d..71c0e61 100644
--- 
a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout2.java
+++ 
b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionTimeout2.java
@@ -51,7 +51,7 @@ public class TestQueryExecutionTimeout2
         " (<s> <p> 11)" +
         " (<s> <p> 12)" +
         ")") ;
-    static DatasetGraph         dsg = DatasetGraphFactory.createOneGraph(g) ;
+    static DatasetGraph         dsg = DatasetGraphFactory.wrap(g) ;
     static Dataset              ds  = DatasetFactory.wrap(dsg) ;
 
     private static void noException(ResultSet rs)

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-arq/src/test/java/org/apache/jena/sparql/transaction/TestTransactionSupport.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/transaction/TestTransactionSupport.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/transaction/TestTransactionSupport.java
index 46c955a..3b8d880 100644
--- 
a/jena-arq/src/test/java/org/apache/jena/sparql/transaction/TestTransactionSupport.java
+++ 
b/jena-arq/src/test/java/org/apache/jena/sparql/transaction/TestTransactionSupport.java
@@ -48,9 +48,9 @@ public class TestTransactionSupport {
         x.add(new Object[] {"create",
             (Creator<DatasetGraph>)()->DatasetGraphFactory.create(),
             true, false}) ;
-        x.add(new Object[] {"createOneGraph" ,
+        x.add(new Object[] {"wrap" ,
             (Creator<DatasetGraph>)()->
-                
DatasetGraphFactory.createOneGraph(GraphFactory.createDefaultGraph()),
+                DatasetGraphFactory.wrap(GraphFactory.createDefaultGraph()),
             true, true}) ;
         x.add(new Object[] {"createZeroGraph" ,
             (Creator<DatasetGraph>)()->new DatasetGraphZero(),

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-db/jena-dboe-trans-data/src/main/java/org/apache/jena/dboe/trans/bplustree/BPTreeNode.java
----------------------------------------------------------------------
diff --git 
a/jena-db/jena-dboe-trans-data/src/main/java/org/apache/jena/dboe/trans/bplustree/BPTreeNode.java
 
b/jena-db/jena-dboe-trans-data/src/main/java/org/apache/jena/dboe/trans/bplustree/BPTreeNode.java
index e3f0533..f808cb9 100644
--- 
a/jena-db/jena-dboe-trans-data/src/main/java/org/apache/jena/dboe/trans/bplustree/BPTreeNode.java
+++ 
b/jena-db/jena-dboe-trans-data/src/main/java/org/apache/jena/dboe/trans/bplustree/BPTreeNode.java
@@ -138,24 +138,6 @@ public final class BPTreeNode extends BPTreePage
         // Other set by BPTreeNodeMgr.formatBPTreeNode 
     }
     
-    // ---- [[TXN]] ** work for transactions.
-    void checkTxn() {}
-    void checkWriteTxn() {}
-
-//    static BPTreeNode xensureModifiableRoot(BPTreeNode root, Object state) {
-//        BPTreeNode root2 = promote1(root, root, NO_ID)(null, root) ;
-//        if ( root != root2 && root.getId() != root2.getId() ) {
-//            System.err.println("Cloned root") ;
-//            if ( state == null )
-//                System.err.println("... no state") ;
-//            // [[TXN]] ** Root clone
-//            // get state and update root.
-//        }
-//        return root2 ;
-//    }
-
-    // ----
-    
     @Override
     public void reset(Block block) {
         this.block = block ;

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/DatasetGraphTDB.java
----------------------------------------------------------------------
diff --git 
a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/DatasetGraphTDB.java
 
b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/DatasetGraphTDB.java
index 42690b2..2148930 100644
--- 
a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/DatasetGraphTDB.java
+++ 
b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/DatasetGraphTDB.java
@@ -39,6 +39,7 @@ import org.apache.jena.graph.Node ;
 import org.apache.jena.graph.Triple ;
 import org.apache.jena.query.ReadWrite ;
 import org.apache.jena.query.TxnType;
+import org.apache.jena.sparql.JenaTransactionException;
 import org.apache.jena.sparql.core.* ;
 import org.apache.jena.sparql.engine.optimizer.reorder.ReorderTransformation ;
 import org.apache.jena.tdb2.TDBException;
@@ -392,14 +393,28 @@ public class DatasetGraphTDB extends 
DatasetGraphTriplesQuads
     
     public Location getLocation()       { return storage.location ; }
 
+    /**
+     * Cause an exception to be thrown if sync is called.
+     * For TDB2, which is transactional only, so sync isn't a useful operation.
+     * It is implemented for completness and no more.
+     */
+    public static boolean exceptionOnSync = true ;
+
     @Override
     public void sync() {
+        if ( exceptionOnSync )
+            throw new JenaTransactionException("sync called");
         checkNotClosed();
+        syncStorage();
+    }
+
+    // Sync for internal puposes.
+    public void syncStorage() {
         storage.tripleTable.sync();
         storage.quadTable.sync();
         storage.prefixes.sync();
     }
-    
+
     @Override
     public void setDefaultGraph(Graph g) { 
         throw new UnsupportedOperationException("Can't set default graph on a 
TDB-backed dataset") ;

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/GraphViewSwitchable.java
----------------------------------------------------------------------
diff --git 
a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/GraphViewSwitchable.java
 
b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/GraphViewSwitchable.java
index cd5f561..760d9e4 100644
--- 
a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/GraphViewSwitchable.java
+++ 
b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/GraphViewSwitchable.java
@@ -21,11 +21,13 @@ package org.apache.jena.tdb2.store;
 import java.util.Map ;
 
 import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.TransactionHandler;
 import org.apache.jena.shared.PrefixMapping ;
 import org.apache.jena.shared.impl.PrefixMappingImpl ;
 import org.apache.jena.sparql.core.DatasetPrefixStorage;
 import org.apache.jena.sparql.core.GraphView;
 import org.apache.jena.sparql.core.Quad;
+import org.apache.jena.sparql.core.TransactionHandlerView;
 import org.apache.jena.sparql.expr.nodevalue.NodeFunctions;
 
 /** 
@@ -45,9 +47,13 @@ public class GraphViewSwitchable extends GraphView {
     private final DatasetGraphSwitchable dsgx;
     protected DatasetGraphSwitchable getx() { return dsgx; }
     
+    private TransactionHandler transactionHandler = null;
+    
     protected GraphViewSwitchable(DatasetGraphSwitchable dsg, Node gn) {
         super(dsg, gn) ;
         this.dsgx = dsg;
+        // Goes to the switchable DatasetGraph
+        this.transactionHandler = new TransactionHandlerView(dsgx);
     }
 
     @Override
@@ -63,6 +69,11 @@ public class GraphViewSwitchable extends GraphView {
         }
         return prefixMapping(gn);
     }
+
+    @Override
+    public TransactionHandler getTransactionHandler() {
+        return transactionHandler;
+    }
     
     /** Return the {@code DatasetGraphSwitchable} we are viewing. */
     @Override

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TS_TranactionIntegration.java
----------------------------------------------------------------------
diff --git 
a/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TS_TranactionIntegration.java
 
b/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TS_TranactionIntegration.java
new file mode 100644
index 0000000..e390ad2
--- /dev/null
+++ 
b/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TS_TranactionIntegration.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.test.txn;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+    TestDataset2Graph.class
+})
+
+public class TS_TranactionIntegration {
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TestDataset2Graph.java
----------------------------------------------------------------------
diff --git 
a/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TestDataset2Graph.java
 
b/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TestDataset2Graph.java
new file mode 100644
index 0000000..38e1e55
--- /dev/null
+++ 
b/jena-integration-tests/src/test/java/org/apache/jena/test/txn/TestDataset2Graph.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.test.txn;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.jena.atlas.iterator.Iter;
+import org.apache.jena.atlas.lib.Creator;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.query.*;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.rdfconnection.RDFConnectionFactory;
+import org.apache.jena.reasoner.rulesys.RDFSRuleReasonerFactory;
+import org.apache.jena.sparql.core.Quad;
+import org.apache.jena.sparql.core.TxnDataset2Graph;
+import org.apache.jena.sparql.sse.SSE;
+import org.apache.jena.system.Txn;
+import org.apache.jena.tdb.TDBFactory;
+import org.apache.jena.tdb2.TDB2Factory;
+import org.apache.jena.tdb2.store.DatasetGraphTDB;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+// Tests - programmatic construct, assembler construct.  Good and bad.
+//   TestDataset2Graph - TS_Transactions.
+//   DatasetFactory.wrap
+//   DatasetOne, DatasetGraphOne. <-- Flag needed.
+//   DatasetImpl
+
+/** Additional testing for "Dataset over Graph" transaction mapping */ 
+
+@RunWith(Parameterized.class)
+public class TestDataset2Graph {
+    private static boolean txn_dsg_graph; 
+    private static boolean tdb2_no_sync;
+    // TXN_DSG_GRAPH must be true.
+    @SuppressWarnings("deprecation")
+    @BeforeClass public static void beforeClass() {
+        txn_dsg_graph = TxnDataset2Graph.TXN_DSG_GRAPH;
+        TxnDataset2Graph.TXN_DSG_GRAPH = true;
+        // Make sure sync isn't called.
+        tdb2_no_sync = DatasetGraphTDB.exceptionOnSync;
+        DatasetGraphTDB.exceptionOnSync = true;
+    }
+    
+    @SuppressWarnings("deprecation")
+    @AfterClass public static void afterClass() {
+        TxnDataset2Graph.TXN_DSG_GRAPH = txn_dsg_graph;
+        DatasetGraphTDB.exceptionOnSync = tdb2_no_sync;
+    }
+
+    @Parameters(name = "{index}: {0}")
+    public static Collection<Object[]> data() {
+        Creator<Dataset> datasetPlainMaker = ()-> 
DatasetFactory.createTxnMem() ;
+        Creator<Dataset> datasetTxnMemMaker = ()-> 
DatasetFactory.createTxnMem() ;
+        Creator<Dataset> datasetTDB1 = ()-> TDBFactory.createDataset();
+        Creator<Dataset> datasetTDB2 = ()-> TDB2Factory.createDataset();
+        return Arrays.asList(new Object[][] { 
+            { "Plain",  datasetPlainMaker },
+            { "TIM",  datasetTxnMemMaker },
+            { "TDB1",  datasetTDB1 },
+            { "TDB2",  datasetTDB2 }
+        });
+    }
+
+    private final Creator<Dataset> creator;
+
+    public TestDataset2Graph(String name, Creator<Dataset> creator) {
+        this.creator = creator;
+    }
+
+    @Test public void dsgGraph_model() {
+        testInfModel(creator.create());
+    }
+
+    @Test public void dsgGraphTxnTDB_dataset_wrap() {
+        testOverDS(creator.create(), true);
+    }
+
+    @Test public void dsgGraphTxnTDB_dataset_create() {
+        testOverDS(creator.create(), false);
+    }
+    private static void testInfModel(Dataset ds0) {
+        Txn.executeWrite(ds0, ()->{});
+        Model baseModel = ds0.getDefaultModel(); 
+        Model model = 
ModelFactory.createInfModel(RDFSRuleReasonerFactory.theInstance().create(null), 
baseModel);
+        if ( model.getGraph().getTransactionHandler().transactionsSupported() 
) {
+            // InfModels do not support transactions per se - they particpate 
if includes in a suitabel dataset.
+            model.begin();
+            long x = Iter.count(model.listStatements());
+            model.commit();
+            assertTrue(x > 10);
+        }
+    }
+    
+    private static void testOverDS(Dataset ds0, boolean wrap) {
+        // Force to transactions / verify the DSG is transactional.
+        Txn.executeWrite(ds0, ()->{});
+        Model baseModel = ds0.getDefaultModel(); 
+        Model model = 
ModelFactory.createInfModel(RDFSRuleReasonerFactory.theInstance().create(null), 
baseModel);
+        Dataset ds1 = wrap ? DatasetFactory.wrap(model) : 
DatasetFactory.create(model);
+
+        try ( RDFConnection conn = RDFConnectionFactory.connect(ds1) ) {
+            
+            conn.querySelect("SELECT (count(*) AS ?C) { ?s ?p ?o } HAVING (?C 
= 0)", (qs)-> fail("Didn't expect any query solutions"));
+            
+            // Necessary
+            Txn.exec(conn, TxnType.READ, ()->{
+                try ( QueryExecution qExec = conn.query("SELECT * { ?s ?p ?o 
}") ) {
+                    long x = ResultSetFormatter.consume(qExec.execSelect());
+                    assertTrue(x > 10); // About106
+                }
+            });
+        }
+        
+        Triple t = SSE.parseTriple("(:s :p :o)");
+        Quad q = Quad.create(Quad.defaultGraphIRI, t);
+        
+        // Now write via top.
+        Txn.executeWrite(ds1, ()->{
+            ds1.asDatasetGraph().add(q);
+        });
+        
+        // And get it back again from storage.
+        Txn.exec(ds0, TxnType.READ, ()->{
+            assertEquals(1, ds0.asDatasetGraph().getDefaultGraph().size()); 
+            assertTrue(ds0.getDefaultModel().getGraph().contains(t));
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnection.java
----------------------------------------------------------------------
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnection.java
 
b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnection.java
index 3c5e374..2cd7e08 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnection.java
+++ 
b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnection.java
@@ -110,8 +110,6 @@ public interface RDFConnection extends
      */
     @Override
     public default void querySelect(String query, Consumer<QuerySolution> 
rowAction) {
-        //Parse local: querySelect(QueryFactory.create(query), rowAction);
-        // XXX Parse point.
         Txn.executeRead(this, ()->{ 
             try ( QueryExecution qExec = query(query) ) {
                 qExec.execSelect().forEachRemaining(rowAction);

http://git-wip-us.apache.org/repos/asf/jena/blob/4e724c2f/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionLocal.java
----------------------------------------------------------------------
diff --git 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionLocal.java
 
b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionLocal.java
index 2db693e..767ed3f 100644
--- 
a/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionLocal.java
+++ 
b/jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionLocal.java
@@ -70,7 +70,8 @@ public class RDFConnectionLocal implements RDFConnection {
     @Override
     public QueryExecution query(Query query) {
         checkOpen();
-        return Txn.calculateRead(dataset, 
()->QueryExecutionFactory.create(query, dataset));
+        // There is no point doing this in a transaction because the 
QueryExecution is passed out. 
+        return QueryExecutionFactory.create(query, dataset);
     }
 
     @Override

Reply via email to