I've been following the ARQ guide on Property Functions. The section on Graph Operations concludes with "New Triples or Graphs can therefore be created as part of the Property Function" and I've been hoping to use this as a means to add triples to the current query execution context (and not to persist), accessible for the remaining query.
I've been trying the code snippets in that section of the guide:
DatasetGraph datasetGraph = execCxt.getDataset();
Node otherGraphNode = NodeFactory.createURI("http://example.org/otherGraph");
Graph newGraph = new SimpleGraphMaker().createGraph();
Triple triple = ...
newGraph.add(triple);
datasetGraph.addGraph(otherGraphNode, newGraph);
but I'm running into issues, seemingly with the read-lock.
org.apache.jena.dboe.transaction.txn.TransactionException: Can't become a write transaction
at org.apache.jena.dboe.transaction.txn.Transaction.ensureWriteTxn(Transaction.java:251) ~[fuseki-server.jar:4.2.0]
at org.apache.jena.tdb2.store.StorageTDB.ensureWriteTxn(StorageTDB.java:200) ~[fuseki-server.jar:4.2.0]
at org.apache.jena.tdb2.store.StorageTDB.add(StorageTDB.java:81) ~[fuseki-server.jar:4.2.0]
at org.apache.jena.dboe.storage.system.DatasetGraphStorage.add(DatasetGraphStorage.java:181) ~[fuseki-server.jar:4.2.0]
at org.apache.jena.dboe.storage.system.DatasetGraphStorage.lambda$addGraph$1(DatasetGraphStorage.java:194) ~[fuseki-server.jar:4.2.0]
Is there any way to add triples to the execution context during a SPARQL query?