[rules-dev] Prolog Style Backward Chaining - First Cut

Mark Proctor mproctor at codehaus.org
Sat Apr 16 11:47:33 EDT 2011


I have the basics to backward chaining working now, using both named and 
positional arguments and mix of both. Mixed positional/named syntax is 
based conceptually on the RuleML proposal for POSL:
http://ruleml.org/submission/ruleml-shortation.html

POSL provides a bridge between the positional terms, often used in 
Prolog, and "slotted" names used in OO languages. POSL allows the best 
of both worlds.

I'm building out the tests, which should illustrate the behaviour and 
syntax here:
https://github.com/droolsjbpm/drools/tree/master/drools-compiler/src/test/java/org/drools/integrationtests/BackwardChainingTest.java

Still lots to do to improve the over all syntax and consistency across 
patterns. The last test is a geneology style test which is probably more 
intesting to people. There is still an issue here when using eval. I 
currently use "new Variable" to indicate an unbound unification 
variable, the problem is that evals and other things generate code 
expecting the original object type, say "String" and this results a cast 
error (see sibling rule). I want to avoid an explicit instanceof check 
for unwrapping and will be working on that over the weekend.

There is enough there now to give people an idea of what it looks like. 
I'll try and put together a "roadmap" for BC, along with more details of 
the syntax next week once it all comes together.

If anyone wants to help on this, you know where to fine me :)
irc.codehaus.org #drools

Mark



More information about the rules-dev mailing list