Inserting new Object
by Tina Vießmann
Hi again ...
I would like to insert a new generated object into the knowledge base.
It seems that
insert (new Watcher())
is working. But
Watcher watcher = new Watcher();
insert (watcher);
isn't working?
Why?
Thank you for any explanations. :)
Tina
14 years, 3 months
npe in LogicalRetractCallback when using jpa persistence
by Chris Raschl
Hi guys,
I think I've found a problem in the TruthMaintenanceSystem and would
like to know if its a real bug or if I've made some mistake...
I'm using the latest drools and drools flow snapshot with jpa persistence.
When I'm retracting a fact from the knowledge session (which causes
logical retraction), the session can't be persisted any more.
During retraction a LogicalRetractCallback is instantiated using this
constructor:
public LogicalRetractCallback(final TruthMaintenanceSystem tms,
final LogicalDependency node,
final Set set,
final InternalFactHandle handle,
final PropagationContext context,
final Activation activation) {
this.tms = tms;
this.node = node;
this.set = set;
this.handle = handle;
this.context = context;
}
As you can see an activation object can be passed (and actually is
passed) to the constructor, but is never used. Retraction works though.
The problem occurs when the knowledge session is persisted, because
LogicalRetractCallback.write assumes that activation is not null, which
leads to this npe:
Caused by: java.lang.NullPointerException
org.drools.common.TruthMaintenanceSystem$LogicalRetractCallback.write(TruthMaintenanceSystem.java:251)
org.drools.marshalling.impl.OutputMarshaller.writeActionQueue(OutputMarshaller.java:201)
It would be cool if anyone could have a look at this...
Thanks,
chris
14 years, 3 months
where can I find the drl compiled java file?
by Badrinath, Shyam
Hi
I am facing a weird problem where the rule works fine for the first time
after I start the rule engine. After that, the same set of data causes
the rule engine to give a nullpointerexception when firing the rule
action. It gives the line # in the compiled java file, but I cannot find
that file. The line # doesn't match the drl (obviously), so I can't make
sense of where the exception could be occurring.
So, where can I find this drl compiled java file?
Thanks
Shyam
14 years, 3 months
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
14 years, 3 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
14 years, 3 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
14 years, 3 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.
14 years, 3 months