I am re-posting the message to the list for the sake of completeness since I 
did reply on the personal address by mistake.

Sorry,
Milorad




>________________________________
> From: Milorad Tosic <[email protected]>
>To: Dave Reynolds <[email protected]> 
>Sent: Tuesday, March 20, 2012 2:27 PM
>Subject: Re: is GraphStore deepcopy or a facade?
> 
>
>Hi,
>
>
>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 . }}";
>        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() ;
>            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? 
>
>
>Milorad
>
>
>
>
>>________________________________
>> From: Dave Reynolds <[email protected]>
>>To: [email protected] 
>>Cc: Milorad Tosic <[email protected]> 
>>Sent: Tuesday, March 20, 2012 1:47 PM
>>Subject: Re: is GraphStore deepcopy or a facade?
>> 
>>On 20/03/12 12:21, Milorad Tosic wrote:
>>> Andy,
>>>
>>> Thank again. I think I understand what your advice is about. If I use 
>>> dataset for every update query as follows:
>>>
>>>              UpdateRequest updateRequest = UpdateFactory.create(querystr);
>>>              GraphStore graphStore = GraphStoreFactory.create(m_dataset) ;
>>>              UpdateAction.execute(updateRequest, graphStore);
>>>
>>>
>>> as well as for every select query as follows:
>>>
>>>              QueryExecution qexec = QueryExecutionFactory.create(query, 
>>>m_dataset) ;
>>>              ResultSet results = qexec.execSelect() ;
>>>
>>> then everything works perfectly fine and I get all triples that were 
>>> previously inserted listed as a result of the
 select query.
>>>
>>> However, if I want to use reasoner for select queries I would need a Model. 
>>> It is true, isn't it? But if I try to use a Model on top of the existing 
>>> dataset I got an empty result list:
>>>
>>>              m_triplestore = 
>>>ModelFactory.createInfModel(ReasonerRegistry.getOWLMicroReasoner(), 
>>>m_dataset.getDefaultModel());
>>>              QueryExecution qexec = QueryExecutionFactory.create(query, 
>>>m_triplestore) ;
>>>              ResultSet results = qexec.execSelect() ;
>>
>>If there really is data in the default graph then that should work.
>>
>>Test it with something like:
>>
>>     m_dataset.getDefaultModel().write(System.out, "Turtle");
>>
>>> Basically, I can not make both Model and GraphStore to work over the same 
>>> dataset. Does this mean that a reasoner can not work with (multiple)
 named graphs?
>>
>>The reasoners, and reasoner API, predates datsets. You can reason over 
>>single models (or unions of them) and but can't doing anything useful 
>>reasoning over a dataset as a whole.  However, you get a Model out of a 
>>dataset and reason over that just fine.
>>
>>
>>BTW there it is possible to use reasoners at the Graph level, there is 
>>an InfGraph just as there is an InfModel. However, that doesn't help here.
>>
>>Dave
>>
>>
>>
>
>

Reply via email to