For each loop in drools
by Tina Vießmann
Hi,
is it possible to use the for each loop in Drools?
The engine grouses a type mismatch : cannot convert from element type
Object to Value
Thanks :)
Tina
15 years, 10 months
Caching results in temperory variables
by Manav
Hi,
I am using the version 5.x of drools and i have a scenario where i want to hold
the result of
a test in one rule to a temperory variable . This result will then be used in
another rule that will be fired
later in the sequence .
For ex :
salience 100
when
User (language.keySet contains "Japanese", $j_score : language["Japanese"])
then
// do something
end
salience 50
when
User (language.keySet contains "French", $f_score : language["French"])
then
// do something
end
salience 25
when
eval (($j_score + $f_score) > 4)
then
// update the same to db
end
Is this possible in Drools 5.x ?
Regards,
Manav
15 years, 10 months
Exception: rule 'end_key' failed predicate
by Tina Vießmann
Hi,
I'm receiving a exception when trying to run my application:
[ERR 103] Line 44:24 rule 'end_key' failed predicate:
{(validateIdentifierKey(DroolsSoftKeywords.END))}? in Watcher[55,0]:
[ERR 101] Line 55:0 no viable alternative at input 'global' in rule end
The relevant code is:
declare Watcher
@role ( event )
triggeringValue : Value
numberOfContainedValues : int
valueSet : Set<Value>
end
global Logger LOG; # Line 55
I know the problem lies in the Watcher declaration, but I don't know
what it is.
Thanks for any help! :)
Tina
15 years, 10 months
Drools Expert scalability
by Dieter D'haeyere
I have a question regarding the scalability of Drools Expert.
Situation is as follows:
- Individual cases have to be evaluated by the rule engine (result is a
tarrif that could be refunded).
- the application receives the cases in flat files with 50K cases each. The
app parses them and sends them one by one to the rule engine
- the application receives multiple batch files per day.
- seperate cases can be dependant on each other. Eg. if max 1 refund can be
done to an actor, two cases about the same actor can not run in parallel.
- loads will be huge, scalability is an issue
So, what I see now
- Drools Server can be run as a server
- It is possible to have multiple instances of drools server, this would
allow to evaluate cases in parallel. But ... this can cause problems (as
stated before): you can't run any two cases in parallel. Preprocessing
could be done by the application (eg. determining the order in which to
present the cases to the rule engine) but over time extra constraints can
appear so preprocessing would have to be maintained continuously.
So, this is an issue :)
My questions are:
- is it eg possible to organise rules such that different rules can run on
different rule engines. Like that you could have some kind of pipeline.
Maybe this could be defined with ruleflow ? Compare to the pipelines in
CPU's (for executing machine code). Could you eg. relate one server
instance to one set of rules and another server instance to the sequential
next set of rules ? How would you configure that (performance is of course
important).
- Or, is it possible to split rules but not as a pipeline but in parallel...
like a 'fork .. join' . Again, this could be configured with ruleflow?
- What do you see as the best way to solve this issue ?
Any help is welcome,
Dieter D'haeyere.
15 years, 10 months
How to do validation of facts in a Stateful Session?
by Stephen Mcgruer
Hi there,
My project uses Drools to (among other things) validate new
facts/updates to old facts, according to a set of rules. (For example,
we might have a rule that says "No two people can be named the same
thing".) Our method of validation and error reporting was originally
chosen for a stateless session (before we had the requirement of doing
checks like the above), and I feel I've had to hack it a bit much to
get it working with stateful sessions. The current methodology is:
1. (Website) The user inserts/updates a fact.
2. (Java) If the fact is new, an object is created for it. If it is an
update, the pre-existing object is fetched from the object repository
(the interface to the database) and a backup copy of the object is
taken.
3. (Java) This fact is either inserted into the KnowledgeBase (KB) or
a pre-existing fact in the KB is updated depending.
4. (Rules) If the new/updated object fails a validation rule, it will
be retracted and a ValidationError object will be inserted into the KB.
5. (Java) The code then searches for ValidationError objects that
match the just inserted/updated object. If it finds any it records
them and then retracts them from the KB.
6. (Java) If there are no errors, then that's it - a success report is
generated and passed back to the website.
7. (Java) If there were errors, then if the user was updating a fact
the backup of it (before the changes) is inserted back into the KB.
The website is then passed a failure report.
It just feels very hacky to do so much manual insertion/retracting
from the Java side of the code.
So, is there a 'correct' way to do stateful validation? And does our
current way even work, or are there hidden problems that we've not
spotted?
Cheers,
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
15 years, 10 months
Drools Guvnor
by Rajesh R.V - ESA
I am working with OTA model, and I have around 2800 classes in my model.
When I open the technical editor, looks like it introspects all classes
to show the fact types.
It is taking a long time. I want to switch off this and I don't want to
see the fact types at all. Which class I need to change.
Regards
RV
15 years, 10 months
Fwd: Retrieve values from a Map
by Wolfgang Laun
Since this was sent to me only, I feel I ought to forward it to the list.
I do like "f*u*ntastic" :-)
-W
---------- Forwarded message ----------
From: Manav <manav7574(a)yahoo.com>
Date: 12 August 2010 05:41
Subject: Re: [rules-users] Retrieve values from a Map
To: Wolfgang Laun <wolfgang.laun(a)gmail.com>
[snip]
Really appreciate it . I must the Drools is just funtastic and the Drools
Team
even better :)
Regards,
Manav
15 years, 10 months
Retrieve values from a Map
by Manav
I am new to drools and currently using version 5.1 for my testing.
I am facing an issue with retrieving a value from Map if a key is present
In my drl if i do this
$c : Client (language contains "Japanese" , lang : language ->
(language.get("Japanese").equals("Expert")))
it works ...but if i want to retrieve the value of the key i am not sure how to
go about it . I tried various approaches but none of them worked
i would like to do something like
$c : Client (language contains "Japanese", $langValue :
language.get("Japanese"))
Can some one please guide me how to go about it .
Regards,
Manav
15 years, 10 months
Drools 5.1 Update Site
by Georg Maier
Hi,
is there any reason why 5.1. final Eclipse Workbench is not put into an
Update Site? Sure it is possible just to drop in the content of the zip, but
I think Update Sites are far more comfortable :-)
Furthermore, there actually is an Update Site - but it's kind of empty...? On
purpose?
Any information would be appreciated :-)
Thanks in advance!
Cheers
Georg
15 years, 10 months