Okie dokie--

The integration with BeanShell/ANTLR seems mostly complete.

In CVS, look at $ROOT/test_data/ruleset.xml, which I've handily
reproduced here.

I still need to create a friendly API for building RuleSets, and
such, but, we can now read .xml files that contain rules.

Filter conditions and consistent-assignment conditions both seem
to work.  Actions (<then>) is just any BeanShell script you might
like.  For all intents'n'purposes, it's just Java code, but if
you want to do bsh wackiness, then that's fine by me.

The <param> elements denote your root fact objects; the ones you
explicitly assert into the WorkingMemory.

The <decl> elements are local delcarations for named fact extraction.

You'll notice, in this example, the first condition, which limits
'doc1' to being the <a> element.  You'll need something similar until
I implement conflict sets, because the rules engine will happy match
this rule with the combination (doc1, doc2) *and* (doc2, doc1), and
thus would fire twice without the extra filter condition in there.

I'm open to syntax changes (ie, if we decide we don't want explicit
<cond> tags, but rather just a <when> element with newline-separated
expressions, or similar).  Just lemme know.

Anyhow, I'll probably roll a release this afternoon for folks who
aren't comfortable with CVS.  Though, I still recommend CVS to
stay completely up-to-date.

        -bob



<ruleset name="My Rule Set">

        <import>org.dom4j.Document</import>

        <rule name="My Rule">

                <param type="Document">doc1</param>
                <param type="Document">doc2</param>

                <decl type="String">id</decl>

                <when>
                        <cond>doc1.getRootElement().getName().equals( "a" )</cond>
                        <cond>id = doc1.selectObject( "string(/a/@id)" )</cond>
                        <cond>id = doc2.selectObject( "string(/b/@id)" )</cond>
                </when>

                <then>
                        System.err.println( " ********** START " );
                        System.err.println( "doc1: " + doc1 );
                        System.err.println( "doc2: " + doc2 );
                        System.err.println( " ********** END " );
                </then>
        </rule>

</ruleset>


_______________________________________________
drools-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/drools-interest

Reply via email to