5.3.0 Faster Complation?
by Saleem Lakhani
Hi,
>From documentation of 5.3.0:
2.1.1.4. Faster compilation
Thanks to many improvements and optimizations made on both MVEL library
and Drools internals, the DRL compilation is now at least 3 times faster
for both MVEL and Java dialects.
Does it really affect the runtime execution of already compiled &&
serialized rules in production? Any technical details will help.
Thanks,
saleem
13 years, 1 month
confusing behaviour of enum comparison
by lhorton
5.2.0.Final
I am seeing some confusing behaviour in enum comparisons in LHS rule
conditions. I have an enum class, "Status" (full source below) that is an
attribute on several of our domain objects. I'm comparing the enum in
several ways, and the rule fires differently when I use syntax that AFAIK
ought to have the same result.
for example, say there is a Step with status of Status.PENDING. if I write:
$step : Step(status.active == false) // rule DOES fire
$step : Step(status != Status.ACTIVE) // rule does NOT fire, but should
I am testing this with the same objects and same test each time. can anyone
explain why the two comparisons do not get the same result?
here is the definition of Status:
public enum Status {
PENDING("Pending"),
ACTIVE("Active"),
COMPLETE("Complete");
private final String label;
private Status(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
public boolean isPending(){
return label.equals("Pending");
}
public boolean isActive(){
return label.equals("Active");
}
public boolean isComplete(){
return label.equals("Complete");
}
public static boolean isPending(Status status) {
return (status == null) ? false : status.isPending();
}
public static boolean isActive(Status status) {
return (status == null) ? false : status.isActive();
}
public static boolean isComplete(Status status) {
return (status == null) ? false : status.isComplete();
}
public static Status fromString(String name) {
if (name != null) {
Status types[] = Status.values();
for(Status s : types) {
if (name.equalsIgnoreCase(s.toString())) {
return s;
}
}
}
return null;
}
}
--
View this message in context: http://drools.46999.n3.nabble.com/confusing-behaviour-of-enum-comparison-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Regression 5.1->5.2 with conflicting ClassNames
by Swindells, Thomas
I'm in the progress of updating from Drools 5.1 to 5.2 in the hope of solving problems we are having with intermittent mysteriously missing activations.
I've found a regression with the compiler which I don't know whether anybody else has noticed before.
In our application we've got two Content classes in different packages, and unfortunately one of our rule files has to reason over both of them.
In drools 5.1 this was fine, we imported one of them and then used the fully qualified name for the other.
I'm just upgrading to 5.2.0-Final and this no longer works. When resolving the unqualified class name drools/mvel(?) was choosing the package that we hadn't imported!
This obviously then gave us loads of misleading error messages about not being able to find fields.
Fully quallifiying all references to both classes fixed the issue but something obviously isn't behaving properly.
Thomas
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
13 years, 1 month
Fwd: "Accumulate and Collect" issue - Guvnor 5.2 Final
by Michael Anstis
---------- Forwarded message ----------
From: <praveen.sanju(a)gmail.com>
Date: 28 October 2011 10:48
Subject: "Accumulate and Collect" issue - Guvnor 5.2 Final
Hi,
We gave a try with 5.2 Final version, and see that all "collect" clauses
appears in grey and are not editable (such conditions are also not
deletable). Everything was OK with the M2 version (rules were edited with
this version).
It is quite strange because all the "collect" condition is greyed, just like
a disabled field, and seems to be done by purpose. Is "collect" deprecated ?
http://drools.46999.n3.nabble.com/rules-users-Guvnor-5-2-CR1-problem-with...
Above Forum link says to import what is required into the package
definition.
Could you please provide a detailed step-by-step procedure to get this
accomplished. Our intention is to get all the Collection types in the Guvnor
UI.
Thanks & Regards,
Praveen.
13 years, 1 month
Java Drools developer
by Danielle Slinn
Hi Everyone
Firstly, apologies for the impersonal nature of this email - I am working with a client to short timescales and need to cast a quick net...
Your details have been highlighted from my database in reference to a Java Developer assignment based in Cork Ireland, which I am presently resourcing.
I'd like to find out if you are interested or whether you know of someone else more appropriate whom we could help...
The high level requirements are as follow:
* 6-month initial contract
* Java/JEE
* JBOSS Rules -DROOLS
* PL/SQL
* Struts
* Hibernate
* Spring
If this is the type of opportunity you are interested in hearing about from Modis International, I would be most grateful if you could forward me your most up to date CV, indicating your availability; I will call you to discuss the assignment and to provide you with more specific details.
If however, this isn't relevant to your current skills or requirements - it is likely that we hold an out of date CV. In this instance, apologies again, but please still forward me your most up to date CV alongside a brief outline of what you are looking for in order to ensure that we do only contact you with relevant opportunities in the future...
Thanks in advance!
Please send your Uptodate CV to:
Danielle.slinn(a)modisintl.com<mailto:Danielle.slinn@modisintl.com>
13 years, 1 month
inserting multiple facts in RHS
by RK
I want to insert multiple facts sourced by a 'from' clause to a service
method.
For Ex:
when
...
then
insert( mycustomobject() from globalService.getCustomObjects())
getCustomObjects() method will return several instances of custom objects
based on a sql query and i want to insert them into the knowledge session.
I'll be using these custom objects in other subsequent rules.
Is it possible to do something like this ?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/inserting-multiple-facts-in-RHS-tp34590...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
ksession.insert() executes sequentially in multithreaded StatefulKnowledgeSessions
by juancarlos.fernandezj
Hello,
I'm having trouble when trying to insert() facts inside parallel
StatefulKnowledgeSessions. From a main() java program I start multiple
threads. Every thread creates new KnowledgeBase and every KnowledgeBase
creates new StatefulKnowledgeSession so I have one StatefulKnowledgeSession
in every thread. Once StatefulKnowledgeSession has been created, I insert
lots of facts in each StatefulKnowledgeSession.
What was expected? I expected to run insert() in parallel, each insert
inside its thread StatefulKnowledgeSession. 4 threads inserting lots of
facts inside its own StatefulKnowledgeSession is expected to run in parallel
and see how CPU usage increases.
What have I seen? when all threads are inserting facts in its own
StatefulKnowledgeSession I can see that only one CPU is being used so there
is no parallel insertion in different StatefulKnowledgeSession.
Is there a synchronization inside insert() code? It's so strange. Even if i
try with 12 threads, I can't see a CPU usage increase when executing
parallel insert() inside different StatefulKnowledgeSession (threads).
Help please.
This is my thread code (no static objects):
public class KnowledgeSessionThread extends Thread {
private StatefulKnowledgeSession session;
private Message[] facts;
public KnowledgeSessionThread(Message[] facts) throws Exception {
session = readKnowledgeBase().newStatefulKnowledgeSession();
this.facts = facts;
}
public void run() {
try {
for( int i = 0; i < facts.length; i++ ) {
session.insert(facts[i]);
}
session.startProcess("flowId");
session.fireAllRules();
session.dispose();
System.out.println("Thread finished");
} catch( Exception e ) {
e.printStackTrace();
}
}
private KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"),
ResourceType.DRL);
kbuilder.add(ResourceFactory.newClassPathResource("Sample.bpmn"),
ResourceType.BPMN2);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse
knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
}
--
View this message in context: http://drools.46999.n3.nabble.com/ksession-insert-executes-sequentially-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months
Re: [rules-users] Preventing re-evaluation on modification of 'output' fact
by GPatel@tsys.com
Define FraudResultsDTO as a global. That way, you don't have to specify it in the WHEN part merely for assigning a variable to it
----- Original Message -----
From: Jamie [jshaw(a)llbean.com]
Sent: 10/26/2011 09:24 AM MST
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Preventing re-evaluation on modification of 'output' fact
We're building a fraud detection application that uses rules to analyze
orders and the buyers and recipients on those orders. As rules fire, they
modify an 'output' fact, which is an object whose only intent is to record
the results as rules fire. It's not used in the LHS of any rules other than
to get a handle to it, e.g.:
rule "Rule 001 - Operator Flagged"
enabled (FraudRuleEvaluationHelper.isRuleEnabled("Rule 001 - Operator
Flagged"))
ruleflow-group "orderAnalysis"
lock-on-active
when
$order: OrderFact(operatorFlagged==true)
$results: FraudResultsDTO()
then
modify($results) {
addOrderSuspectReason("O")
};
FraudRuleConsequenceHelper.logRuleFiring($order.getOrderId(), "001");
end
We're finding that as the number of facts increases, the processing team
increases dramatically and I'm wondering if modifying the output fact the
way we do causes the rules to get re-evaluated to see if any activations
should be created or cancelled. Would removing the modify block help
anything? Should we be thinking about this in some other way?
--
View this message in context: http://drools.46999.n3.nabble.com/Preventing-re-evaluation-on-modificatio...
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-----------------------------------------
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
[drools 5.3.0.Final] Predicate ... must be a Boolean expression
by kennywest
I did a quick search in the mailing list, but couldn't find a related issue.
The following rule worked fine in 5.3.0.CR1 (and earlier)
...
when
$party : ImmutableParty(addresses == null || addresses.size() == 0)
then
...
ImmutableParty has a getter for addresses and addresses is a collection.
When upgrading to 5.3.0.Final, I get this error:
Caused by: java.lang.RuntimeException: Predicate 'addresses == null ||
addresses.size() == 0' must be a Boolean expression
[Line: 17, Column: 32] : [Rule name='party - address - at least one']
This is with mvel 2.1 beta 6.
--
View this message in context: http://drools.46999.n3.nabble.com/drools-5-3-0-Final-Predicate-must-be-a-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 2 months