W3C home > Mailing lists > Public > semantic-web@w3.org > September 2010

Re: First order logic and SPARQL

From: Axel Polleres <axel.polleres@deri.org>
Date: Tue, 7 Sep 2010 19:48:44 +0100
Cc: "Bob MacGregor" <bob.macgregor@gmail.com>, "Adrian Walker" <adriandwalker@gmail.com>, <semantic-web@w3.org>, <public-sparql-dev@w3.org>
Message-Id: <8E7F7D48-2EA0-4138-9D7D-F61C1D41E7F8@deri.org>
To: "Chimezie Ogbuji" <chimezie@gmail.com>
> This direction is useful for rule-based query re-writing.  For
> example, If you want to answer the following SPARQL:


Ah, ok, sure...  indeed some systems, like dlvdb [1] do something similar already (rewriting the non-recursive part of a query against a DB into SQL), should work similarly for SPARQL. We have, BTW, actually we used dlvdb for an implementation of our SPARQL rewriting, on top of a relational database [2] , which rewrites SPARQL+rules partially to SQL, but at the moment we don't translate to SPARQL natively.

Axel

1. G. Terracina, N. Leone, V. Lio, C. Panetta, Experimenting with recursive queries in database and logic programming systems, Theory and Practice of Logic Programming (TPLP), 8(2), 129-165, 2008. (Paper listed in the Computing Research Repository (CoRR) - http://arxiv.org/corr/home - CoRR number: 0704.3157).

2. Giovambattista Ianni, Thomas Krennwallner, Alessandra Martello, Axel Polleres: Dynamic Querying of Mass-Storage RDF Data with Rule-Based Entailment Regimes. International Semantic Web Conference 2009: 310-327

On 7 Sep 2010, at 18:43, Chimezie Ogbuji wrote:

> 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 18:49:25 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 21:45:38 GMT