Updates to FuXi

7 views
Skip to first unread message

Chimezie

unread,
Sep 5, 2009, 1:39:57 PM9/5/09
to fuxi-discussion, chim...@posterous.com
So, I've re-organized python-dlp and FuXi. Originally, I thought of
python-dlp as a library on top of the expert system capabilities of a
SW reasoner (syntax libraries, etc.). Now with a small ecosystem of
(next generation) RDFlib-based, open-source libraries emerging from
the SW informatics being done in our Heart and Vascular Institute:

- Telescope (http://bitbucket.org/exogen/telescope/wiki/Home)
- SPARQL to SQL method (http://code.google.com/p/rdflib/wiki/
SQL_Backend and http://code.google.com/p/rdflib/source/detail?r=1545)
- "rdflib-stable" revisions (http://code.google.com/p/rdflib/source/
list?start=1649)

I've decided to separate the expert system (FuXi) into its own Google
Code project and decide soon what to do with python-dlp (the idea,
anyways):

http://code.google.com/p/fuxi/

It has a mercurial repository and can be cloned via:

hg clone https://fuxi.googlecode.com/hg/ fuxi

So, effectively, FuXi development has switched from SVN to
Mercurial :)

Shortly, I'll update the literature (wikis, etc.) on the python-dlp
Google Code project to (for now) act as a detour to the new project
until I determine what features, usecases are still left from the
original idea of having FuXi be everything inference-related on top of
"rdflib-stable"

I still have to determine if the RIF-Core XML syntax support should be
done using 4suite-xml, amara, amara2, or Python's (native) XML
processing capabilities (which is what rdflib originally did). This
will have an impact on the ease of distribution, etc.

Until then the recent changes are probably the last before the feature-
frozen candidate release testing leading to 1.0:

Revision 81d9eec480:
- Fixed use of Set (some performance boost perhaps)
- +++ b/lib/Rete/Magic.py (added imports from proof theory, minor
fixes, empty sip collections,
variable utility function, immutable dictionaries, )
+++ b/lib/Rete/Proof.py (updated proof builder, PML / RDF/XML
serialization, for top-down, query
generating strategies)
+++ b/lib/Rete/SidewaysInformationPassing.py (fix construction of sip
collection)
- Native Prolog-like Python implementation for RIF-Core, OWL, and
SPARQL (can be used to convert
SPARQL in-light of RIF-Core/OWL/OWL2 into a series of top-down
evaluated and combined SPARQL queries
against an RDF dataset)

Revision dc70e7a115:
Takes another Uniterm and in every case where the corresponding term
+ for both literals are different variables, we map from the
variable
+ for *this* uniterm to the corresponding variable of the other
.
Revision ff2acf3e96:
- Added --why option to command-line. Adds to a list of SPARQL
queries used to trigger the sip-
strategy to solve them top-down from the ruleset.
- minor checks/fixes for top-down method

Revision a0c14690be
fix to handle use of pyparsing or Bison for SPARQL parsing

There is a new wiki showing usage of top-down (backward-chaining) RIF/
OWL/N3 solver:

http://code.google.com/p/fuxi/wiki/TopDownSW

Also, the testOWL.py script has been updated with options for running
the OWL test using top-down or bottom-up reasoners:

$ python testOWL.py --bottomUp --singleTest=OWL/TransitiveProperty/
premises001
.. snip ..
$ python testOWL.py --topDown=ground --singleTest=OWL/
TransitiveProperty/premises001
.. snip ..
$ python testOWL.py --topDown=ground
ok
.. snip ..
----------------------------------------------------------------------
Ran 1 test in 3.089s

OK

For example, the command-line can be used to solve the OWL test by
remotely fetching the OWL class descriptions, converting them to RIF-
like rules internally (using the DLP feature), reducing the ruleset
and creating a rule/goal graph using the GMS, taking a SPARQL/ASK
query via the --why option, and solving the query against the original
OWL graph using the new top-down feature, printing out a PML RDF/XML
proof (notice the SipStrategy can be passed a 'live' database-
connected graph in order to solve the query in backward-chaining
fashion by dispatching SPARQL queries against the possibly large RDF
warehouse).

The example below demonstrates the ability to handle the tail-
recursive rulesets / programs that can result from extracting rules
from an OWL ontology that includes RBox axioms about role transitivity
(the path between countries, for example). The top-down algorithm is
similar to prolog with memoization and last call optimization. Both
are trivial to implement in Python using one of many memioze
decorators and native generators respectively.

Note, the bottom-up (forward chaining) method using the RETE-UL
decision network is much quicker and only fires one rule (due to
sideways information passing optimization - similar to the kind used
by databases to answer relational queries in the face of live,
immaterial, and possibly recursive views). I'm devising larger in-
memory tests to determine why the forward chain algorithms that much
faster, but I imagine it has something to do with:

Ullman, JD , "Bottom-up beats top-down for datalog". Proceedings of
the eighth ACM symposium on Principles of database systems. pp
140-149, 1989, ACM New York, NY, USA.

$ time FuXi --ruleFacts --why="ASK { test:Ghent test:path
test:Amsterdam }" --ns=test=http://www.w3.org/2002/03owlt/
TransitiveProperty/premises001# --dlp --output=conflict
http://www.w3.org/2002/03owlt/TransitiveProperty/premises001

Time to solve goal ASK { test:Ghent test:path test:Amsterdam } top-
down: 17.4751281738 milli seconds

@prefix _7: <http://purl.org/net/chimezie/>.
@prefix _8: <http://inferenceweb.stanford.edu/2006/06/pml-
provenance.owl#>.
@prefix gmp: <http://inferenceweb.stanford.edu/registry/DPR/GMP.owl#>.
@prefix pml: <http://inferenceweb.stanford.edu/2004/07/iw.owl#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix test: <http://www.w3.org/2002/03owlt/TransitiveProperty/
premises001#>.

_:thJpxqsn124 a pml:NodeSet;
pml:hasConclusion "test:path(test:Ghent test:Amsterdam)";
pml:isConsequentOf [ a pml:InferenceStep;
pml:consequent _:thJpxqsn124;
pml:englishDescription ":path_bb(?X ?thJpxqsn19) :- And
( :path_bf(?X ?thJpxqsn18) :path_bb(?thJpxqsn18 ?thJpxqsn19) )";
pml:hasAntecedent _:thJpxqsn128,
_:thJpxqsn132;
pml:hasInferenceEngine _7:FuXi;
pml:hasRule gmp:GMP].

_:thJpxqsn129 a pml:InferenceStep;
pml:consequent _:thJpxqsn128;
pml:fromQuery [ a pml:Query;
_8:hasContent [ a _8:Information;
_8:hasRawString "SELECT ?thJpxqsn18 { test:Ghent
test:path ?thJpxqsn18 }"]];
pml:hasInferenceEngine _7:FuXi;
pml:hasRule gmp:GMP;
pml:hasVariableMapping [ a pml:Mapping;
pml:mapFrom ?thJpxqsn18;
pml:mapTo test:Antwerp].

_:thJpxqsn147 a pml:InferenceStep;
pml:consequent _:thJpxqsn132;
pml:fromQuery [ a pml:Query;
_8:hasContent [ a _8:Information;
_8:hasRawString "ASK { test:Antwerp test:path
test:Amsterdam }"]];
pml:hasInferenceEngine _7:FuXi;
pml:hasRule gmp:GMP;
pml:hasVariableMapping [ a pml:Mapping;
pml:mapFrom ?thJpxqsn19;
pml:mapTo test:Amsterdam],
[ a pml:Mapping;
pml:mapFrom ?thJpxqsn18;
pml:mapTo test:Antwerp],
[ a pml:Mapping;
pml:mapFrom ?X;
pml:mapTo test:Ghent].

_:thJpxqsn128 a pml:NodeSet;
pml:hasConclusion "test:path(test:Ghent ?thJpxqsn18)";
pml:isConsequentOf _:thJpxqsn129.

_:thJpxqsn132 a pml:NodeSet;
pml:hasConclusion "test:path(test:Antwerp test:Amsterdam)";
pml:isConsequentOf _:thJpxqsn147.
Time to calculate closure on working memory: 2.55084037781 milli
seconds
<Network: 1 rules, 4 nodes, 9 tokens in working memory, 1 inferred
tokens>
<TerminalNode : CommonVariables: [?thJpxqsn18] (3 in left, 3 in right
memories)>
test:path(?X ?thJpxqsn19) :- And( test:path(?X ?thJpxqsn18) test:path
(?thJpxqsn18 ?thJpxqsn19) )
1 instanciations

real 0m2.532s
user 0m1.770s
sys 0m0.479s



Chimezie Ogbuji

unread,
Sep 5, 2009, 2:15:49 PM9/5/09
to fuxi-discussion
On Sat, Sep 5, 2009 at 1:39 PM, Chimezie<chim...@gmail.com> wrote:
> Shortly, I'll update the literature (wikis, etc.) on the python-dlp
> Google Code project to (for now) act as a detour to the new project
> until I determine what features, usecases are still left from the
> original idea of having FuXi be everything inference-related on top of
> "rdflib-stable"

For example, I need to update this Wiki:

http://code.google.com/p/python-dlp/wiki/Overview

Jean-Marc Vanel

unread,
Sep 15, 2009, 5:24:18 AM9/15/09
to fuxi-discussion
I updated FuXi integration in EulerGUI, now that FuXi has the --filter
feature.

I was not without pain; first at some time the main script changed
from Fuxi to FuXi; then rdflib 2.4.0 provided by Ubuntu was too old. I
tried to summarize the install here :

http://eulergui.svn.sourceforge.net/viewvc/eulergui/trunk/eulergui/html/documentation.html#Install

On Sep 5, 7:39 pm, Chimezie <chime...@gmail.com> wrote:
> So, I've re-organized python-dlp and FuXi.  
...
Reply all
Reply to author
Forward
0 new messages