Try this out : http://sourceforge.net/projects/droolsruleedit . It's in early development stage, but it might help you.

On 4/5/07, John.Tal@gxs.com <John.Tal@gxs.com> wrote:

Drools developers,

 

In our specific use case we have customers who need to be able to write validation rules and NOT have to resort to writing them in Java.  Hence our interest in using drools as an open source 'standard' to potentially replace a proprietary rules engine we already have.

 

In the previous case I mentioned where I want to do this:

 

> *rule* "UCCnet_DVE_Depth_All"

>       *when*

>         catalogObject : CatalogObject( )

>         String s = catalogObject.getElementValue("depth");

>         *eval*( s == *null* || s == "" )

>       *then*

>             logWriter.logDebug("Package Depth is Blank");

> *end*

 

This is because potentially, in our use for data validation, there might be 50 values we need to compare against.  Those values need to be on the drools (not java) side of the world.  So getting the result of catalogObject.getElementValue("depth") into a String variable and being able to use String methods like indexOf or multiple || cases is much more desirable than crossing from the rule back into the object by having to call getElementValue 50 times.  There are numerous, other cases, where the result of catalogObject.getElementValue need to be saved into a local drools variable and evaluated multiple times without encurring the overhead of multiple calls back into java.

 

Please consider enhancing drl syntax to support this use case.  Is there a bug/enhancement process for me to follow to submit this functionality request.

 

Thanks

 

John

 

 

 

 

Date: Thu, 5 Apr 2007 16:47:07 +1000

From: "Michael Neale" < michael.neale@gmail.com>

Subject: Re: [rules-users] RE: Need DRL authoring Help

To: "Rules Users List" < rules-users@lists.jboss.org>

Message-ID:

      < 96ab3ced0704042347s130a4b46ma4a5b74fb45ef0d4@mail.gmail.com>

Content-Type: text/plain; charset="iso-8859-1"

 

OK you are really bending what you would use rules for, I really wouldn't recommend that. flattening the object model would allow you to write rules over it, but as it stands, its just going to be a bit difficult for you.

 

        catalogObject : CatalogObject( )

 

        *eval*( catalogObject.getElementValue("depth") == *null* ||

catalogObject.getElementValue ("depth") == "" )

 

On 4/5/07, John.Tal@gxs.com <John.Tal@gxs.com> wrote:

>  Ok,  Thanks for the help on the drl syntax.

> So this works.

> *rule* "UCCnet_DVE_Depth_All"

>       *when*

>         catalogObject : CatalogObject( )

>         *eval*( catalogObject.getElementValue("depth") == *null* ||

> catalogObject.getElementValue("depth") == "" )

>       *then*

>             logWriter.logDebug("Package Depth is Blank");

> *end*

> But how do I get the drl parser to accept something like this:

> *rule* "UCCnet_DVE_Depth_All"

>       *when*

>         catalogObject : CatalogObject( )

>         String s = catalogObject.getElementValue("depth");

>         *eval*( s == *null* || s == "" )

>       *then*

>             logWriter.logDebug("Package Depth is Blank");

> *end*

> I am getting an Unexpected token 's'  InvalidRulePackage

 


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users