ontolog-forum
[Top] [All Lists]

[ontolog-forum] Database and Ontology: SWRL=~Prolog=~SQL

To: "[ontolog-forum]" <ontolog-forum@xxxxxxxxxxxxxxxx>
From: "Adrian Walker" <adriandwalker@xxxxxxxxx>
Date: Sat, 10 Feb 2007 10:19:08 -0500
Message-id: <1e89d6a40702100719w2ac3cf40r7411553cd3283090@xxxxxxxxxxxxxx>
Hi John --

That's a good idea (SWRL=~Prolog=~SQL), but only at the syntax level.

When you execute rules with an engine, there are issues, because the engine adds an interpretation of what the rules are supposed to mean.

In the case of SWRL, so far, this seems to mean "forward chain on each rule and assert the results and keep doing this till nothing new is asserted".  There seems to be no negation, see: mailman.stanford.edu/pipermail/protege-owl/2007-January/001064.html

In the case of Prolog, it means "back chain from what the user asked and see if you can reach all necessary supporting facts" -- using closed world negation.  However, Prolog will infinite loop on things like
 
                  ancestor(X,Z) :- ancestor(X,Y), ancestor(Y,Z)

so you have to be *very* careful to write rules with workarounds for this and other gotchas.

There's a similar situation with the various divergent implementations of SQL.  For example, a syntactically valid union query can be given to both Oracle and MySQL, and they will both happily supply different _wrong_ answers.  You have to rewrite the query manually as a workaround.

The good news is, there has been progress in inference engines over the many years that rules have been around.  For example, both the "Magic Sets" method and Backchain Iteration treat rules like the "ancestor" one above so as to extract the intended meaning [1].  Adding  just enough English [2], so users can know what predicates are supposed to mean in the real world, adds another layer of semantics.  And users can get English explanations of results, at the business level.

Maybe it's time for a third edition of our book [3] ?

                                        Cheers,  -- Adrian
 
[1] Backchain Iteration: Towards a Practical Inference Method that is Simple
  Enough to be Proved Terminating, Sound and Complete. Journal of Automated Reasoning, 11:1-22

[2]  Internet Business Logic.  A Wiki for Executable Open Vocabulary English over SQL. Online at www.reengineeringllc.com . Shared use is free.

[3]  Adrian Walker, Michael McCord, John F. Sowa and Walter G. Wilson. Knowledge Systems and Prolog. Addison-Wesley, 1990. ISBN 0-201-52424-4

Adrian Walker
Reengineering


On 2/9/07, John F. Sowa <sowa@xxxxxxxxxxx> wrote:
Peter,

In a previous note, I mentioned Datalog, which is a subset
of Prolog that has a direct mapping to relational databases.
And it turns out that SWRL is essentially Datalog with a
slightly different notation.  The similarity between Datalog,
Prolog, and SWRL is not surprising since they are all based
on the same subset of logic (Horn clauses).

Following is an example of SWRL from Martin's slides:

    hasParent(?x, ?y) ^ hasBrother(?y, ?z) -> hasUncle(?x, ?z)

And following is the corresponding rule in Datalog or Prolog:

    hasUncle(X,Z) :- hasParent(X,Y), hasBrother(Y,Z).

The SWRL query examples could also be translated to Prolog.
There is already an ISO standard for Prolog, and there are
some excellent commercial and open-source implementations,
which have good connectivity to both Java and SQL.

In his slides, Martin mentioned that there are some problems
in integrating SWRL with RDF and OWL.  But many companies
and government agencies translate RDF and OWL to Prolog in
order to improve performance.  By translating SWRL to Prolog,
all three languages could be integrated and supported on the
same platform.

John Sowa
___________________________________________________________________

URL for the slides by Martin O'Connor:


http://ontolog.cim3.net/file/work/DatabaseAndOntology/2007-02-08_MartinOConnor/Querying-RDB-Using-OWL-n-SWRL--MartinOConnor_20070208.ppt

_________________________________________________________________
Message Archives: http://ontolog.cim3.net/forum/ontolog-forum/
Subscribe/Config: http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/
Unsubscribe: mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx
Shared Files: http://ontolog.cim3.net/file/
Community Wiki: http://ontolog.cim3.net/wiki/
To Post: mailto:ontolog-forum@xxxxxxxxxxxxxxxx



_________________________________________________________________
Message Archives: http://ontolog.cim3.net/forum/ontolog-forum/  
Subscribe/Config: http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/  
Unsubscribe: mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx
Shared Files: http://ontolog.cim3.net/file/
Community Wiki: http://ontolog.cim3.net/wiki/ 
To Post: mailto:ontolog-forum@xxxxxxxxxxxxxxxx    (01)

<Prev in Thread] Current Thread [Next in Thread>