Validation flow - defer expression evaluation
by peters
Hi,
I was wondering which is the proper way to do sanity checks (not null
etc...) on a fact before starting the actual business rules.
I have created a a ruleflow with a validation node (VALRFG) and a business
rule node (BRRFG) to determine execution order.
If in the validation node a not null constraint is violated, the session is
aborted (drools.halt()).
Problem with this approach is that assertions defined in rules of the
ruleflow-group "BRRFG" are validated before the validation rules execute.
The engine throws exception at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130).
...
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:101)
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:291)
How can I make sure that the validation rules are executed before the mvel
expressions in the business rules are being evaluated?
Thanks for feedback,
--
View this message in context: http://drools.46999.n3.nabble.com/Validation-flow-defer-expression-evalua...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
5.3.0.Final resource change scanner bug
by lhorton
I tried loading up 5.3.0 this weekend but have run into this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=733008
my server log says:
Exception in thread "Thread-38" java.lang.IllegalStateException: reader does
have a modified date
at
org.drools.io.impl.ReaderResource.getLastModified(ReaderResource.java:64)
at
org.drools.io.impl.ResourceChangeScannerImpl.scan(ResourceChangeScannerImpl.java:166)
at
org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(ResourceChangeScannerImpl.java:311)
at java.lang.Thread.run(Thread.java:662)
some rules files loaded, but some failed (silently, except for the above
message). Is there a workaround for this problem? we cannot migrate to
5.3.0 unless this is fixed or there is a way to work around the problem.
thanks for any help.
--
View this message in context: http://drools.46999.n3.nabble.com/5-3-0-Final-resource-change-scanner-bug...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Printing rule content when a rule is fired
by GPatel@tsys.com
Is is possible to get textual rule content from
org.drools.definition.rule.Rule? What I am looking to do is get the rule
definition (the when/then part) when a rule fires (i.e on
AfterActivationFiredEvent)
Thanks
G. Patel
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
13 years, 2 months
Regarding BPEL
by Sumeet Karawal
Hi,
I required some information whether jBPM supports BPEL. I searched and
found something regarding its use in jBPM v3.x. But got nothing regarding
BPEL for versions 4.x and 5.x. Is jBPM compatible with BPEL or is there
anyway to have BPEL functionality with jBPM.
jBPM creates the process using JPDL. Is it better in someway or the other
than BPEL ? Could anybody please help me on this.
Thanks & Regards,
Sumeet Karawal
Mailto: sumeet.karawal(a)tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
13 years, 2 months
How to use lists in RHS when using MVEL?
by zstlaw
I want to make an array and pass it to a method in the RHS but can't when I
use mvel. If I use mvel then java new Object[3] causes compile errors. If
I use the mvel syntax the object is not an real array, only a string in
mvel's special array notation which is not useful for the functions I am
trying to call. Working example:
rule "Array bug"
dialect "java" // explicit java or mvel barfs on new Object[];
when
Message( )
then
Object[] logArgs = new Object[3];
logArgs[0] = "Sample string";
logArgs[1] = "Another string";
logArgs[2] = "And done";
System.out.println( "Array was "+$m );
end
If you change dialect above to mvel the code no longer compiles. If you
change it to mvel and use the mvel list syntax ["Sample string", "Another
string", "And done"] you don't have an array so methods requiring an array
do not work. Concrete example: I want to log 3 values using a logging
framework. Many logging frameworks (like sl4j) support a notation like
Logger.warn("My name is {} and you killed my {}", array); where array has
"Inigo Montonya" and "father" for values.
Thanks for any advice!
Zack
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-use-lists-in-RHS-when-using-MVEL...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
How to use GlobalArea enum inside package defined rules
by pravinborekar
Hi,
Would like to use GlobalArea enumeration ----- 'Member.title': ['Mr.',
'Miss']
in my custom package rule. Am trying to access it in DSL rule (as we want
guided editor to use enum), like---- {title:ENUM:Member.title}
If I create above enum in custom package, am able to do it cleanly.
Also tried using --- {title:ENUM:GlobalArea.Member.title} , but it didnt
work.
Need help on how to access the global area enum, as we need to use the same
across many packages.
Regards, Pravin
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-use-GlobalArea-enum-inside-packa...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Performance: Stateful vs. Stateless Session
by tonytang
Can anybody help me to explain the performance between Stateful and Stateless
session?
I write a very simple test code to test the performance:
Just a message,if the id is odd then set a attribute to "odd"
if it is even then set to "even".
insert message one by one, and insert 1,000,000 times.
Rule:
rule "even"
when
message: Message()
eval((message.getId() % 2) == 0)
then
message.setOddOrEven("odd");
end
rule "odd"
when
message: Message()
eval((message.getId() % 2) == 1)
then
message.setOddOrEven("even");
end
message class just id and oddOrEven
public class Message {
private int id;
private String oddOrEven;
public Message(int id){
this.id = id;
}
// getter and setter
}
My test code:
// create statefulSession and statelessfulSession out of KnowledgeBase
StatefulKnowledgeSession statefulSession =
kbase.newStatefulKnowledgeSession();
StatelessKnowledgeSession statelessfulSession =
kbase.newStatelessKnowledgeSession();
int messageNumber = 1000000; // total message number
Random random = new Random(); // to generate id
long begin = System.currentTimeMillis();
for(int i = 0; i < messageNumber; i++){
FactHandle handle = statefulSession.insert(new Message(random.nextInt()));
statefulSession.retract(handle);
}
statefulSession.dispose();
long end = System.currentTimeMillis();
long statefulTime = end - begin;
begin = System.currentTimeMillis();
for(int i = 0; i < messageNumber; i++){
statelessfulSession.equals(new Message(random.nextInt()));
}
end = System.currentTimeMillis();
long statelessTime = end - begin;
System.out.println("Stateful session time: " + statefulTime + " Stateless
session time: " + statelessTime);
The result: "Stateful session time: 12158 Stateless session time: 46"
oh my god...
Is there any place is wrong in my code ?
--
View this message in context: http://drools.46999.n3.nabble.com/Performance-Stateful-vs-Stateless-Sessi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months