Code I'm using to test, substitute "data" for the SPARQL Update I showed
and "query" for the query I showed:
Dataset ds = DatasetFactory.createMem();
GraphStore gs = GraphStoreFactory.create(ds);
UpdateRequest up = UpdateFactory.create(data);
UpdateProcessor processor = UpdateExecutionFactory.create(up,
gs);
processor.execute();
//Parse the query
Query q = QueryFactory.create(query);
//Render the dataset appropriately, ARQ doesn't do this for us
automatically
Dataset ds2 =
DynamicDatasets.dynamicDataset(q.getDatasetDescription(),
ds, false);
//Then execute the query
QueryExecution exec = QueryExecutionFactory.create(q, ds2);
ResultSet results = exec.execSelect();
//Write out the results etc
I was actually in the process of writing up some unit tests that cover a
whole bunch of different cases for these kind of interactions to help some
of our devs out which was when I ran into this case where my
interpretation of the spec and ARQ's differs. If you can clarify what the
interpretation is I can fix the tests/ARQ as appropriate and then check
these in.
Rob
On 8/30/12 4:40 PM, "Rob Vesse" <[email protected]> wrote:
>Hey Andy
>
>Me and one of my colleagues are once again having a debate about the
>interpretation of SPARQL datasets which you may be able to clear up.
>
>Assuming the following dataset created with a SPARQL Update:
>
>INSERT DATA
>{
><ex:default> <ex:default> <ex:default> .
>GRAPH <ex:from> { <ex:from> <ex:from> <ex:from> }
>GRAPH <ex:named> { <ex:named> <ex:named> <ex:named> }
>GRAPH <ex:other> { <ex:other> <ex:other> <ex:other> }
>}
>
>Now given the query:
>
>SELECT * FROM <ex:from> { GRAPH <ex:named> { ?s ?p ?o } }
>
>What should be the result?
>
>I was expected to see a single row with the triple from <ex:named> but
>ARQ gives back no results.
>
>Maybe this is just a case of me mis-interpreting the SPARQL spec but I'd
>like to get an answer from a definitive source. My interpretation is
>that if you have a FROM without any FROM NAMED you are setting the
>default graph explicitly but leaving the named graphs to be all named
>graphs in the store.
>
>Cheers,
>
>Rob
>
>