Re: [rules-users] Having problems with traits in 5.4.0beta2
by Greg Barton
It's not, but can easily be. I just tried that, though, and the same exception happened.
DRL attached. It's an old attempt to update the classic monkeys and bananas example to make it a bit more interesting: wandering monkeys, stacking blocks, a bit of world physics, stuff like that. I haven't touched it for several years and wanted to update it with new drools features for a presentation I'm doing on Tuesday. I was able to use the new parser features to eliminate a ton of evals, and would like to put traits and propSpecific features in.
And just to confuse things a bit I have a question about propSpecific. :) Is it possible to annotate a method to indicate that it changes properties on a different object type other than itself? Take the "monkey_finds_block" rule as an example. The Monkey.setHolding() method modifies the thing that's being held. It would be great if I could annotate Monkey.setHolding() to indicate that it not only modifies Monkey.holding, but also Entity.location and Entity.holds.
--- On Sun, 3/11/12, Davide Sottara <dsotty(a)gmail.com> wrote:
> From: Davide Sottara <dsotty(a)gmail.com>
> Subject: Re: [rules-users] Having problems with traits in 5.4.0beta2
> To: rules-users(a)lists.jboss.org
> Date: Sunday, March 11, 2012, 11:58 AM
> Is HungryMoneky an interface you have
> outside the DRL?
> Can you send me the full DRL anyway?
> Thanks
> Davide
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/rules-users-Having-problems-with-traits...
> Sent from the Drools: User forum mailing list archive at
> Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
13 years, 8 months
Clarification of how the Persistence Manager works
by Akinmolasire, Denis
Hello All
I understand that Guvnor uses the PersistenceManager in JackRabbit to persist data but I would like confirmation of how it works. Namely the following.
* What actions cause the PersistenceManager to persist data?
* When a back end java process connects to the Guvnor server in terms of accessing the Knowledgebase is it through a Cache or direct database connection?
* If a user updates the knowledge is it real time update or does the user need to click on Save and validate to persist the change.
Thanks
Denis A
13 years, 8 months
NPE from LHS of rule is not returned by Drools to calling program
by scottleff
During development of our Drools rule base I had a case where a rule compiled
fine, but at runtime a NPE is thrown by MVEL when applying the predicate
(LHS) because the Coverage.vehicleSupplement attribute was NULL. I had
expected the NPE to be returned to my calling java program so that my
try/catch could address the issue. However, the exception was sent to
System.err and the rule was simply skipped. First, is the the default
behavior in Drools for Exceptions thrown from the LHS? If so, can it be
overridden to actually return the exception?
rule "BR--UM Stacked Coverage"
agenda-group "BR_Change"
dialect "mvel"
when
coverage : Coverage( vehicleSupplement.stackable == true , coverageCode ==
"UDCSL")
vehicle : Vehicle( unitAtRiskNumber : unitAtRiskNumber)
Policy( state == "NM" )
then
WorkItemReason fact0 = new WorkItemReason();
fact0.setType( "Policy" );
fact0.setReason( "6408: UM/UDM stacking change" );
fact0.setAddBookmark( "VE" );
fact0.setAddBookmarkUnit( unitAtRiskNumber );
insertLogical(fact0 );
end
*Here is the stacktrace from my console:*
WARNING: java.lang.RuntimeException: cannot invoke getter:
getVehicleSupplement [declr.class: com.fbfs.pc.ecd.model.Coverage;
act.class: com.fbfs.pc.ecd.model.Coverage] (see trace)
at
org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:74)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:106)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:87)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122)
at org.mvel2.MVEL.executeExpression(MVEL.java:954)
at
org.drools.base.extractors.MVELClassFieldReader.getValue(MVELClassFieldReader.java:100)
at
org.drools.base.extractors.BaseObjectClassFieldReader.isNullValue(BaseObjectClassFieldReader.java:179)
at
org.drools.base.evaluators.EqualityEvaluatorsDefinition$BooleanEqualEvaluator.evaluate(EqualityEvaluatorsDefinition.java:555)
at org.drools.rule.LiteralRestriction.isAllowed(LiteralRestriction.java:87)
at org.drools.rule.LiteralConstraint.isAllowed(LiteralConstraint.java:109)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:458)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:180)
at
org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:174)
at
PolicyDefinitionRules.Rule_policyDefinition_UnitAtRiskCoverage.defaultConsequence(Rule_policyDefinition_UnitAtRiskCoverage.java:8)
at
PolicyDefinitionRules.Rule_policyDefinition_UnitAtRiskCoverageDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:708)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:672)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at
com.fbfs.pc.rulesengine.controller.RulesEngine.runRulesEngine(RulesEngine.java:318)
My expectation that Exceptions thrown from the consequence (RHS) are
returned to the calling program was confirmed when I added the following 2
lines to a rule that was not experiencing the above issue:
String myString = null;
System.out.println(myString.trim());
Is there any good documentation on Drools exception handling?
Current configuration is Drools 5.3.0, MVEL 2.1.0, Glassfish 2.1
--
View this message in context: http://drools.46999.n3.nabble.com/NPE-from-LHS-of-rule-is-not-returned-by...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
[drools-spring]Incompatibility with jdk 5
by jsoula
Hello,
I'm using drools-spring version 5.3.0.Final, jdk 5.
During execution, i have this error:
Caused by: java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z
at
org.drools.container.spring.namespace.ResourceDefinitionParser.parseInternal(ResourceDefinitionParser.java:89).
Indeed the class ResourceDefinitionParser use String.empty. This is an
upgrade from 5.2.1.Final.
Is it a bug? Or is the compatibity with jdk5 no more maintained?
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/drools-spring-Incompatibility-with-jdk-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Multi-function Accumulates
by Hassan
Hello everybody
I don't know why the Multi-function Accumulates doesn't work,
I m just copying the code given in he documentation
rule "Max, min and average"
when
accumulate( Cheese( $price : price ),
$max : max( $price ),
$min : min( $price ),
$avg : average( $price ) )
then
System.out.println($max+" "+$min+" "+$avg);
end
But it gives me some problems !!
-----
Youssef AZBAKH.
--
View this message in context: http://drools.46999.n3.nabble.com/Multi-function-Accumulates-tp3867251p38...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
how to use not in oparator in guided decision table in 5.2 version of Guvnor ?
by vadlam
Hi,
how do we specify the condition field1 not in (A,B,C) in a guided decision
table in Guvnor 5.2?
I can use field1 in (A,B,C)
but no option to specify
not in (A,B,C)
if no other option within the guided decision table, I suppose I would have
to go the template route.
unfortunately, we have to add this condition for an existing decision table
that is quite long, so having to add back all that data to a spreadsheet
table would be painful
Thanks for sharing your thoughts.
-----
Ram
--
View this message in context: http://drools.46999.n3.nabble.com/how-to-use-not-in-oparator-in-guided-de...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
test
by joe_zendle@yahoo.com
please ignore
13 years, 8 months