[rules-users] Complex DSL constraints to fact

Sean Su sean.x.su at gmail.com
Thu Aug 29 14:16:09 EDT 2013


I do not know if anyone has run into the following scenario. If yes, what
is the solution.

We are following the Drools DSL instruction for "adding constraints to the
fact":

[when]There is a Cheese with=Cheese()
[when]- age is less than {age}=age<{age}
[when]- type is '{type}'=type=='{type}'
[when]- country equal to '{country}'=country=='{country}'

However, Our fact is more complicated than just any Cheese(). We want to
look for all cheeses that follow certain constraints and then count them.
So our first line which defines the fact would be something like this:

[when]There are at least {number} cheese=java.util.Collection(
size>{number} ) from collect ( Cheese())

[when]- age is less than {age}=age<{age}
[when]- type is '{type}'=type=='{type}'
[when]- country equal to '{country}'=country=='{country}'

I am hoping that the "additional" constraints defined after "-" will be
added to Cheese(). However, under Guvnor version 5.5, they are added into
the first (), in this case, it is the Collection (size>{number}).

To be more specific, when adding "age is less than {age}" after "There are
at least {number} cheese", the DRL generated becomes:

java.util.Collection( size>{number}, age<{age} ) from collect ( Cheese())

while what I want is:

java.util.Collection( size>{number} ) from collect ( Cheese(age<{age}))


Is this something Drools DSL and Guvnor can't support at all at this time?
or there is something I am not using correctly?

Thanks in advance.

Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130829/53556cd4/attachment.html 


More information about the rules-users mailing list