[#JBRULES-1946] Deserializing a KnowledgeBase object throws a java.io.EOFException
by Przemysław Różycki
Hello,
IMHO, this bug still occurs in 5.0.1 final version as well as in trunk.
I put the proper comment and example code in JIRA:
https://jira.jboss.org/jira/browse/JBRULES-1946
I need it working quite quickly, so if the Drools developers plan to
solve it later, then I will try to look at the source code by myself and
find the solution (and share of course).
However I would like to ask if anyone tried to diagnose the problem
earlier and has some thoughts where to look for the cause?
Best regards,
--
Przemysław Różycki
Architekt IT
AMG.net, A Bull Group Company
ul. Łąkowa 29
90-554 Łódź
tel.: (+48 42) 296 11 82
GSM: (+48) 510 022 612
jid: p.rozycki(a)amg.net.pl
GG: 145116
www.amg.net.pl
Treść niniejszej wiadomości może być poufna. Jeżeli nie jesteście
Państwo jej adresatem, to rozprowadzanie lub wykorzystywanie zawartych
tu informacji jest zabronione.
This e-mail contains material that is confidential for the sole use of
the intended recipient. Any review, reliance or distribution by others
or forwarding without express permission is strictly prohibited. If you
are not the intended recipient, please contact the sender and delete all
copies.
17 years, 1 month
Drools v5 multithreading questions
by Andrey Nechaev
Hello, All!
I’m evaluating the new version of Drools (5.0.1), so I’m especially
interested in multithreading and partitioning options, implemented in Drools
v5.
I’ve prepared a little test case to check how the feature works. Here is the
rule I’m using:
package test
rule test
when
NODE2($p : value > 20)
then
System.out.println("Fired :” + $p);
end
The NODE2 POJO is very simple:
public class NODE2 {
private int value;
public NODE2(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
}
And here is the main code snippet:
1: KnowledgeBaseConfiguration conf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
2: conf.setOption(MultithreadEvaluationOption.YES);
3: conf.setOption(MaxThreadsOption.get(10));
4: KnowledgeBase kb = KnowledgeBaseFactory.newKnowledgeBase(conf);
5:
6: KnowledgeBuilder bld =
KnowledgeBuilderFactory.newKnowledgeBuilder();
7: bld.add(ResourceFactory.newReaderResource(new
StringReader(rule)), ResourceType.DRL);
8: kb.addKnowledgePackages(bld.getKnowledgePackages());
9:
10: StatefulKnowledgeSession session =
kb.newStatefulKnowledgeSession();
11: session.insert(new NODE2(25));
12:
13: session.fireAllRules();
In such a case my program hangs and nothing is displayed in the Console.
If I put lines 10-11 prior to line 6, I get a NullPointerException:
Exception in thread "main" java.lang.NullPointerException
at
org.drools.reteoo.ObjectSource.addObjectSink(ObjectSource.java:124)
…
But, if I comment out the lines 2&3, everything works ok…
So, please help – what I’m doing wrong?
Best regards,
Andrey
17 years, 1 month
Help -- Conditional Logic in DRL
by Vishy
Hi All,
I am new to drools...and am trying to figure out as to how I can
represent the following logic in a DRL file.
if (condition1) {
if (condition2) {
} else if (condition3) {
} else if (condition 4) {
} else if (condition 5) {
}
}
In DSL, a typical rule is represented as follows:
rule "name"
when
condition is true
then
consequence
end
How can I represent the above mentioned if - else logic in DSL? Or is
it not possible?
If it is not, can you please suggest any alternative?
Thanks much!!
17 years, 1 month
Boolean global issue
by Dan Seaver
So, I'd like to have a ruleset that returns true or false. The way I set that
up in one of the version 5 candidate releases is to use a Boolean global and
use drools.getWorkingMemory().setGlobal("result", new Boolean(false)) to
change the value of the global. I could then access the updated value in the
code by using the old style getGlobal.
However in version 5 Final release, the global value changes fine within the
ruleset, but is not updated when I access it via ExecResults. I imagine the
reason for this is that immutable variables are handled differently in the
final release than in the candidate release, but need to know whether this
is by design.
Here is the RuleSet I'm using:
package BooleanTest
global Boolean result
rule "Initialize"
salience -1
when
then
drools.getWorkingMemory().setGlobal("result", new Boolean(false));
System.out.println("Initialized result to false");
end
rule "Display result"
salience -2
when
then
System.out.println("result is " + result);
end
Here is the pertinent code:
cmds.add(CommandFactory.newSetGlobal("result", null, true));
ExecutionResults execResults = ksession.execute(CommandFactory
.newBatchExecution(cmds));
for (String identifier : execResults.getIdentifiers()) {
System.out.format(String.format("Identifier: %s, Value: %s \n",
identifier, execResults.getValue(identifier)));
}
Here is the output:
Initialized result to false
result is false
Identifier: result, Value: null
--
View this message in context: http://www.nabble.com/Boolean-global-issue-tp24040774p24040774.html
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 1 month
Web based decision tables
by Dan Seaver
Can someone tell me the appropriate way to use web-based decision tables?
They seem to work fine if I create them in Guvnor, and then build and deploy
the binary package from Guvnor. However, if I copy the gdst from Guvnor to
Eclipse and use KnowledgeBuilder.add to attempt to add the resource as a
DTABLE or BRL resource type, I get a NullPointerException or
CannotResolveClassException.
Any help would be appreciated.
Thanks,
Dan
--
View this message in context: http://www.nabble.com/Web-based-decision-tables-tp24042079p24042079.html
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 1 month
Getting rule metadata and LHS information in consequence
by dhari
I have an unusual requirement. The application we are developing contains
more than 100 rules. All rules are just to validating the data pass in
facts. Upon failure, we log the error message. The requirement is to log
rule name and LHS condition (fact attributes, constant data, comparative
operators etc) of the rule that failed rule.
I am not sure is there any way to get this information dynamically from the
working memory/rule base or other possible source. I wonder if some has
implemented such scenario in the past and could help me.
Regards,
Shabbir
--
View this message in context: http://www.nabble.com/Getting-rule-metadata-and-LHS-information-in-conseq...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 1 month
Inserting Collection into WorkingMemory
by VinuJay
Hi my fact object looks like this,
class ProcessRequest {
Long requestId;
String processType;
String assigneeUsers;
List<String> businessData;
//Getters and Setters
}
I have inserted the fact object into working memory in this way
WorkingMemory workingMemory = ruleBase.newStatefulSession();
FactHandle factObject = workingMemory.insert(processRequest );
workingMemory.fireAllRules();
My question is how to use the values in the business data for comparison in
the rules.drl file rule "Audit"
when
p: ProcessRequest(processType == "Audit" && SSN == 1234) then
p.setAssigneeUsers("AuditUser1");
end
When i try with the above rule it says no field extractor found for SSN, SSN
is part of the businessdata(List<String>)
Please do suggest me
1. How to make the Workingmemory aware of the Collection - businessData 2.
Change the rules.drl file syntax to access values from Collection.
--
View this message in context: http://www.nabble.com/Inserting-Collection-into-WorkingMemory-tp23975474p...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 1 month
Problem with parallel subflows
by tom
Hi there! I am using drools 5.0 final. I tried to implement 2 subflows which
are polling for database entries.
More exactly: my application consists of 1 process that splits up into 2
subflows (AND - split). Both subflows
Consist of a timer, followed by an action node (java code). When I start the
application it seems that only one of the
Subflows is executed, but twice! (although subflow-IDs are correctly set).
If I change the action-node to MVEL input, everything works fine! If I start
just one of the
Subprocesses, they work correctly. I am calling fireUntilHalt in a new
thread, followed by startProcess(X) , like
It is recommended in the docu.
Does anyone know this problem?
Greets
Tom
17 years, 1 month
multiple .drl files
by Chris Richmond
Hello all,
I want to create a baseline rules file with Fusion that does some basic
aggregating that I know I will need later.things like keep running averages
over the last minute or so of several object values.
Is it possible to then "inherit" or at least reference those aggregates I am
keeping track of from another .drl file in some way.allowing me to always
keep my basic aggregation functions in one rule file and then add additional
rules/functions to my rule memory space later.or must any further rules that
wish to reference those aggregate or statistics objects also be contained
within the same .drl file? I understand I can have multiple .drl files, but
I am wondering specifically about referencing objects and variables created
in another rules file.
Thanks,
Chris
17 years, 1 month