RuleSet (RuleFlowGroup)
by rchemisa
Hello,
I'm trying tp understand how does the Rule Set works and I'm experiencing
some problems. I need it to stop
when the process finds a 'rule set' and it doesn't match with the
conditions, however, the process continues even the facts do not fulfill the
conditions.
Can someone explain me how does the 'rule set' works or can u give an
example?
thank you very much
--
View this message in context: http://drools.46999.n3.nabble.com/RuleSet-RuleFlowGroup-tp3165058p3165058...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Serializing knowledgepackages - execution behaviour
by FrankVhh
Hi all,
After playing with serializing knowledgepackages a bit, I stumbled upon some
behaviour which I cannot explain at the moment. I can only hope someone can
deliver a hint of insight into this.
The situation:
Creating and executing a rule engine with the very same rules. In the first
attempt, rules are serialized first. Note that only the rules are
serialized, not the engine.
In the second attempt, the "normal" (= "as in the hello world sample")
procedure is used to feed the rules to the engine.
I noticed some performance differences at execution time, which amaze me a
bit, as I can't see a reason why execution would differ...
When loading the serialized rules, rule execution is slightly slower and,
more important, there are some glitches in the performance (execution times
over 10 times slower than average execution). Unserialized rules run much
smoother and much more consistent.
Does anyone have any explanation for this? I am very interested to find out.
Thanks a lot.
Regards,
Frank
--
View this message in context: http://drools.46999.n3.nabble.com/Serializing-knowledgepackages-execution...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Re: [rules-users] Rule error
by FrankVhh
Hi,
It depends upon which version of drools you are using, but if it is a
version pre 5.2.0, than your last line should be:
eval($c.getDoMin()>=$m.getDoMin())
If you are using 5.2.0, the parser allow a bit more freedom, allthough I am
not sure about this very case. You surely will have to omit the ; at the end
of your condition.
Regards,
Frank
michou89 wrote:
>
> rule "ValidMechanism"
> when
> $c : Capacity(doMin>20)
> $m : Mechanism(DMOMax<=30, doMax>50 && doMin<40 && maxPower>180 &&
> minPower>=100 && bidPower>100 && <200)
> $c.getDoMin()>=$m.getDoMin();
> then
> System.out.println("Capacity n°"+$c.getIdCapacity()+" eligible to the
> mechanism n°"+$m.getIdMechanism()+" for rule 1" );
> end
>
>
> My error : org.drools.rule.InvalidRulePackage: [40,15]: unknown:40:15
> mismatched token: [@100,813:814='>=',<78>,40:15]; expecting type THEN
> (this is the last line before the "then")
>
>
> I don't understand why I can't compare 2 values.
>
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-error-tp3162619p3165771.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
repository in 5.2.M2 crashes in 5.2.Final because of decision table serialization
by Vincent LEGENDRE
Hi all
We tried to use the 5.2.Final version of Guvnor, but the compilation fails with an error saying that class "dtable" does not exists.
After looking more depply, it appears that the XML storage format has changed in 5.2.Final :
- root XML is now " decision-table52 " instead of "dtable"
- pattern is now " org.drools.guvnor.client.modeldriven.dt52.Pattern52 " with some condition-column grouped by fact, instead of independant condition-column
- pattern is now " org.drools.guvnor.client.modeldriven.dt52.Pattern52 " with some condition-column grouped by fact, instead of independant condition-column
- actions is now " insert-fact-column 52" instead of the same thing without version in it, but this time no structure changes ...
Is there a way to migrate old tables to new format ?
Changing a repository.xml by subtitutions is OK ?
Do we have to plan such problems for future versions ?
13 years, 4 months
How to Access and Execute Rules from Database
by Ashish Soni
Hi All ,
I am able to configure oracle database in drools but now i am not able to
find how can i load rules from the DB and execute them , I gone through the
documentation but not able to get much information or might be i am missing
something.
If any one can provide me a example or some pointer ,hints then it would be
helpful.
Regards,
Ashish
13 years, 4 months
Drools and serialize
by clement.pernot
Hi,
I want to serialize a StatefulKnowledgeSession in drools (which have rule
and fact)
Actually i know how to serialize a KnowledgeBase.
Here is my code for serialize a KnowledgeBase:
KnowledgeBuilder kBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kBuilder.add( ResourceFactory.newFileResource( "Sample.drl" ),
ResourceType.DRL );
if( kBuilder.hasErrors() ){
for( KnowledgeBuilderError err: kBuilder.getErrors() ){
System.err.println( err.toString() );
}
throw new IllegalStateException( "DRL errors" );
}
KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
kBase.addKnowledgePackages( kBuilder.getKnowledgePackages() );
OutputStream os = new FileOutputStream( "droolsCompiledFile" );
ObjectOutputStream oos = new ObjectOutputStream( os );
oos.writeObject( kBase );
oos.close();
This work fine, no problem here.
Here is my code for serialize a StatefulKnowledgeSession:
KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kBuilder.add( ResourceFactory.newFileResource( "Sample.drl" ),
ResourceType.DRL );
if( kBuilder.hasErrors() ){
for( KnowledgeBuilderError err: kBuilder.getErrors() ){
System.err.println( err.toString() );
}
throw new IllegalStateException( "DRL errors" );
}
KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
kBase.addKnowledgePackages( kBuilder.getKnowledgePackages() );
try {
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
ksession.insert(message);
Marshaller marshaller = MarshallerFactory.newMarshaller(
ksession.getKnowledgeBase(), new ObjectMarshallingStrategy[]{
MarshallerFactory.newSerializeMarshallingStrategy() } );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectMarshallingStrategy oms =
MarshallerFactory.newIdentityMarshallingStrategy();
marshaller.marshall( baos, ksession );
ObjectOutputStream out = new ObjectOutputStream( baos );
out.writeObject( marshaller );
out.close();
baos.close();
ksession.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
But this didn't work.
I get always the same error:
"java.io.NotSerializableException"
I have try to not implement the "marshall" but this didn't work.
I don't know what I must do. Can someone help me?
Thank.
Best regards,
Clement Pernot
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-and-serialize-tp3161882p3161882....
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
BRMS on WebLogic
by Benson Fung
Hi,
Is there installation documentation how BRMS/Drools Guvnor is
installed on WebLogic server? Please help.
Thanks
Benson
13 years, 4 months
Temporal reasoning with external persistence not working
by Aman Teja
I am trying to use an external storage for loading and persisting objects.
But when I try a set a temporal reasoning rule it start to fail. The rule,
test code and exception are given below. Please help
// rules file
package foo.externalwm;
global foo.ExternalStorage session;
import foo.externalwm.YUser
import foo.externalwm.Test
declare User
@role(event)
end
declare Contest
@role(event)
end
rule "test"
dialect "java"
when
$c1:Contest() from session.getContestByName("Contest1")
User(this after[0,3m] $c1) from session.getUserByIndex(0)
then
System.out.println("rule fired");
end
// ************ code
public class Test {
public static void main(String[] args) throws Exception {
KnowledgeBaseConfiguration config =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );
KnowledgeBase k = init(); // read and compile rules done here
final StatefulKnowledgeSession ksession =
k.newStatefulKnowledgeSession();
ExternalStorage session = new ExternalStorage();
ksession.setGlobal("session", session);
ksession.fireAllRules();
}
***********EXCEPTION
Exception in thread "main" org.drools.RuntimeDroolsException: Unexpected
exception executing action
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction@669a4cb
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:996)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:730)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:699)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at foo.externalwm.Test.main(Test.java:55)
Caused by: java.lang.ClassCastException: org.drools.common.DefaultFactHandle
cannot be cast to org.drools.common.EventFactHandle
at
org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedLeft(AfterEvaluatorDefinition.java:332)
at
org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:110)
at
org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:111)
at
org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:127)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:274)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:137)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:64)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:279)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:137)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:138)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:141)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:143)
at org.drools.reteoo.Rete.assertObject(Rete.java:107)
at
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:260)
at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:343)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
... 4 more
--
View this message in context: http://drools.46999.n3.nabble.com/Temporal-reasoning-with-external-persis...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months