How to configure conditional elements (IN, FROM) in Guvnor and more
by Patricia Bogoevici
Hi,
I am evaluating Drools Guvnor for our application, and I am stuck with a few things. I appreciate a lot, if someone can help me, or give me some hints.
1) How can I configure Guvnor, BRL Guided Editor, to allow for IN conditional element?
By default, when I create a new package, and then create a new BRL rule, I have these options for a text Fact field:
- equal
- not equal
- matches
- sounds
I do have the IN conditional element for the Decision Table rule - "is contained in the a (comma separated) list".
2) How can I configure Guvnor, Decision table, to use the FROM condition element?
I have a fact, Fact1, that contains a list of Fact2. The condition I need to configure in the Decision Table, is to iterate the collection of Fact2 objects that is on the Fact1, and apply constraints on Fact2 fields.
3) How can I insert a list of facts when testing a rule? My test case is the following:
I have a Fact1, which contains a list of Fact2. And the rule, is expecting to get Fact1, with a list of Fact2 inside.
When I create the Fact1, and add the collection field, it shows the option to create a guided list where I can specify a literal value, or a variable. But there is nowhere to create a Fact2 with its fields. I did inserted 2 separate Fact2 objects, but how I can link these 2 objects to the collection of the Fact1?
Thanks in advance,
Patricia
15 years, 8 months
Static Imports
by Meeraj Kunnumpurath
Hi,
Are static imports as shown below allowed in rule files? It is giving me a
parse exception.
package mypackage;
dialect "mvel"
import mypackage.CreditTransferTransactionInformation10;
import static mypackage.ValidationHelper.invalidate;
global java.util.Set accountNumbers;
rule "Check debtor account number is not null"
salience -1
when
$c : CreditTransferTransactionInformation10 ( eval(
dbtrAcct.?id.?othr.?id == null ) )
then
invalidate($c, "PG003", "Account number is absent");
drools.halt();
end
Ta
Meeraj
15 years, 8 months
Persistence with Drools 5.1.0.M2
by Rory Farrell
Hi, I'm trying to get persistence working in Drools 5.1.0.M2. I read
through the documentation and the drools-user forum posts and made some
progress but I'm stuck at:
SEVERE: Error in named query: ProcessInstancesWaitingForEvent
org.hibernate.QueryException: cannot dereference scalar collection
element: name [select processInstanceInfo.processInstanceId from
org.drools.persistence.processinstance.ProcessInstanceInfo
processInstanceInfo where :type in (processInstanceInfo.eventTypes.name)]
Here are the steps I've followed so far:
1. Read the documentation and cut and pasted the code to run and persist
a small sample ruleflow. I got the following exception:
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or
@ManyToMany targeting an unmapped class:
org.drools.persistence.processinstance.ProcessInstanceInfo.variables[org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo]
2. Read through the forum and added the following lines to the
persistence.xml file:
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
I got the following exception:
Caused by: java.lang.IllegalArgumentException: Named query not found:
ProcessInstancesWaitingForEvent
3. Read through the forum again and the only thing I found was a post
saying to make sure that the orm.xml with the named query was in the
META-INF directory in the drools-persistence-jpa.jar. I checked and the
orm.xml with the named query was in the
drools-persistence-jpa-5.1.0.M2.jar. I tried copying the orm.xml into a
META-INF directory in my classpath and I got the following exception:
SEVERE: Error in named query: ProcessInstancesWaitingForEvent
org.hibernate.QueryException: cannot dereference scalar collection
element: name [select processInstanceInfo.processInstanceId from
org.drools.persistence.processinstance.ProcessInstanceInfo
processInstanceInfo where :type in (processInstanceInfo.eventTypes.name)]
I'm stuck at this point. It looks like the orm.xml is not in sync with
the Drools 5.1.0.M2 code. I'm sure that someone must have this working.
If so, could you post the orm.xml file that you are using or give me a
pointer as to where I might be going wrong?
Regards,
Rory
15 years, 8 months
How to chose witch rules are going to be evaluated?
by mmarmol
Hi, I want to know how to avoid evaluation of some rules. I have tried to use
AgenGroups and FlowGroups but for what I have seen in my test rules are
always evaluated. I am using some cost demanding conditions in my "WHEN"
section of the rules and i would like to avoid rules that i know i dont need
based in the facts i will add to my session, any idea how I could do that?
The only thing i can think of is using separated Bases for the rules. I am
using 5.1.0M2 with StatefulKnowledgeSession.
Thanks!
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-chose-witch-ru...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Nested properties and memberOf
by Meeraj Kunnumpurath
Hi,
I have the following rules,
global java.util.Set accountNumbers;
rule "rule 1"
when
$d : Document()
$c : CreditTransferTransactionInformation (dbtrAcct == null ||
dbtrAcct.id == null || dbtrAcct.id.othr == null || dbtrAcct.id.othr.id ==
null) from $d.cstmrCdtTrfInitn.cdtTrfTxInf
$i : InternalInfo() from $c.internalInfo
then
$i.setStatus(PaymentStatus.INVALID);
$i.setErrorCode("PR002");
$i.setAdditionalInfo("Account number is null");
end
rule "rule 2"
when
$d : Document()
$c : CreditTransferTransactionInformation(internalInfo.status !=
PaymentStatus.INVALID && dbtrAcct.id.othr.id not memberOf accountNumbers)
from $d.cstmrCdtTrfInitn.cdtTrfTxInf
$i : InternalInfo() from $c.internalInfo
then
$i.setStatus(PaymentStatus.INVALID);
$i.setErrorCode("PR002");
$i.setAdditionalInfo("Account number not available in the routing
table");
end
My assumption is rule 1 and rule 2 will be executed in the order they
appear. Rule 1 checks all the nested attributes are not null and set the
status as invalid if any of them is null. Rule 2 uses the and operator and
checks the nested attribute is in the collection defined by the global, only
if the object is valid. I assume the LHS of rule 2 will be short circuited
if the object is invalid. However, if any of the nested property is null I
get the following exception from MVEL.
Caused by: [Error: unable to access property (null parent): id]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:861)
Regards
Meeraj
15 years, 8 months
Question about Guvnor
by Patricia Bogoevici
Hi all,
My name is Patricia, and I am working on an enterprise app, that is using workflow and business rules (Drools). We need a way to allow the business users to modify the rules, and I started evaluating Drools Guvnor for whether it is good for our needs.
So far, it seems pretty ok, as it allows the end user to edit the rules, even for decision tables. I did not get too much into the details yet, but I noticed that searching rules/assets and sometimes even creating new rules is a bit slow. I do not have a lot of data, it is mostly the examples that Guvnor comes with plus some of my use cases. I am using the default set-up (JCR with local folder), and Tomcat 6.
Does any of you use Guvnor on production? If so, do you use JCR, or a DBMS? Did you run into any performance issues?
Thanks in advance.
P.S: I hope this is the right forum to ask this kind of questions.
--Patricia
15 years, 8 months
Issue when invoking rules present in Guvnor using AXIS webservice
by bbarani
Hi,
We are trying to create a drools Web service (using AXIS) and make it
interact with the rules present in Guvnor.
We tried implementing the logic to invoke the rule within the Skeleton and
tried invoking the same from a test client by passing the request
parameters, we are getting org.apache.axis2.AxisFault:
java.lang.NoClassDefFoundError: org/drools/WorkingMemory in the line of code
where the Guvnor working memory is being initiated in the skeleton, but we
have all the necessary libraries corresponding to drools/Guvnor present in
the class path.
So we tried another approach by importing the supporting classes as a one
Jar file into Guvnor and accessed the classes with in the jar and came up
with rules, while validating the rules we are getting binding error with the
classes added.
Has anyone faced this issue before?
Thanks,
Barani
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Issue-when-invoking-r...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Gunvor Rule Editor problem?
by Han Ming Low
I have downloaded Guvnor build 4122 from
http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/tr...
I'm using this version because of the BPMN editor provided.
However, the Guvnor Rule Editor is not behaving the same.
In the When condition, the action is greyed out and I cannot change the
properties of the action I have added.
A screenshot is upload to
http://img693.imageshack.us/img693/2567/guvnorq.jpg
I can't remember the all build number I have tried but 2 of them are build
4083 and 4097.
In some cases, the Rule Editor is working as I previously used it but upon
opening a model, it shows the screen same as 5.0 where a upload option is
available.
But, in some other build when the designer is loaded up nicely, the Rule
Editor did not behave the same way as it previously did.
If the Rule Editor has changed the way it works, please let me know how to
go about edition the "Set value of XXX" option.
Thanks.
Han Ming
15 years, 8 months
Lasse Wallentin is out of the office.
by Lasse.Wallentin@APCC.com
I will be out of the office starting 16-07-2010 and will not return until
09-08-2010.
I will respond to your message when I return.
15 years, 8 months