Oops, the correct form is actually
not (Input(...))
with an additional pair of parens just around the fact.
-W
On 3/29/10, Sebastian Furth <sebastian.furth(a)googlemail.com> wrote:
Thanks for your reply. If I formulate the rules this way I get the
following
error from the KnowledgeBuilder:
[21,4]: [ERR 102] Line 21:4 mismatched input 'not' expecting ')' in rule
"R50"
[24,66]: [ERR 102] Line 24:66 mismatched input ')' expecting 'then' in
rule
"R50
Best Regards
Sebastian Furth
2010/3/29 Wolfgang Laun <wolfgang.laun(a)gmail.com>
> If you mean
>
> when
> ( $value1: Value(...)
> not Input(...)
> or
> $value2: Value(...)
> not Input(...) )
>
> $solution: SolutionInput(...)
> then
> ...
>
> you'll have to use parentheses. If not, what *do* you mean?
> -W
>
>
> On 3/29/10, Sebastian Furth <sebastian.furth(a)googlemail.com> wrote:
> > Hello,
> >
> > i've already mailed last week with the same problem and with your help I
> was
> > able to locate the source of the following NullPointerException which
> > happens if we try to insert the Fact "knocking" (@see Source Code of
the
> > Java Class here:
http://www.pastie.org/private/juv7hh7rxahpluo5agu3q) :
> >
> > *java.lang.NullPointerException
> > at org.drools.reteoo.LeftTuple.get(LeftTuple.java:265)
> > at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)
> > at
> >
>
org.drools.rule.VariableRestriction$ObjectVariableContextEntry.updateFromTuple(VariableRestriction.java:320)
> > at
> >
>
org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:119)
> > at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:98)
> > at
> >
>
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
> > at
> >
>
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:34)
> > at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:123)
> > at
> >
>
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:145)
> > at
> >
>
org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:57)
> > at
> >
> org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)
> > at
> >
>
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
> > at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
> > at
> >
>
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360)
> > at
> >
>
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344)
> > at
> > org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
> > at
> > org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
> > at
> >
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
> > at
> >
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
> > at
> >
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
> > at
> >
>
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
> > at de.d3web.we.drools.DroolsAction.addFacts(DroolsAction.java:334)
> > *
> >
> > The source of the problem is the following rule:
> >
> > *rule "R50"
> > when
> > $value1 : Value(value == "knocking")
> > not Input(name == "Engine noises" && values contains
$value1)
> > or
> > $value2 : Value(value == "ringing")
> > not Input(name == "Engine noises" && values contains
$value2)
> > $solution : SolutionInput(name == "Bad ignition timing")
> > then
> > $solution.setValue(N3);
> > end
> > *
> >
> > Could you please tell me how I have to formulate the rule to avoid the
> > NullPointerException while inserting the fact?
> >
> > Thank you in advance for your help.
> >
> > Best regards
> >
> > Sebastian Furth
> >
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>