Adam,
TIM is fine and doing the right thing for all cases (union graph set for
query execution => quads, GRAPH used over a TIM dataset, and querying
the model that is the union graph, which is the general dataset case).
The warning is from OpExecutor and only for the case of
GRAPH <urn:x-arq:UnionGraph> i.e. explicitly named union graph in a
triples execution query.
From a first look, it seems that 75+% of the machinery is there ...
it's just the final step of the general (non-TIM) dataset not responding
to that graph name correctly. This is maybe 5 lines of code missing :-)
and :-(. A quick got it working for FPS's use case.
What I'm looking at now is what else might be missing. Some tidying up
needed for proper determination of the union graph when the dataset is
updated but GraphUnionRead does the right thing.
Andy
On 07/07/16 14:28, A. Soroka wrote:
Andy--
Is that warning something I need to fix in TIM, or is it coming from the query
machinery (and therefore something that is probably beyond me for the moment)?
---
A. Soroka
The University of Virginia Library
On Jul 7, 2016, at 8:32 AM, Andy Seaborne <[email protected]> wrote:
Hi,
DatasetFactory.create();
Union graph doesn't yet work on general datasets consistently.
It works for TDB and for TxnMem (also known as TIM) - in the latter case the
warning from the OpExecutor comes out but it's wrong.
Andy
On 05/07/16 17:15, François-Paul Servant wrote:
Hi,
I'm trying to query the named graphs of a TDB dataset using <urn:x-arq:UnionGraph>,
but I must be missing something. Is there something special to do in order to use
<urn:x-arq:UnionGraph> as a graph name in a query?
Here is what I'm trying (this test uses a memory dataset: only works with
3.1.1-SNAPSHOT. Normally, I use TDB)
TIA,
fps
package sometests;
import static org.junit.Assert.*;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.DatasetFactory;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.junit.Test;
public class UnionGraphTest {
@Test public final void test() {
Model m = ModelFactory.createDefaultModel();
m.add(
m.createResource("http://ex.com/s"),
m.createProperty("http://ex.com/p"),
m.createResource("http://ex.com/o"));
Dataset ds = DatasetFactory.create();
ds.addNamedModel("http://ex.com/g", m);
// query using the named graph: return some results
doIt(ds, "http://ex.com/g");
// same query, using urn:x-arq:UnionGraph, doens't return any result
doIt(ds, "urn:x-arq:UnionGraph");
}
private void doIt(Dataset ds, String graphName) {
String queryString = "SELECT * WHERE { GRAPH <" + graphName + "> {?s ?p ?o}
}";
Query q = QueryFactory.create(queryString) ;
QueryExecution qexec = QueryExecutionFactory.create(q, ds);
ResultSet rs = qexec.execSelect();
assertTrue(rs.hasNext());
for (;rs.hasNext();) {
QuerySolution sol = rs.next();
System.out.println(sol);
}
}
}