Comment is inserted:

>________________________________
> From: Dave Reynolds <[email protected]>
>To: Milorad Tosic <[email protected]> 
>Sent: Tuesday, March 20, 2012 2:51 PM
>Subject: Re: is GraphStore deepcopy or a facade?
> 
>Hi,
>
>On 20/03/12 13:27, Milorad Tosic wrote:
>> Hi,
>
>Please keep the conversation on jena-dev so others can join in.
>
>But ...
>
>> Here is the code segment:
>>
>>
>> /**
>> * Select triples in the NamedGraph in the store
>> */
>> querystr = "SELECT * WHERE {GRAPH <http://example.com/graphs/test1/> {
>> ?s ?p ?o . }}";
>
>So that query is requesting a specific named graph.
>

Yes.


>> System.out.println("Running "+querystr);
>>
>> Query query = QueryFactory.create(querystr);
>> m_triplestore = ModelFactory.createInfModel(
>> ReasonerRegistry.getOWLMicroReasoner(),
>> m_dataset.getNamedModel("urn:x-arq:UnionGraph"));
>> query.setPrefixMapping(m_triplestore);
>>
>> m_triplestore.getLock().enterCriticalSection(Lock.READ) ;
>> try {
>> QueryExecution qexec = QueryExecutionFactory.create(query, m_triplestore) ;
>> ResultSet results = qexec.execSelect() ;
>
>But here you are querying a simple model so there is no named graph 
>there so the result will be empty.
>

The result shouldn't be empty since I am trying to get named model 
"urn:x-arq:UnionGraph"! The trick is that exactly the same configuration works 
without Model in between? What I am trying to do is to apply some of the 
existing Jena models on a set of named graphs within the same TDB dataset. I 
first tried to apply a Model on a integrated set of unnamed (default) graph 
(set of triples) and one named graph (set of quads) residing within the same 
dataset. However, it didn't work. Now, I want to try to apply Model on the 
UnionGraph (that is supposed to contain all named graphs). However, if I run 
the same query against the Model I got empty result while against the 
underlying dataset the same query produces exactly what is expected.



>Whereas presumably a query such as:
>
>     SELECT * WHERE {?s ?p ?o . }
>
>will work.
>
>> System.out.println("++++++++");
>> m_dataset.getNamedModel("urn:x-arq:UnionGraph").write(System.out, "Turtle");
>> System.out.println("++++++++");
>> System.out.println("============= Query result m_triplestore ============");
>> ResultSetFormatter.output(System.out, results, ResultSetFormat.syntaxText);
>> System.out.println("============= Query result m_triplestore ============");
>>
>> qexec.close();
>> } finally {
>> m_triplestore.getLock().leaveCriticalSection();
>> }
>>
>> while the output segment is:
>>
>> Running SELECT * WHERE {GRAPH <http://example.com/graphs/test1/> { ?s ?p
>> ?o . }}
>> ++++++++
>> <http://example.org/book/book99>
>> <http://purl.org/dc/elements/1.1/creator>
>> "A.N.Other" ;
>> <http://purl.org/dc/elements/1.1/title>
>> "A new book" .
>> ++++++++
>> ============= Query result m_triplestore ============
>> -------------
>> | s | p | o |
>> =============
>> -------------
>> ============= Query result m_triplestore ============
>>
>>
>> I think my problem so far was that I expected to be able to query
>> together default graph and union of named graphs. Since default graph
>> contains triplets while named graphs contain quads, it could be expected
>> highly unlikely to work. So, I tried to be more specific by using
>> m_dataset.getNamedModel("urn:x-arq:UnionGraph") but it looks like it
>> didn't work either?
>
>If the above explanation doesn't help then perhaps you could explain (on 
>the list) what exactly it is you are trying do?
>
>Dave
>
>
>

Reply via email to