210 likes | 331 Views
The design of j-DREW: a deductive reasoning engine for the web. Bruce Spencer National Research Council Canada and University of New Brunswick Fredericton, Canada. NRC – A National Institution. Virtual Innovation Centres. NRC Institute / Innovation Centre IRAP Office. Motivation.
E N D
The design of j-DREW: a deductive reasoning engine for the web Bruce Spencer National Research Council Canada and University of New Brunswick Fredericton, Canada
NRC – A National Institution Virtual Innovation Centres NRC Institute / Innovation Centre IRAP Office
Motivation • Started as a bet: Can I teach deduction and advanced internet systems in one course? • Students understand recursive search • basic propositional top-down prover • Teaching a course at UNB on building Internet applications that employ deduction(in conjunction with Harold Boley, formerly DFKI) • Semantic web ontologies have rules • XML is declarative, so deduction is a basic operation • Students have trouble building systems (variables) • unification, composition of substitutionsunbinding on backtracking • Specialized Prolog implementation courses focus on vars • Warren and Meier: Computing with Logic (1988) • Can we hide the hard parts?
Requirements on deduction system used in the course (and on web?) • First order logic with function symbols • Easily configured • Forward or backward search or backward and iterative deepening • Search strategy to be modified by student • Embeddable • Supports calls to and from rest of system • Easy to add new primitives (iterators) • Written in 100% Java • Access to libraries for networking, cryptography, XML parsers, RDF, XSLT, …
Remove bindings Java Iterator Create bindings Propositional Prover chronologicalBacktrack while(choicePoints.nonEmpty()) Goal g = choicePoints.pop(); g.removeAttachedClause(); if(g.hasMoreClauses()) return; halt('failure') initially proofTree has an open Goal loop if(proofTree.hasNoOpenGoal()) halt('success'); else Goal g = proofTree.selectOpenGoal(); g.createMatchingClauseList(); if(g.hasMoreMatchingClauses()) DefiniteClause c = g.nextClause(); g.attachClause(c); choicePoints.push(g); else chronologicalBacktrack();
c b b’ c Y2/h q(g(Y2) q(g(Y2) r(g(h) q(k) Y1/k Y1/f(Y2) Tree with initial goal p(Z) p(X) :- q(X), r(X). q(g(X)). q(k). r(g(h)) ?:-p(Z) a ChoicePoints p(Y1) :- q(Y1), r(Y1) b a Z/Y1
Hiding the hard parts: Top-Down • A Goal creates its list of matching clauses and maintains pointer to current selection • Java iterator • Attaching a clause head to a Goal • imposes variable bindings across tree • Removing the clause • relaxes variable bindings • The tree provides access to all open Goals
} deployed } planned Deployed and Planned Prototypes • Basic Prolog Engine • Negation as failure • RuleML input • Iterative deepening search • Search complete, unlike Prolog • Dynamic additions to clause set • allowed between depth limits (synchronous) • Possible student exercises • delay selecting deferred goals • Negation of ground goals • Backtracking to deeper choicepoint • Bottomup
Deduction Example: Semantic Web • Semantics = meaning • Ontology • hierarchy of terms (subset) • logic conditions on their usage • Terms in a web page can be linked to their meanings in some ontology • Search with greater accuracy
Smoked Salmon • SmokedSalmon is the intersection of Smoked and Salmon
Smoked Salmon • Gravalax is the intersection of Cured and Salmon, but not Smoked Gravalax • SmokedSalmon is the intersection of Smoked and Salmon
Smoked Salmon Lox Gravalax • Lox is Smoked, Cured Salmon • SmokedSalmon is the intersection of Smoked and Salmon • Gravalax is the intersection of Cured and Salmon, but not Smoked
Gravalax Smoked Salmon • A search for keywords Salmon and Cured should return pages that mention Gravalax, even if they don’t mention Salmon and Cured • A search for Salmon and Smoked will return pages with smoked salmon, should also return pages with Lox, but not Gravalax Lox The Semantic Web vision is to make information on the web “understood” by computers, for searching, categorizing, …
Gravalax Smoked Salmon Lox
One possible encoding A search for keywords Salmon and Cured should return pages that mention Gravalax, even if they don’t mention Salmon and Cured. Search criteria: retrieve(P) :- mentions(P, cured), mentions(P, salmon). Ontology: mentions(P, cured) :- mentions(P, gravalax). mentions(P, salmon) :- mentions(P, gravalax). mentions(p1 gravalax). retrieve(p1) succeeds
A search for Salmon and Smoked will return pages with smoked salmon, should also return pages with Lox, but not Gravalax. retrieve(P) :- mentions(P, smoked), mentions(P, salmon). mentions(P, cured) :- mentions(P, lox). mentions(P, salmon) :- mentions(P, lox). mentions(P, smoked) :- mentions(P, lox). mentions(P, cured) :- mentions(P, gravalax). mentions(P, salmon) :- mentions(P, gravalax). mentions(p1 gravalax). mentions(p2, lox). retrieve(p1) fails retrieve(p2) succeeds
Bottom-Up / Forward Chaining • Set of support prover for definite clauses • Facts are supports • Theorem: Completeness preserved when definite clause resolutions are only between first negative literal and fact. • Proof: completeness of lock resolution (Boyer’s PhD) • Use standard search procedure to reduce redundant checking (next) • Unlike OPS/Rete, returns proofs and uses first order syntax for atoms
Theorem Prover’s Search Procedure loop select new fact for each matching rule resolve process new result add to used facts • 3 Definite Clause Lists: • new facts (priority queue) • old facts • rules • 2 Discrimination trees: • used facts • rules, indexed onfirst goal process new result(C) if C is rule for each old fact matching first resolve process new result add C to rules else add C to new facts
Summary • Teaching building deduction systems not hard • use of abstractions to hide variable handling • Semantic Web needs deduction • access to proof data structure (trust) • j-DREW deployed systems can use • forward / backward / other searches • small footprint, 100% Java • Take home messages: • not clear what form Semantic Web systems will take, so flexibility is key • implementers should provide API’s
References • CS6999 Semantic Web Techniques http://www.cs.unb.ca/~bspencer/CS6999 • RuleML http://www.dfki.de/ruleml • j-DREW open source? • Not yet