Some Questions related to execution
by kashif10
1) If I have a Rule definition
when
#conditions
Person( gender == "Female")
or
Procedure( needToDone == "ABC"))
then
resultIds.add("id_1000");
Is it not short circuit If first condiiton matches?
I get twice time "id_1000" in resultIds.
2) How can I chekc the multiple existence
For Example:
How can I chekc that multiple instances of Procddure have alredayDone= "ABC
"
Rule Definition only chekc once:
Procedure (alredayDone == "ABC")
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Some-Questions-relate...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Adding programmatically defined process to spring kbase definition
by Swindells, Thomas
We are currently defining our knowledge base in a spring context file like this:
<drools:kbase id="packKbase">
<drools:resources>
<drools:resource type="DRL"
source="classpath:pack/drools/1.drl" />
<drools:resource type="DRL"
source="classpath:pack/drools/2.drl" />
<drools:resource type="DRL"
source="classpath:pack/drools/3.drl" />
<drools:resource type="DRL"
source="classpath:pack/drools/4.drl" />
<drools:resource type="DRF"
source="classpath:pack/drools/FLOW.rf" />
</drools:resources>
<drools:configuration>
<drools:mbeans enabled="true" />
</drools:configuration>
</drools:kbase>
Ie a load of drl files and a rulesflow file.
We've now decided that we would rather generate the ruleflow programmatically rather than in an rf file (the process is very very regular and so it will be a lot quicker to just generate it).
What is the best way to add a programmatically declared process to the rest of the knowledge base?
Thanks,
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, 9 months
Dynamic Fact Types
by jwillans2
Hello,
I am looking for an approach to defining fact types
dynamically/programmatically. Having hunted about, I can see a few ways of
achieving this. My preferred approach to doing this would be Fact Templates
as described in the blog article here:
http://orangemile.blogspot.com/2008/07/drools-fact-template-example.html
I can see two problems with this approaches. Firstly, it seems to be an
experimental feature and generally not supported. Secondly, it only seems
to work with primitive fields (perhaps I'm wrong here?). I get the
impression that the preferred option is to use Type Declarations. In the
documentation for Type Declarations, it suggests that the rules evaluate
against an interface rather than an actual Java object and that the
interface can be implemented using different methods (POJO, reflection ..).
Is there any examples or documentation on how to do this beyond generated
Java bean class? Just to be clear, I am looking to define the fact types
programmatic in a similar manner to that described in the above blog link,
and I am eager to avoid a compilation/class loader step.
Many thanks for any help that can be offered,
James
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Dynamic-Fact-Types-tp...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Getting different results from decision tables based on number of facts - all other fact information staying the same.
by groovenarula
Background :
I have an object model is as follows :
Units 1 ---------------> 0..N Options
where a unit (basically an item in stock), can have 0 … N Options.
Items themselves have 2 primary fields - an item type (called group - a 3
digit number that represents the category the item belongs to) and a minor
item number (called style - another 3 digit number that represents the
styling of the item).
Options represent additional enhancements that can be added to the base
units. Very similar to options that can be purchased when buying a new car -
wider wheels/tires, navigation system, leather seats etc.
Now the use case is to provide the business with easy to use decision tables
that will enable them to Price items based on the base unit and the options
added to the base unit. The way pricing works is that each options has a
standard price. However there are times when options associated with a
specific group and style are priced differently.
e.g. Option 'F103' would alway be priced at 100 bucks, however when added
to a unit with group '010' and style '315' it should be priced at 120.
I've created the following approach to meet the pricing rules above:
rule "Set F103 Option price based on Group/Style"
salience 50
when
$unit : Unit ( group == "010", style == "315" )
$option : Option (unit == $unit )
Option (optionPrice == null, code == "F103" )
then
$option.setOptionPrice(120.00);
retract ( $option );
end
rule "Set F103 Option base price"
salience 5
when
$option : Option ( optionPrice == null, code == "F103" )
then
$option.setOptionPrice(100.00);
retract ( $option );
end
Question : Is there a better way to implement the rules stated above ?
The DRL works as expected when I insert one or multiple items in working
memory. The appropriate rules fire and when Group / Style = 010 / 315, the
price for the option is set to 120, but when Group and Style is anything
else, the option does get priced at 100.00.
However, when I try to implement the same rule using decision tables, I get
different results. To implement the above, I created 2 rule tables :
1. The first rule table establishes the pricing of options that are not
specific to a group / style as follows:
CONDITION PRIORITY
ACTION
$option : Option
code == "$param", optionPrice == null 5
$option.setOptionPrice($param); retract($option)
2. A second rule table that adds the unit constraints as follows (with
PRIORITY 50):
CONDITION CONDITION CONDITION
$unit : Unit $option : Option
group == "$param" style == "$param" unit == $unit, code == "$param",
optionPrice == null
ACTION
$option.setOptionPrice($param); retract ( $option);
There in lies my dilemma.
When I send one unit with Group Style 010 315 and option F103, it prices the
option properly @ 120.00.
When I send in a unit with a different style (same group = 010), it also
prices the option properly at 100.
When I when I send 2 units together - one with group and style 010 315 and
another having the same group but a different style (515 for example), it
prices the option for both units @ 120 :
010 315 option price = 120.00 (correct result)
010 515 option price = 120.00 (wrong result)
But if the second unit on the 2 units has a different group (011 for
example), I get the right option prices :
010 315 option price = 120.00 (correct result)
011 315 option price = 100.00 (correct result)
For what ever reason, it does not fire the generic pricing option even
though the second unit's G/S does not match 010 315.
Can anyone please shed some light on what I'm doing wrong here ?
Any help will be appreciated.
Thanks in advance.
Gurvinder
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Getting-different-res...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Agenda-group ignored when set in decision table
by Evert Penninckx
Hi
I'm trying to add rules in a decision table to an agenda group. When firing
the rules, these rules do not respect the grouping and are added to the MAIN
group.
In the DT, I add a first column under the RuleTable row with header
"AGENDA-GROUP" (thus, left of the first CONDITION column). Then, I put the
agenda group name for each row with values.
When I generate the source of this DT in guvnor, the agenda-group tag is not
present, either.
Bug? Or bad syntax?
Evert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Agenda-group-ignored-...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Rewriting rules
by jwillans2
Hello,
We have a rule set that need to be rewritten before being loaded into the
knowledge base. The rewrite can only be determined by data known at
runtime. Currently we can achieve this by performing string subsitutions on
the rules, however I'd like to explore more efficient (and less clumsy) ways
of doing this.
It looks like rule templates could be a less error-prone way of achieving
the same end through the use of place holders, but it still requires for the
resultant rule strings to be recompiled. I was wondering whether it is
practical to store the rules in compiled form, and then perform the
rewriting on the loaded data structures? Any suggestions and/or experience
of techniques would be very welcome.
Thanks,
James
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rewriting-rules-tp245...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
how to check if a global has been declared in a rule
by gs76pl
hi,
is it possible to check if a rule has been defined with a global as below?
global MyObject obj;
rule
when
then
Basically, i'm running below code:
ksession = kbase.newStatefulKnowledgeSession();
ksession.setGlobal("obj", new MyObject());
but if a rule doesn't have global definition my code throws an exception.
What i'd like to do is something like
ksession.getGlobal('"obj") or ksession.checkGlobalExist('"obj").
Unfortunately the first method doesn't work as it doesn't check if a global
has been declared in a rule
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/how-to-check-if-a-glo...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
Rules Integration.
by Luciano A. Andrade
Hello, I am starting to learn Drools Guvnor, I manage to make some
very basic samples, but I need to integrate it with a PHP application,
the integration, is to be something like this:
"A Page is created" when the page is created, rules should run a
complete the business logic. very basic example.
after looking around i found this resources:
http://blog.athico.com/2008/05/rest-api.html as i am understand it i
can create the rules and packages but since i dont expect to manage
the rules from the PHP app, is not uselfull.
Now i think that what i am looking for is this
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-integrati...
since the other examples i found that run some rules are from java
code.
I am currently using the Drools Guvnor Standalone 5.1, "Standalone
Guvnor with JBoss AS" , the problem is that i don't know how to use
the mvt files
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-camel/src/test/re...
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-camel/src/test/re...
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-camel/src/test/re...
now poking around the configuration files i found the url
http://localhot:8080/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI
but i could not found any reference to it or how to useit.
Please, any pointer will be apreciated.
Thank.
13 years, 9 months
Instructions for upgrading designer.war?
by Han Ming Low
Hi,
I understand that the designer.war is a project by intalio.
When looking at the source for the war at
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/designer/desi...,
I saw the changes to be made to make it compatible with Drools.
I think I can do some of the steps like
1) changing the web.xml to use tomcat instead of jetty
2) added slf4j library
3) move lib/bpmn2 library to web-inf/lib
4) changes to oryx.js that involve
- commenting out the header
- commenting out the log
- change the repository url from "/designer/uuidRepository?uuid="+ uuid to
"/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI?action=load&uuid="+ uuid
However, I'm not sure what is the BPMN2 import/export classes to replace in
WEB-INF/classes
Can someone could tell me which are the classes?
I can also help to update the designer. :)
Thanks.
Han Ming
13 years, 9 months