You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2018/03/06 16:29:57 UTC

[07/12] jena git commit: Integration tests for dataset/graphs and some assemblers.

Integration tests for dataset/graphs and some assemblers.


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

Branch: refs/heads/master
Commit: 41eefd40e298b00fa35ff5b4b4cf3ec0aebccdf0
Parents: 4744cfc
Author: Andy Seaborne <an...@apache.org>
Authored: Sun Mar 4 15:41:04 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Mar 5 14:50:50 2018 +0000

----------------------------------------------------------------------
 .../jena/sparql/core/DatasetGraphOne.java       |  41 +++---
 .../jena/sparql/core/TransactionalLock.java     |   4 +-
 .../jena/sparql/core/TxnDataset2Graph.java      |  15 +-
 .../transaction/TestTransactionSupport.java     |  16 +-
 .../jena/test/assembler/TS_Assembler.java       |  31 ++++
 .../test/assembler/TestDatasetAssembler.java    | 145 +++++++++++++++++++
 .../rdfconnection/TestRDFConnectionRemote.java  |   3 +-
 .../apache/jena/test/txn/TestDataset2Graph.java |  19 ++-
 .../testing/Assembler/assem_dsg1_1.ttl          |  11 ++
 .../testing/Assembler/assem_dsg1_2.ttl          |  15 ++
 .../testing/Assembler/assem_dsg1_3.ttl          |  15 ++
 .../testing/Assembler/assem_dsg1_bad_1.ttl      |  15 ++
 .../testing/Assembler/assem_dsg1_inf_tdb1.ttl   |  31 ++++
 .../testing/Assembler/assem_dsg1_inf_tdb2.ttl   |  30 ++++
 .../testing/Assembler/assem_dsg_sink.ttl        |  11 ++
 .../testing/Assembler/assem_dsg_zero.ttl        |   9 ++
 .../testing/Assembler/data.ttl                  |   5 +
 17 files changed, 373 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/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 faf37c7..29a486b 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
@@ -45,6 +45,12 @@ public class DatasetGraphOne extends DatasetGraphBaseFind {
     private final boolean supportsAbort;
 
     public static DatasetGraph create(Graph graph) {
+        if ( graph instanceof GraphView ) {
+            // This becomes a simple class that passes all transaction operations the
+            // underlying dataset and masks the fact here are other graphs in the storage.
+            return new DatasetGraphOne(graph, ((GraphView)graph).getDataset());
+        }
+        
         return new DatasetGraphOne(graph);
     }
     
@@ -57,30 +63,18 @@ public class DatasetGraphOne extends DatasetGraphBaseFind {
     
     @SuppressWarnings("deprecation")
     private DatasetGraphOne(Graph graph) {
+        // Not GraphView which was hanled in create(Graph). 
         this.graph = graph;
-        if ( graph instanceof GraphView ) {
-            backingDGS = ((GraphView)graph).getDataset();
-            txn = backingDGS;
-            supportsAbort = backingDGS.supportsTransactionAbort();
-        } else {
-            // JENA-1492 - pass down transactions.
-            if ( TxnDataset2Graph.TXN_DSG_GRAPH )
-                txn = new TxnDataset2Graph(graph);
-            else
-                txn = TransactionalLock.createMRSW();
-            backingDGS = null;
-            supportsAbort = false;
-        }
-    }
-    
-    public DatasetGraphOne(Graph graph, Transactional transactional) {
-        this.graph = graph;
-        backingDGS = null;
-        if ( transactional == null )
-            txn = TransactionalLock.createMRSW();
+        // JENA-1492 - pass down transactions.
+        if ( TxnDataset2Graph.TXN_DSG_GRAPH )
+            txn = new TxnDataset2Graph(graph);
         else
-            txn = transactional;
-        supportsAbort = false; 
+            txn = TransactionalLock.createMRSW();
+        backingDGS = null;
+        // Don't advertise the fact but TxnDataset2Graph tries to provide abort.
+        // We can not guarantee it though because a plain, non-TIM, 
+        // memory graph does not support abort.
+        supportsAbort = false;
     }
     
     @Override public void begin(TxnType txnType)        { txn.begin(txnType); }
@@ -93,8 +87,7 @@ public class DatasetGraphOne extends DatasetGraphBaseFind {
     @Override public ReadWrite transactionMode()        { return txn.transactionMode(); }
     @Override public TxnType transactionType()          { return txn.transactionType(); }
     @Override public boolean supportsTransactions()     { return true; }
-    // Because there are never any changes, abort() means "finish".  
-    @Override public boolean supportsTransactionAbort() { return true; }
+    @Override public boolean supportsTransactionAbort() { return supportsAbort; }
     
     @Override
     public boolean containsGraph(Node graphNode) {

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
index 930f9e2..1c0ce6f 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/TransactionalLock.java
@@ -161,7 +161,7 @@ public class TransactionalLock implements Transactional {
         endOnce() ;
     }
 
-    private void endOnce() {
+    protected void endOnce() {
         if ( isInTransaction() ) {
             lock.leaveCriticalSection() ;
             txnMode.set(null);
@@ -173,7 +173,7 @@ public class TransactionalLock implements Transactional {
         }
     }
     
-    private void error(String msg) {
+    protected void error(String msg) {
         throw new JenaTransactionException(msg) ; 
     }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/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
index 027d1ed..564c1db 100644
--- 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
@@ -220,8 +220,21 @@ public class TxnDataset2Graph extends TransactionalLock {
 
     @Override
     public void abort() {
-        handlers(h -> h.abort());
+        handlers(h->h.abort());
         finish();
         super.abort();
     }
+    
+    @Override
+    public void end() {
+        if ( isTransactionMode(ReadWrite.WRITE) )
+            error("Write transaction - no commit or abort before end()") ;
+        // Need to put this in between the two parts of end().
+        if ( super.isInTransaction() ) {
+            // Must be READ at this point.
+            handlers(h->h.commit());
+            finish();
+        }
+        super.endOnce();
+    }
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/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 3b8d880..2208c6d 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
@@ -24,6 +24,7 @@ import java.util.List ;
 import org.apache.jena.atlas.lib.Creator ;
 import org.apache.jena.sparql.core.DatasetGraph ;
 import org.apache.jena.sparql.core.DatasetGraphFactory ;
+import org.apache.jena.sparql.core.DatasetGraphSink;
 import org.apache.jena.sparql.core.DatasetGraphZero;
 import org.apache.jena.sparql.graph.GraphFactory ;
 import org.junit.Assert ;
@@ -48,16 +49,17 @@ public class TestTransactionSupport {
         x.add(new Object[] {"create",
             (Creator<DatasetGraph>)()->DatasetGraphFactory.create(),
             true, false}) ;
-        x.add(new Object[] {"wrap" ,
-            (Creator<DatasetGraph>)()->
-                DatasetGraphFactory.wrap(GraphFactory.createDefaultGraph()),
-            true, true}) ;
-        x.add(new Object[] {"createZeroGraph" ,
+        x.add(new Object[] {"wrap(Graph)" ,
+            (Creator<DatasetGraph>)()->DatasetGraphFactory.wrap(GraphFactory.createDefaultGraph()),
+            true, false}) ;
+        x.add(new Object[] {"zero" ,
             (Creator<DatasetGraph>)()->new DatasetGraphZero(),
             true, true}) ;
+        x.add(new Object[] {"sink" ,
+            (Creator<DatasetGraph>)()->new DatasetGraphSink(),
+            true, true}) ;
         x.add(new Object[] {"create(Graph)",
-            (Creator<DatasetGraph>)()->
-                DatasetGraphFactory.create(GraphFactory.createDefaultGraph()),
+            (Creator<DatasetGraph>)()->DatasetGraphFactory.create(GraphFactory.createDefaultGraph()),
             true, false}) ;
         return x ;
     }

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TS_Assembler.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TS_Assembler.java b/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TS_Assembler.java
new file mode 100644
index 0000000..053f322
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TS_Assembler.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.assembler;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+    TestDatasetAssembler.class
+})
+
+public class TS_Assembler {
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TestDatasetAssembler.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TestDatasetAssembler.java b/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TestDatasetAssembler.java
new file mode 100644
index 0000000..c1a8e62
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/assembler/TestDatasetAssembler.java
@@ -0,0 +1,145 @@
+/*
+ * 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.assembler;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.jena.assembler.exceptions.AssemblerException;
+import org.apache.jena.atlas.logging.Log;
+import org.apache.jena.query.ARQ;
+import org.apache.jena.query.Dataset;
+import org.apache.jena.query.TxnType;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.rdf.model.Statement;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.sparql.core.DatasetOne;
+import org.apache.jena.sparql.core.TxnDataset2Graph;
+import org.apache.jena.sparql.core.assembler.AssemblerUtils;
+import org.apache.jena.sparql.core.assembler.DatasetAssemblerVocab;
+import org.apache.jena.system.JenaSystem;
+import org.apache.jena.system.Txn;
+import org.apache.jena.test.txn.TestDataset2Graph;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests of building datasets with assemblers.
+ */
+public class TestDatasetAssembler {
+    static { JenaSystem.init(); } 
+    
+    @SuppressWarnings("deprecation")
+    @BeforeClass public static void beforeClass() {
+        if ( ! TxnDataset2Graph.TXN_DSG_GRAPH )
+            Log.warn(TestDataset2Graph.class, "**** TxnDataset2Graph.TXN_DSG_GRAPH is false in the system setup ****");
+    }
+    
+    protected static String DIR = "testing/Assembler/";
+    
+    static private Model     data = RDFDataMgr.loadModel(DIR + "data.ttl");
+    static private Resource  s    = data.createResource("http://example/data/s");
+    static private Property  p    = data.createProperty("http://example/data/p");
+    static private Resource  o    = data.createResource("http://example/data/o");
+    static private Statement stmt = data.createStatement(s, p, o);
+
+    // See also jena-arq/etc/...
+    
+    // ---- Null dataset assemblers
+
+    @Test public void dsg_zero() {
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg_zero.ttl", DatasetAssemblerVocab.tDatasetZero);
+        assertNotNull(ds);
+        try { 
+            ds.getDefaultModel().add(stmt);
+        } catch (UnsupportedOperationException ex) {}
+    }
+    
+    @Test public void dsg_sink() {
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg_sink.ttl", DatasetAssemblerVocab.tDatasetSink);
+        assertNotNull(ds);
+        assertTrue(ds.getContext().isDefined(ARQ.queryTimeout)); 
+        ds.getDefaultModel().add(stmt);
+        assertEquals(0, ds.getDefaultModel().size());
+    }
+
+    // ---- DatasetOneAssembler
+    
+    @Test public void dsg1_1() {
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg1_1.ttl", DatasetAssemblerVocab.tDatasetOne);
+        assertNotNull(ds);
+        assertNotNull(ds.getDefaultModel());
+        assertTrue(ds instanceof DatasetOne);
+        useIt(ds);
+    }
+    
+    @Test public void dsg1_2() {
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg1_2.ttl", DatasetAssemblerVocab.tDatasetOne);
+        assertNotNull(ds);
+        assertNotNull(ds.getDefaultModel());
+        assertTrue(ds instanceof DatasetOne);
+        readIt(ds);
+    }
+    
+    @Test public void dsg1_3() {
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg1_3.ttl", DatasetAssemblerVocab.tDatasetOne);
+        assertNotNull(ds);
+        assertNotNull(ds.getDefaultModel());
+        assertTrue(ds instanceof DatasetOne);
+        readIt(ds);
+    }
+    
+    @Test(expected=AssemblerException.class)
+    public void dsg1_bad_1() { 
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg1_bad_1.ttl", DatasetAssemblerVocab.tDatasetOne);
+        assertNotNull(ds);
+    } 
+    
+    @Test public void dsg1_inf_tdb1_1() {
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg1_inf_tdb1.ttl", DatasetAssemblerVocab.tDatasetOne);
+        assertNotNull(ds);
+        assertNotNull(ds.getDefaultModel());
+        assertTrue(ds instanceof DatasetOne);
+        useIt(ds);
+    }
+    
+    @Test public void dsg1_inf_tdb1_2() {
+        Dataset ds = (Dataset)AssemblerUtils.build(DIR+"assem_dsg1_inf_tdb2.ttl", DatasetAssemblerVocab.tDatasetOne);
+        assertNotNull(ds);
+        assertNotNull(ds.getDefaultModel());
+        assertTrue(ds instanceof DatasetOne);
+        useIt(ds);
+    }
+    
+    private void readIt(Dataset ds) {
+        Txn.exec(ds, TxnType.READ, ()->{
+            assertTrue(ds.getDefaultModel().contains(stmt));
+        });
+    }
+    
+    private void useIt(Dataset ds) {
+        Txn.executeWrite(ds, ()->{
+            ds.getDefaultModel().add(data);
+        });
+        readIt(ds);
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
index ef86755..d064b6d 100644
--- a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
@@ -35,10 +35,11 @@ import org.junit.BeforeClass ;
 public class TestRDFConnectionRemote extends AbstractTestRDFConnection {
     private static FusekiServer server ;
     private static DatasetGraph serverdsg = DatasetGraphFactory.createTxnMem() ;
-    protected static int PORT  = FusekiLib.choosePort(); 
+    protected static int PORT; 
     
     @BeforeClass
     public static void beforeClass() {
+        PORT = FusekiLib.choosePort();
         server = FusekiServer.create()
             .setPort(PORT)
             .add("/ds", serverdsg)

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/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
index 38e1e55..4d515b6 100644
--- 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
@@ -20,13 +20,13 @@ 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.atlas.logging.Log;
 import org.apache.jena.graph.Triple;
 import org.apache.jena.query.*;
 import org.apache.jena.rdf.model.Model;
@@ -63,6 +63,9 @@ public class TestDataset2Graph {
     // TXN_DSG_GRAPH must be true.
     @SuppressWarnings("deprecation")
     @BeforeClass public static void beforeClass() {
+        if ( ! TxnDataset2Graph.TXN_DSG_GRAPH )
+            Log.warn(TestDataset2Graph.class, "**** TxnDataset2Graph.TXN_DSG_GRAPH is false in the system setup ****");
+        
         txn_dsg_graph = TxnDataset2Graph.TXN_DSG_GRAPH;
         TxnDataset2Graph.TXN_DSG_GRAPH = true;
         // Make sure sync isn't called.
@@ -78,13 +81,13 @@ public class TestDataset2Graph {
 
     @Parameters(name = "{index}: {0}")
     public static Collection<Object[]> data() {
-        Creator<Dataset> datasetPlainMaker = ()-> DatasetFactory.createTxnMem() ;
+        Creator<Dataset> datasetPlainMaker = ()-> DatasetFactory.createGeneral() ;
         Creator<Dataset> datasetTxnMemMaker = ()-> DatasetFactory.createTxnMem() ;
         Creator<Dataset> datasetTDB1 = ()-> TDBFactory.createDataset();
         Creator<Dataset> datasetTDB2 = ()-> TDB2Factory.createDataset();
         return Arrays.asList(new Object[][] { 
-            { "Plain",  datasetPlainMaker },
-            { "TIM",  datasetTxnMemMaker },
+            { "Plain", datasetPlainMaker },
+            { "TIM",   datasetTxnMemMaker },
             { "TDB1",  datasetTDB1 },
             { "TDB2",  datasetTDB2 }
         });
@@ -96,15 +99,15 @@ public class TestDataset2Graph {
         this.creator = creator;
     }
 
-    @Test public void dsgGraph_model() {
+    @Test public void dsgGraphTxn_model() {
         testInfModel(creator.create());
     }
 
-    @Test public void dsgGraphTxnTDB_dataset_wrap() {
+    @Test public void dsgGraphTxn_dataset_wrap() {
         testOverDS(creator.create(), true);
     }
 
-    @Test public void dsgGraphTxnTDB_dataset_create() {
+    @Test public void dsgGraphTxn_dataset_create() {
         testOverDS(creator.create(), false);
     }
     private static void testInfModel(Dataset ds0) {
@@ -129,7 +132,7 @@ public class TestDataset2Graph {
 
         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"));
+            //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, ()->{

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg1_1.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg1_1.ttl b/jena-integration-tests/testing/Assembler/assem_dsg1_1.ttl
new file mode 100644
index 0000000..046659a
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg1_1.ttl
@@ -0,0 +1,11 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb:     <http://jena.hpl.hp.com/2008/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+# No default graph specified means add an in-memory one.
+<#dataset> rdf:type       ja:RDFDatasetOne .
+

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg1_2.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg1_2.ttl b/jena-integration-tests/testing/Assembler/assem_dsg1_2.ttl
new file mode 100644
index 0000000..00c3324
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg1_2.ttl
@@ -0,0 +1,15 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb:     <http://jena.hpl.hp.com/2008/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+<#dataset> rdf:type       ja:RDFDatasetOne ;
+    ja:defaultGraph <#graph> .
+
+<#graph> a ja:MemoryModel ;
+    ja:content [ja:externalContent <file:data.ttl> ] ;
+    .
+

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg1_3.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg1_3.ttl b/jena-integration-tests/testing/Assembler/assem_dsg1_3.ttl
new file mode 100644
index 0000000..af8d98c
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg1_3.ttl
@@ -0,0 +1,15 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb:     <http://jena.hpl.hp.com/2008/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+<#dataset> rdf:type       ja:RDFDatasetOne ;
+    ja:graph <#graph> .
+
+<#graph> a ja:MemoryModel ;
+    ja:content [ja:externalContent <file:data.ttl> ] ;
+    .
+

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg1_bad_1.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg1_bad_1.ttl b/jena-integration-tests/testing/Assembler/assem_dsg1_bad_1.ttl
new file mode 100644
index 0000000..5ab7911
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg1_bad_1.ttl
@@ -0,0 +1,15 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb:     <http://jena.hpl.hp.com/2008/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+<#dataset> rdf:type       ja:RDFDatasetOne ;
+    ## Illegal
+    ja:namedGraph [ ja:graphName <http://example/graph1> ;
+                    ja:graph    :data1 ] ;
+    .
+
+<#graph> a ja:MemoryModel .

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb1.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb1.ttl b/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb1.ttl
new file mode 100644
index 0000000..00cd419
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb1.ttl
@@ -0,0 +1,31 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+## Assembler for a dataset of a single inference model,
+## with the base storage in TDB1.
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb:     <http://jena.hpl.hp.com/2008/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+<#dataset> rdf:type       ja:RDFDatasetOne ;
+    ja:defaultGraph       <#model_inf> ;
+     .
+
+<#model_inf> a ja:InfModel ;
+     ja:baseModel <#tdbGraph> ;
+     ja:reasoner [
+         ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
+     ] .
+
+## Graph from TDB
+<#tdbGraph> rdf:type tdb:GraphTDB ;
+    tdb:dataset <#tdbDataset> .
+
+
+## Base data in TDB.
+<#tdbDataset> rdf:type tdb:DatasetTDB ;
+    tdb:location "--mem--" ;
+    .
+

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb2.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb2.ttl b/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb2.ttl
new file mode 100644
index 0000000..76c5010
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg1_inf_tdb2.ttl
@@ -0,0 +1,30 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+## Assembler for a dataset of a single inference model,
+## with the base storage in TDB2.
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb2:    <http://jena.apache.org/2016/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+<#dataset> rdf:type       ja:RDFDatasetOne ;
+     ja:defaultGraph       <#model_inf> ;
+     .
+
+<#model_inf> a ja:InfModel ;
+     ja:baseModel <#tdbGraph> ;
+     ja:reasoner [
+         ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
+     ] .
+
+## Graph from the database
+<#tdbGraph> rdf:type tdb2:GraphTDB2 ;
+    tdb2:dataset <#tdbDataset> .
+
+## Base data in TDB2.
+<#tdbDataset> rdf:type tdb2:DatasetTDB2 ;
+    tdb2:location "--mem--" ;
+    .
+

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg_sink.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg_sink.ttl b/jena-integration-tests/testing/Assembler/assem_dsg_sink.ttl
new file mode 100644
index 0000000..58f608c
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg_sink.ttl
@@ -0,0 +1,11 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb:     <http://jena.hpl.hp.com/2008/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+<#dataset> rdf:type       ja:RDFDatasetSink ;
+     ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "300" ] ;
+     .

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/assem_dsg_zero.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/assem_dsg_zero.ttl b/jena-integration-tests/testing/Assembler/assem_dsg_zero.ttl
new file mode 100644
index 0000000..ba76fc2
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/assem_dsg_zero.ttl
@@ -0,0 +1,9 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+PREFIX :        <#>
+PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX tdb:     <http://jena.hpl.hp.com/2008/tdb#>
+PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>
+
+<#dataset> rdf:type       ja:RDFDatasetZero .

http://git-wip-us.apache.org/repos/asf/jena/blob/41eefd40/jena-integration-tests/testing/Assembler/data.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/Assembler/data.ttl b/jena-integration-tests/testing/Assembler/data.ttl
new file mode 100644
index 0000000..e0d78e9
--- /dev/null
+++ b/jena-integration-tests/testing/Assembler/data.ttl
@@ -0,0 +1,5 @@
+PREFIX : <http://example/data/>
+
+:s :p :o .
+:s :q 12 .
+:s :q 12.0 .