Drools 3.0.6 support for enum's on jdk 1.5 ?
by Maxim Veksler
Hello list,
I have a rule that generally speaking looks like this :
rule "ABC"
when
$f : FilteringStateConnector($campaignId : campaignId)
$campaign : Campaign(code == $campaignId
,$limitTypeEnum : limitTypeEnum, $limitByEventType :
limitByEventType)
// Check Budget limit pass conditions:
(
eval(BooleanLogging.trace(log, "DEBUG: " + ($limitTypeEnum ==
ENUM1.BudgetLimitFlag))) and
eval(BooleanLogging.trace(log, "DEBUG: Always here, right now"))
and
eval(BooleanLogging.trace(log, "DEBUG: " + ($limitByEventType ==
ENUM2._2_EXPOSED))) and
Campaign(code == $campaignId, limitTypeEnum ==
ENUM1.BudgetLimitFlag, limitByEventType == ENUM2._2_EXPOSED) and
eval(BooleanLogging.trace(log, "DEBUG: Right here, right now"))
) or (
...
)
then
...
end
The line """ eval(BooleanLogging.trace(log, "DEBUG: " +
($limitTypeEnum == ENUM1.BudgetLimitFlag))) """ evaluates to "true" in the
logs.
The line """ eval(BooleanLogging.trace(log, "DEBUG: " +
($limitByEventType == ENUM2._2_EXPOSED))) """ as well. These are java (eval)
checks for truth. If I try to use Drools to gain the rete optimization by
writing :
""" Campaign(code == $campaignId, limitTypeEnum ==
ENUM1.BudgetLimitFlag, limitByEventType == ENUM2._2_EXPOSED) """, It never
reachers past that line. why is that? Can't Drools 3 check for truthness of
Enum conditionals ?
I would love to supply more information if required.
Help is highly appreciated,
Maxim.
--
Cheers,
Maxim Veksler
"Free as in Freedom" - Do u GNU ?
17 years, 10 months
Queries with bound variables
by Senlin Liang
In the following program, i want to compute the paths:
<code>
rule "base"
when
edge : Edge(x : first, y : second)
not Path(first == x, second == y)
then
insert(new Path(edge.getFirst(), edge.getSecond()));
end
rule "recursive"
when
edge : Edge(x : first, z : second)
path : Path(first == z, y : second)
not Path(first == x, second == y)
then
insert(new Path(edge.getFirst(), path.getSecond()));
end
</code>
My question: How to express the query "path(cityA, X)?" efficiently in drools?
Since the first element is bound to 'cityA', I am wondering whether
drools can make use of it. I think there should be more efficient way
than firing all rules.
Thanks,
Senlin Liang
17 years, 10 months
Check if a pattern binding exists in the RHS
by hatzlj
Hello everybody,
on the LHS of my rule i connect several Conditions with OR and have
different variable bindings for this Condition. Now - if any of this
conditions does not fire, i assume that the binding variable is not created,
so I can't access it in the RHS. This results in an null pointer exception
when I call the fireAllRules-Command in my Java Application.
A simple rule example:
rule "Rule 1"
when
HKT: Parameter(parameterCode = "HKT", value < normalFloor) or
GGT: Parameter(parameterCode = "GGT", value < normalFloor) or
HSR: Parameter(parameterCode = "HSR", value < normalFloor) and
GOT: Parameter(parameterCode = "GOT", value > normalFloor)
then
System.out.println(HKT.toString();
end
So my Question is: Is there any way to check in the RHS wheter the pattern
binding has been created or not or do i have to change the way of writing my
rules (which i do not want to)?
thanks,
hatzlj
--
View this message in context: http://www.nabble.com/Check-if-a-pattern-binding-exists-in-the-RHS-tp1903...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 10 months
FROM and the working memory
by David Boaz
Hi all,
in the drools manual (6.5.28): "FROM allows the engine to reason over data
not in the working memory".
Will drools use rete to evaluate patterns with a FROM source?
Lets assume the following rule:
WHEN p:Person(age>60), Address(city="NY") FROM p.addresses
will the rule engine match the Address pattern using rete?
and, what about the following rule:
when p:Person(age="m"), Person(age>60) from p
1) will it work?
2) will the age constraint be matched using rete?
Thanks, David
--
View this message in context: http://www.nabble.com/FROM-and-the-working-memory-tp19020847p19020847.html
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 10 months
How can I know from the drools*jar files what version of drools I'm using ?
by Maxim Veksler
Hello everyone,
I have recently stumbled upon a bug with Enum's that could possibly indicate
I'm using an old version of Drools3. How can I verify that exact version of
the jar files I have in my system? Alternatively, where can I download
previous versions of Drools so that I could md5sum the files until I find
the matching md5?
Thank you,
Maxim.
--
Cheers,
Maxim Veksler
"Free as in Freedom" - Do u GNU ?
17 years, 10 months
Creation of RuleFlows using API (Runtime)
by Vikram Shitole
Hi,
I have a requirement in which the rules /ruleflows needs to be created at runtime.
We have our own data structure which holds the data for creation of rules/rulesflows.
I have created the rules using the brms RuleModel.
Is there a similar API for RuleFlows ?
It will be helpful somebody give me the necessary pointers to start this.
Thanks in Advance
Thanks & Regards
Vikram Shitole
MASTEK LTD.
Making a valuable difference
Mastek in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 years, 10 months
Re: [rules-users] how to share functions between drl files ?
by psentosa
Write your function as a static function.
Both rules have to import this function just like importing class
By using BRMS you put your function as a function asset and any rule can
(from the same package) can use it
regards
Ady Bastian wrote:
>
> I have same functions that is used on two rule files (.drl), is it
> possible to
> share the functions without write it twice.. ?
>
> Example :
> -------------------
> file: rule1.drl
>
> rule "rule_on_file_1"
> when
> ....
> call_function();
> end
> --------------------
> file: rule2.drl
>
> rule "rule_on_file_2"
> when
> ....
> call_function();
> end
> ---------------------
>
> call_function is a drool function :
>
> function call_function() {
> ....
> }
>
--
View this message in context: http://www.nabble.com/how-to-share-functions-between-drl-files---tp189764...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 10 months
Runtime fact-set and rule-set separation
by Tomasz Krzywicki
Its actually resend from dev list as I was pointed out that topic
is rather about drools usage not new feature development.
Thats very promising ...
I am looking for some lightweight solution of fact sets separation
withing single working memory. ... I am possibly messing up with
terminology therefore please let me present an example.
I have set of facts
"Set 1" contains:
- Fact ( name==A, property==1)
- Fact ( name==B, property==2)
"Set 2" contains:
- Fact ( name==A, property==1)
- Fact ( name==C, property==2)
- I would like to execute my dedicated package of rules for
instance of "Set 1" within single working memory.
- When "Set 1" is inserted ( instantiated ) twice or more into the
working memory I would like to separate the scope of rules to
this particular instance
- I would like to insert "Set 2" at the same time multiple times
and execute separate set of rules dedicated for "Set 2" separately
on each of inserted instance of "Set 2"
- In some cases I would like to have access to facts from other
instances of different sets within same working memory. eg.:
- rule associated to "Set 1" checks all the occurrences of
Fact( name == A ) - means it could read state of Fact
from other instances of "Set 1" and "Set 2"
- rule associated to "Set 1" checks state of fact associated
to Fact ( name == A ) from "Set 2"
I could do it currently by
- adding extra fact indicating instance to working memory
- adding property to my Fact indicating origin ( instance in this case )
- altering each rule.
Example: reaching facts in particular instance
...
when:
Instance ( instanceId: id, name == "Set 1")
Fact ( ... , origin == instanceId )
...
then
( ... )
Example: reaching fact in multiple instances
...
when:
Fact (...)
...
then
Idea behind is very prosaic. Majority of the rules are written
in my case with single instance context in mind. Only sometimes
there is a need to look out of the "hedge".
So my example requires more typing and better specification
for *modeler* ( name of the role in my org - means person who
writes the rules ) who is using simpler single *model*
( set of rules + set of facts ).
I am trying to implement this using multiple, chained working
memories but maintenance of graph of working memories does
not look very practical for longer term and its not working
perfectly.
How could it be implemented - high level of course
Or better ... How I would like to use it :)
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage ( "Set1" , MyPackageForSet1 );
// 1st argument is context name, 2nd compiled rule package
WorkingMemory wm = ruleBase.newStatefulSession();
wm.insertInContext ( "Set1", new Fact (A,1) ) // this could be also
solved by implementing interface on the fact
// inserting instance and context pointer after fact creation
// and then inserting it to wm regular way.
than if there would be a need to reach fact from other
contexts I would specify it using something-like-this syntax
...
when
Fact ( ... ) // facts within same context and instance
*.Fact ( ... ) // facts from all facts sets (contexts)
<ContextName>.Fact ( ... ) // facts from all
// instances of specific context.
<ContextName>(*).Fact ( ...) // same as above
<ContextName>(1).Fact ( ...) // facts from specific
// instance of specific context.
Ok. What I am looking here.
- is something like this possible now out of the box and
I skipped this nice chapter in documentation?
- does it make sense from your point of view to implement this
kind of functionality. In my case it has lets say business
justification and will allow to implement really complex solutions in
nice way.
- Does this problem have some buzzwordish/scientifically blessed
name so I can express it better next time or maybe find something
interesting in mailing list archive.
(Changing subject to something more sufficient is more the welcomed )
- is it at all possible ;)
- what I am missing in this problem description?
And big thanks for reading it till the end.
tk.
17 years, 10 months
BRL in Guided Editor in Eclipse
by Dr. Irene Weber
Hi,
how to use the Drools Guided editor for authoring brl rules in Eclipse?
The manual says I should provide a (rule).package file with package name and import statements but that did not work for me.
Thanks for any hints!
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
17 years, 10 months