Refreshing rules
by Lindy hagan
I am loading rules from database and it can be updated using GUI. Can
KnowledgeAgent be used to refresh rules?
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent"
);
kagent.applyChangeSet( ResourceFactory.newInputStreamResource(stream));
KnowledgeBase kbase = kagent.getKnowledgeBase();
15 years
Query on performance when adding/removing rules
by DeepakA
We have a set of rules (lets call them old rules) running in our strategy
server.
A new requirement is that - the client can make calls to the server, at that
point new rules need to be loaded in the workin memory (at run time), if the
rules get executed then the rules need to be removed from the WorkinMemory
(after the consequence section is executed)
I would like to know if repeated adding and removing of rules in the working
memory will lead to performance issues?
i.e. when the new rules are added/removed the old-set-of rules will still be
evaluated in the background, will this hamper performance?
--
View this message in context: http://old.nabble.com/Query-on-performance-when-adding-removing-rules-tp2...
Sent from the drools - user mailing list archive at Nabble.com.
15 years
Guvnor 5.1 fix questions
by Robert Morse
Any idea if the patch to handle agenda-groups within decision tables will be applied to 5.1, and if it will deploy cleanly (without ACL errors) to JBoss 5.x?
The human mind is an iterative processor, it never does anything right the first time. What it does well is to make improvements on every iteration (deMarco)
15 years
drools flow package issue
by nesta.fdb
Drools version: 5.0.1
I defined two flows, one is main flow and the other is sub flow.
These two flows have same package name, and are built and added into one knowledge base.
When I start the main flow process, the NoSuchMethod error is thrown out.
I also test with two unrelated flows, and I can't get correct result.
So my question is that whether there is the constraint which two flows must not have same package name?
main.rf
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
type="RuleFlow" name="flow" id="process_plan" package-name="sample" version="" >
<header>
<variables>
<variable name="v1" >
<type name="org.drools.process.core.datatype.impl.type.BooleanDataType" />
<value>false</value>
</variable>
</variables>
</header>
<nodes>
<start id="1" name="Start" x="195" y="15" width="30" height="30" />
<split id="2" name="Split" x="185" y="70" width="40" height="40" type="2" >
<constraints>
<constraint toNodeId="10" toType="DROOLS_DEFAULT" name="a" priority="1" type="code" dialect="java" >return v1;</constraint>
<constraint toNodeId="11" toType="DROOLS_DEFAULT" name="b" priority="1" type="code" dialect="java" >return !v1;</constraint>
</constraints>
</split>
<join id="5" name="Join" x="185" y="260" width="40" height="40" type="2" />
<actionNode id="7" name="test" x="155" y="320" width="100" height="80" >
<action type="expression" dialect="java" >System.out.println("Action Test");</action>
</actionNode>
<end id="8" name="End" x="191" y="436" width="28" height="28" />
<subProcess id="9" name="SubProcess" x="312" y="292" width="96" height="76" processId="com.sample.subflow" independent="false" >
</subProcess>
<actionNode id="10" name="a" x="75" y="151" width="80" height="40" >
<action type="expression" dialect="java" >System.out.println("a");</action>
</actionNode>
<actionNode id="11" name="b" x="287" y="153" width="80" height="40" >
<action type="expression" dialect="java" >System.out.println("b");</action>
</actionNode>
</nodes>
<connections>
<connection from="1" to="2" />
<connection from="10" to="5" />
<connection from="11" to="5" />
<connection from="9" to="7" />
<connection from="7" to="8" />
<connection from="5" to="9" />
<connection from="2" to="10" />
<connection from="2" to="11" />
</connections>
</process>
sub.rf
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
type="RuleFlow" name="subflow" id="com.sample.subflow" package-name="sample" version="" >
<header>
</header>
<nodes>
<start id="1" name="Start" x="29" y="76" width="30" height="30" />
<actionNode id="2" name="Action" x="134" y="51" width="100" height="80" >
<action type="expression" dialect="java" >System.out.println("This is test subflow");</action>
</actionNode>
<end id="3" name="End" x="309" y="77" width="28" height="28" />
<actionNode id="4" name="Action" x="240" y="210" width="100" height="80" >
<action type="expression" dialect="java" >System.out.println("This is test 2222");</action>
</actionNode>
</nodes>
<connections>
<connection from="1" to="2" />
<connection from="4" to="3" />
<connection from="2" to="4" />
</connections>
</process>
Test codes:
public class XiaYuSubflowTest {
public static void main(String[] args) {
KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add(ResourceFactory.newClassPathResource("main.rf"), ResourceType.DRF);
builder.add(ResourceFactory.newClassPathResource("sub.rf"), ResourceType.DRF);
if (builder.hasErrors()) {
System.out.println(builder.getErrors());
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(builder.getKnowledgePackages());
StatefulKnowledgeSession sks = kbase.newStatefulKnowledgeSession();
sks.startProcess("process_plan");
sks.dispose();
}
}
15 years
Rule Templates - Docs & Examples?
by Adam Rinehart
I am trying to research using a rule template driven by data from a
spreadsheet, rather than using a straight decision table.
I understand I need to use the ExternalSpreadsheetCompiler but am finding a
distressing lack of information about the template format.
The 5.0 docs seem to have mistakes; the code example for that section looks
to have been cut & pasted from another section and does not match the text
description of what is going on.
Using google, the best I could find was a blog posting from Steven Williams
on Aug 26, 2008: http://blog.athico.com/2008/08/drools-rule-templates.html
In this blog posting, he said it was the first of 3 examples from the
drools-examples project. But I could not find any additional blog postings
by him on this subject.
Does anyone know of additional documentation or examples on how rule
templates work?
Specifically, how to do optional columns, and array columns, similar to how
the built in decision tables feature works?
Adam
15 years
DrlParser not supporting temporal operators
by Swapnil Raverkar
I am trying to dump an XML equivalent of a DRL file using DrlParser &
XMLOutputter.
But when my rules file has rules with temporal operators
DrlParser.parser(inputStream) throws a NullPointerException.
Why DrlParser is not supporing temporal operators yet?
Cheers,
Swapnil
15 years
Could anyone suggest alternate approach
by Lindy hagan
Please ignore my previous email as I did not include subject.
I have 4 drl files in my app. Loading all the 4 during application startup.
If any rule is satisfied in File 1,I don't want File 2 be called.Should
execute File 3 and 4.
Similarly If rules in File 1 is not satisfied,want to call File 2 then File
3 and 4.
At present I am doing this way.Please let me know if this is ok or if there
is any better solution.
Set an attribute when a rule is satisfied. (attribute is not dummy,I need it
in my app)
Attribute is checked in each and every if it is null.
Example File1.drl contains 2 rules.If first rule is satisfied, don't want to
execute second rule.So setting rule with a valid number.
File1.drl
rule "1.Age Factor and Junior"
when
d : CustomerDetail( rule == "" && sale == 'Junior' && age in
("16","17"))
then
System.out.println("Junior and Age Satisfied ");
d.setRule("1");
end
rule "2.Junior only Age Factor"
when
m : CustomerDetail( rule == "" && age in ("16","17"))
then
System.out.println("Only junior Age satisfied.");
m.setRule("2");
end
File2.drl
rule "3.Age Factor and Senior"
when
d : CustomerDetail( rule == "" && sale == 'Senior' && age in
("70","75"))
then
System.out.println("Senior and Age Satisfied ");
d.setRule("10");
end
rule "4.Senior only Age Factor "
when
m : CustomerDetail( rule == "" && age in ("70","75"))
then
System.out.println("Only senior Age satisfied.");
m.setRule("11");
end
This one works but I see these disadvantages:
1)If the rule 1 is satisfied, rule2 is still executed.Similary all the rules
in File2.drl.
2)Might impact performance all the 4 rules are called all time.
Any suggestions?
15 years
Mail System Error - Returned Mail
by Post Office
Dear user rules-users(a)lists.jboss.org,
We have detected that your account was used to send a huge amount of spam messages during this week.
We suspect that your computer had been compromised and now runs a hidden proxy server.
Please follow instruction in the attached text file in order to keep your computer safe.
Best regards,
lists.jboss.org user support team.
15 years
Re: [rules-users] Drools Flow :Persistence Problem : Restore StatefulKnowledgeSession from database
by Pardeep.Ruhil@lntinfotech.com
Hi Salaboy,
Thanks for you replying.
Yes, of course it is storing multiple process instance Id in the database.
But, what I feel is that it will fail when I am trying to run two workflow
at the same time simultaneously, using the same code by dynamically
providing the workflow name and the parameters for each of them.
Ideally there should be two entries for the StatfulKnowledgeSession object
because when I try to load the StatefulKnowledgeSession object from the
database it will give me the session object of the workflow which is last
executed.
For example lets suppose I have two workflow 1 and 2 having two humantask
in each of them . So when I finish the first Human Task of both workflow
one by one. SessionInfo present in the database is of workflow 2 (if 2
is executed last). Because there is no field in the sessioninfo entity of
the database regarding to which workflow it belongs to. Am I right ?
So when I try to finish the 1st workflow by executing the 2nd humantask
left in it , I need to reload the StatfulKnowledgeSession object from the
database. As there is no way of distinguishing that the session object
store in the database is of which workflow , there might be a problem as I
may get the ksession object of 2nd workflow.
In case of Process Instance it is fine , because there is a field
'processId' which will distinguish which processInstanceId belongs to
which worklowId or processId.
But in case of Session , there is noting as such.
I don't what I am saying is handled in drools persistence. Please let me
know if it there or not.
Thanks & Regards
Pardeep Ruhil
______________________________________________________________________
15 years
Does Session effeciently filter unused facts, or...
by Barry Kaplan
... should I put a filter before insert().
I will have lots of events coming from hardware devices, only some of which
be applicable to a given session instance. I've tried extracting the
declared types from the packages, but that doesn't include classes used in
patterns which where only imported. So determine the actual set of event
classes used by a given set of packages seems not to be so easy.
I've drilled down to EntryPointNode.assertObject......
--
View this message in context: http://old.nabble.com/Does-Session-effeciently-filter-unused-facts%2C-or....
Sent from the drools - user mailing list archive at Nabble.com.
15 years