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