- From: Chimezie Ogbuji <chimezie@gmail.com>
- Date: Tue, 7 Sep 2010 13:43:29 -0400
- To: Axel Polleres <axel.polleres@deri.org>
- Cc: Bob MacGregor <bob.macgregor@gmail.com>, Adrian Walker <adriandwalker@gmail.com>, semantic-web@w3.org, public-sparql-dev@w3.org
On Tue, Sep 7, 2010 at 1:19 PM, Axel Polleres <axel.polleres@deri.org> wrote: > Indeed, we have implemented only the other direction, SPARQL to Datalog, as a prototype plugin for the > dlvhex system cf. http://dlvhex-semweb.svn.sourceforge.net/viewvc/dlvhex-semweb/ > > Why would you need the translation of Datalog into SPARQL? That is something IMO just needed for the theoretical expressivity result, This direction is useful for rule-based query re-writing. For example, If you want to answer the following SPARQL: SELECT * { ?person a :Man } And you have the following datalog rules: Man(?X) :- hasSex(?X Male), age(?X ?AGE), math:greaterThan(?AGE 18) You can leverage a logic programming theorem prover / reasoner (such as Prolog) to unify the query against the rule, and generate the following SPARQL query to answer the question (via translating the body into a SPARQL query): SELECT ?person { ?person hasSex Male; age ?AGE FILTER(?AGE > 18) } To do this, you will need to be able to do the translation in a way that preserves the semantics, of course. >you dan't want to translate your datalog program into SPARQL and evaluate it with a sparql engine, that is likely not going to be very efficient... If you do this in a naive fashion, yes. But presumably, you could take advantage of optimizations in the theorem prover (such as re-using bindings provided in the query, for instance) and/or other query planning statistics such as the size of the predicates to reorder the body before converting it into a SPARQL query. Also, this approach doesn't rule out the evaluation of the SPARQL in an efficient, mature, and even remote, engine. -- Chime
Received on Tuesday, 7 September 2010 17:44:03 UTC