2011/3/16 Enrico Daga <[email protected]>: > On 16 March 2011 17:22, Olivier Grisel <[email protected]> wrote: >> One should probably extend / adapt the JAX-RS SPARQL resource of the >> enhancers to point to other graph ids as needed. One could make a new >> JAX-RS resources such as /graph/{graphId}/sparql to build dynamically >> sparql endpoint for all the clerezza graphs registered in stanbol for >> instance: >> >> In the class SparqlQueryResource, instead of the hard-coded: >> >> Object result = tcManager.executeSparqlQuery(query, >> store.getEnhancementGraph()); >> >> One could have something like: >> >> Object result = tcManager.executeSparqlQuery(query, >> tcManager.getGraph(new UriRef("urn:graph:" + graphId))); > But what happens if I want to query multiple graphs? > I need for instance to query the enhancement graph and the result of > my /kres/reengineer process (another graph) together. This would open > to a variety of use cases, and in general this is how sparql endpoints > work.
It seems to me by reading the source code of TcManager#executeSparqlQuery and JenaSparqlEngine#execute and TcDataset#getNamedGraph that the clerezza sparql execution should be able to perform queries accross several graphs. The second argument of TcManager#executeSparqlQuery is just the default named graph used when the sparql query does not have FROM clause. Please try to build a SPARQL query with an explicit FROM clause pointing to a graph id used by kres to check this assertion. If it works, try another query that mixes triples from both graphs (reengineer and enhancer) using the GRAPH keyword in the body of the SPARQL query as in http://www.w3.org/TR/rdf-sparql-query/#restrictByLabel for instance. If it does not work, i think we should ask the question on the clerezza mailing list directly instead. -- Olivier http://twitter.com/ogrisel - http://github.com/ogrisel
