[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16388051#comment-16388051
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user asfgit closed the pull request at:

https://github.com/apache/jena/pull/369


> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Fix For: Jena 3.7.0
>
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:47)
>     at 
> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152)
>     at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:125)
>     at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
> {noformat}
> Example configuration (full version attached):
> {noformat}
> :service  a   fuseki:Service ;
>     fuseki:dataset    :dataset ;
> ...
> ## Wrapper: Datset containing one TDB2-backed graph
> :dataset a ja:RDFDataset ;
>     ja:defaultGraph   :graph .
> ##  TDB2-backed graph
> :graph rdf:type tdb2:GraphTDB ;
>     tdb2:dataset :datasetTDB2 .
> ## TDB2 database
> :datasetTDB2 rdf:type tdb2:DatasetTDB2 ;
>     tdb2:location "DB2".
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386445#comment-16386445
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172276168
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
+ * no-transaction passing behaviour.
+ * 
+ * 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 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 buildHandlerSet(Graph 
primary, Collection graphs) {
+Map handlers = new HashMap<>();
+addHandler(handlers, primary);
+graphs.forEach(g->addHandler(handlers,g));
+return handlers;
+}
+
+private static void addHandler(Map 
handlers, Graph graph) {
+TransactionHandler th = graph.getTransactionHandler();
+if ( ! th.transactionsSupported() )
+return;
+Object key = calcKey(graph);
+if ( th.tran

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386444#comment-16386444
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user afs commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172275879
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
+ * no-transaction passing behaviour.
+ * 
+ * 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 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 buildHandlerSet(Graph 
primary, Collection graphs) {
+Map handlers = new HashMap<>();
+addHandler(handlers, primary);
+graphs.forEach(g->addHandler(handlers,g));
+return handlers;
+}
+
+private static void addHandler(Map 
handlers, Graph graph) {
+TransactionHandler th = graph.getTransactionHandler();
+if ( ! th.transactionsSupported() )
+return;
+Object key = calcKey(graph);
+if ( th.transa

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386431#comment-16386431
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172272325
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
+ * no-transaction passing behaviour.
+ * 
+ * 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 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 buildHandlerSet(Graph 
primary, Collection graphs) {
+Map handlers = new HashMap<>();
+addHandler(handlers, primary);
+graphs.forEach(g->addHandler(handlers,g));
+return handlers;
+}
+
+private static void addHandler(Map 
handlers, Graph graph) {
+TransactionHandler th = graph.getTransactionHandler();
+if ( ! th.transactionsSupported() )
+return;
+Object key = calcKey(graph);
+if ( th.tran

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386428#comment-16386428
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user afs commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172271582
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
+ * no-transaction passing behaviour.
+ * 
+ * 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 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 buildHandlerSet(Graph 
primary, Collection graphs) {
+Map handlers = new HashMap<>();
+addHandler(handlers, primary);
+graphs.forEach(g->addHandler(handlers,g));
+return handlers;
+}
+
+private static void addHandler(Map 
handlers, Graph graph) {
+TransactionHandler th = graph.getTransactionHandler();
+if ( ! th.transactionsSupported() )
+return;
+Object key = calcKey(graph);
+if ( th.transa

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386356#comment-16386356
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172252112
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
+ * no-transaction passing behaviour.
+ * 
+ * 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 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 buildHandlerSet(Graph 
primary, Collection graphs) {
+Map handlers = new HashMap<>();
+addHandler(handlers, primary);
+graphs.forEach(g->addHandler(handlers,g));
+return handlers;
+}
+
+private static void addHandler(Map 
handlers, Graph graph) {
+TransactionHandler th = graph.getTransactionHandler();
+if ( ! th.transactionsSupported() )
+return;
+Object key = calcKey(graph);
+if ( th.tran

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386359#comment-16386359
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172251788
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
--- End diff --

`onld` => `old`


> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.fi

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386358#comment-16386358
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172254605
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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.   
--- End diff --

typo missing `)`


> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> 

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386357#comment-16386357
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172254303
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
+ * no-transaction passing behaviour.
+ * 
+ * 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 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 buildHandlerSet(Graph 
primary, Collection graphs) {
+Map handlers = new HashMap<>();
+addHandler(handlers, primary);
+graphs.forEach(g->addHandler(handlers,g));
+return handlers;
+}
+
+private static void addHandler(Map 
handlers, Graph graph) {
+TransactionHandler th = graph.getTransactionHandler();
+if ( ! th.transactionsSupported() )
+return;
+Object key = calcKey(graph);
+if ( th.tran

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386354#comment-16386354
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on the issue:

https://github.com/apache/jena/pull/369
  
Okay. `::wrap` vs. `::create` is not what I am referring to as 
reformatting. It's stuff like 
[this](https://github.com/apache/jena/pull/369/files#diff-27cb8b74e951d2872a91a48066930e2d)
 or 
[this](https://github.com/apache/jena/pull/369/files#diff-9d27f4f9095b5d190b6fe8977b6c393b).

From what I understand, this all makes sense. Datasets that are "collected" 
from multiple graphs can, at best, pass the transaction through to their 
graphs, those that are in control of their own data can retain the 
responsibility for transactions themselves. That does seem to be the least 
surprising behavior and the one that veers towards "dataset as the fundamental 
unit" which we have been working towards.



> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:47)
>     at 
> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152)
>     at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:125)
>     at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
> {noformat}
> Example configuration (full version attached):
> {noformat}
> :service  a   fuseki:Service ;
>     fuseki:dataset    :dataset ;
> ...
> ## Wrapper: Datset containing one TDB2-backed graph
> :dataset a ja:RDFDataset ;
>     ja:defaultGraph   :graph .
> ##  TDB2-backed graph
> :graph rdf:type tdb2:GraphTDB ;
>     tdb2:dataset :datasetTDB2 .
> ## TDB2 database
> :datasetTDB2 rdf:type tdb2:DatasetTDB2 ;
>     tdb2:location "DB2".
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386360#comment-16386360
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/369#discussion_r172252346
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/core/TxnDataset2Graph.java ---
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ * 
+ * There are limitations:
+ * 
+ * we can't atomically do all the commits together in the crash 
situation.
+ * This {@code Transactional} maintains a MRSW policy because that is 
all that is
+ * required of graphs in general.
+ * 
+ * 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.
+ * 
+ * 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.
+ * 
+ * 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"; setting it "false" causes 
the onld,
+ * no-transaction passing behaviour.
+ * 
+ * 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 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 buildHandlerSet(Graph 
primary, Collection graphs) {
+Map handlers = new HashMap<>();
+addHandler(handlers, primary);
+graphs.forEach(g->addHandler(handlers,g));
+return handlers;
+}
+
+private static void addHandler(Map 
handlers, Graph graph) {
+TransactionHandler th = graph.getTransactionHandler();
+if ( ! th.transactionsSupported() )
+return;
+Object key = calcKey(graph);
+if ( th.tran

[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386317#comment-16386317
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user afs commented on the issue:

https://github.com/apache/jena/pull/369
  
Yes, this is models passing down transactions.  It only became possible 
with dataset-transaction promotion (new to 3.7.0).  

This all has a lot of knock on consequences. The wrap/create distinction is 
quite important and that touches a lot of files; it is not reformatting. "wrap" 
a model and the dataset can not have named graphs added, "create" with a model 
and it starts with that model and can have named graphs added. We only used to 
have "create" which has overhead and complexity as well as occasionally leading 
to unexpected behaviour with SPARQL Updates (updates work but the new NG are 
in-memory and disappear on restart - better to have a closed dataset and catch 
the issue at update time).

While testing, I found lack of test coverage and integration testing, which 
is the root of the users@ email that triggered this, was the place to put this. 
There as a lack of assemblers for certain other special cases so I included 
them as well as they arose naturally from checking test coverage.




> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:47)
>     at 
> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152)
>     at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:125)
>     at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
> {noformat}
> Example configuration (full version attached):
> {noformat}
> :service  a   fuseki:Service ;
>     fuseki:dataset    :dataset ;
> ...
> ## Wrapper: Datset containing one TDB2-backed graph
> :dataset a ja:RDFDataset ;
>     ja:defaultGraph   :graph .
> ##  TDB2-backed graph
> :graph rdf:type tdb2:GraphTDB ;
>     tdb2:dataset :datasetTDB2 .
> ## TDB2 database
> :datasetTDB2 rdf:type tdb2:DatasetTDB2 ;
>     tdb2:location "DB2".
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386286#comment-16386286
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user ajs6f commented on the issue:

https://github.com/apache/jena/pull/369
  
There is some new `Assembler` stuff and reformatting, so I'm not totally 
clear what the thrust of this PR is: is it to ensure that `Model`s wrapping 
other `Model`s (e.g. for inferencing) correctly pass transaction control calls 
into their wrapped models (which should pass them into their underlying 
`Dataset`)?


> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:47)
>     at 
> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152)
>     at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:125)
>     at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
> {noformat}
> Example configuration (full version attached):
> {noformat}
> :service  a   fuseki:Service ;
>     fuseki:dataset    :dataset ;
> ...
> ## Wrapper: Datset containing one TDB2-backed graph
> :dataset a ja:RDFDataset ;
>     ja:defaultGraph   :graph .
> ##  TDB2-backed graph
> :graph rdf:type tdb2:GraphTDB ;
>     tdb2:dataset :datasetTDB2 .
> ## TDB2 database
> :datasetTDB2 rdf:type tdb2:DatasetTDB2 ;
>     tdb2:location "DB2".
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16384891#comment-16384891
 ] 

ASF GitHub Bot commented on JENA-1492:
--

Github user afs commented on the issue:

https://github.com/apache/jena/pull/369
  
"Skolemization function" is not related; it is a small clarification done 
in passing.


> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:47)
>     at 
> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152)
>     at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:125)
>     at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
> {noformat}
> Example configuration (full version attached):
> {noformat}
> :service  a   fuseki:Service ;
>     fuseki:dataset    :dataset ;
> ...
> ## Wrapper: Datset containing one TDB2-backed graph
> :dataset a ja:RDFDataset ;
>     ja:defaultGraph   :graph .
> ##  TDB2-backed graph
> :graph rdf:type tdb2:GraphTDB ;
>     tdb2:dataset :datasetTDB2 .
> ## TDB2 database
> :datasetTDB2 rdf:type tdb2:DatasetTDB2 ;
>     tdb2:location "DB2".
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-03-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16384889#comment-16384889
 ] 

ASF GitHub Bot commented on JENA-1492:
--

GitHub user afs opened a pull request:

https://github.com/apache/jena/pull/369

JENA-1492: Pass down transactions from general datasets



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/afs/jena txn-general

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/jena/pull/369.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #369


commit e58cbcb043ed0c18f9df0f26b2da66c8745e3963
Author: Andy Seaborne 
Date:   2018-02-26T16:42:03Z

Align to the style of sparql.core.TransactionalLock.

commit 7a11a6b8090e0218ab02f364e2c3153edbced5b8
Author: Andy Seaborne 
Date:   2018-02-26T16:42:32Z

isTransactionType -> isTransactionMode

commit 4a819f41ac8d19cb9bc043e58f9997b55143f54a
Author: Andy Seaborne 
Date:   2018-02-27T23:22:01Z

Skolemization function

commit b15cfe922d1b803387272169f6a870195cd56e76
Author: Andy Seaborne 
Date:   2018-03-03T16:25:48Z

JENA-1492: Pass transactions down from general datasets




> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:47)
>     at 
> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152)
>     at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:125)
>     at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
> {noformat}
> Example configuration (full version attached):
> {noformat}
> :service  a   fuseki:Service ;
>     fuseki:dataset    :dataset ;
> ...
> ## Wrapper: Datset containing one TDB2-backed graph
> :dataset a ja:RDFDataset ;
>     ja:defaultGraph   :graph .
> ##  TDB2-backed graph
> :graph rdf:type tdb2:GraphTDB ;
>     tdb2:dataset :datasetTDB2 .
> ## TDB2 database
> :datasetTDB2 rdf:type tdb2:DatasetTDB2 ;
>     tdb2:location "DB2".
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1492) Transactions not passed down for nested models.

2018-02-20 Thread A. Soroka (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369943#comment-16369943
 ] 

A. Soroka commented on JENA-1492:
-

This means transactions initiated on the "outermost" model, right? So the 
workaround would be to initiate the transaction on the underlying dataset? 
(Which I admit is confusing and annoying.)

> Transactions not passed down for nested models.
> ---
>
> Key: JENA-1492
> URL: https://issues.apache.org/jira/browse/JENA-1492
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki, TDB, TDB2
>Affects Versions: Jena 3.7.0
>Reporter: Andy Seaborne
>Priority: Major
> Attachments: config-tdb2-model.ttl
>
>
> From [users@ 
> email|https://lists.apache.org/thread.html/eacd92488360298a4916b2b1b0cf2d299797140be1960f84410f9b5d@%3Cusers.jena.apache.org%3E],
>  after the configuration sorted out.
> Hierarchies of models, such as inference models, on top of a TBD2 
> backed-graph do not pass down the transaction leading to
> {noformat}
> org.apache.jena.dboe.transaction.txn.TransactionException: Not in a 
> transaction
>     at 
> org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle.checkTxn(TransactionalComponentLifecycle.java:417)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.getRootRead(BPlusTree.java:159)
>     at 
> org.apache.jena.dboe.trans.bplustree.BPlusTree.iterator(BPlusTree.java:348)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleIndexRecord.all(TupleIndexRecord.java:251)
>     at 
> org.apache.jena.tdb2.store.tupletable.TupleTable.find(TupleTable.java:148)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:161)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.find(NodeTupleTableConcrete.java:150)
>     at 
> org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete.findAsNodeIds(NodeTupleTableConcrete.java:141)
>     at org.apache.jena.tdb2.store.TripleTable.find(TripleTable.java:64)
>     at 
> org.apache.jena.tdb2.store.DatasetGraphTDB.findInDftGraph(DatasetGraphTDB.java:110)
>     at 
> org.apache.jena.sparql.core.DatasetGraphBaseFind.find(DatasetGraphBaseFind.java:47)
>     at 
> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWrapper.java:152)
>     at org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:125)
>     at org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255)
> {noformat}
> Example configuration (full version attached):
> {noformat}
> :service  a   fuseki:Service ;
>     fuseki:dataset    :dataset ;
> ...
> ## Wrapper: Datset containing one TDB2-backed graph
> :dataset a ja:RDFDataset ;
>     ja:defaultGraph   :graph .
> ##  TDB2-backed graph
> :graph rdf:type tdb2:GraphTDB ;
>     tdb2:dataset :datasetTDB2 .
> ## TDB2 database
> :datasetTDB2 rdf:type tdb2:DatasetTDB2 ;
>     tdb2:location "DB2".
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)