Chris,

  The following must work just fine:

Person( girlAge : age, sex = "F" )
not Person( boyAge : age -> ( girlAge.intValue() == boyAge.intValue() + 2 ), sex = 'M' )

The only reason I can see for that to fail is if age is an object type attribute (Integer, Double, etc) and it is set to null. Otherwise, it is probably a bug.
  Bellow is not supposed to work:

Person( girlAge : age, sex = "F" )
not Person( boyAge : age, sex = 'M' )
eval ( girlAge.intValue() == boyAge.intValue() + 2 )

The reason is because "not" means you DON'T have a Person object with that attributes (the boy), so you can't eval anything using "boyAge".

   []s
   Edson

Chris West wrote:

Does anyone know if there is a problem using a "not" combined with a
predicate expression?  Drools gives me a NullPointerException
sometimes when evaluating my predicate.  The example from the user
guide is:

Person( girlAge : age, sex = "F" )
Person( boyAge : age -> ( girlAge.intValue() == boyAge.intValue() + 2
), sex = 'M' )

Buy I'm trying something similar to:

Person( girlAge : age, sex = "F" )
not Person( boyAge : age -> ( girlAge.intValue() == boyAge.intValue()
+ 2 ), sex = 'M' )

And also:

Person( girlAge : age, sex = "F" )
not Person( boyAge : age, sex = 'M' )
eval ( girlAge.intValue() == boyAge.intValue() + 2 )

Is there anything wrong with these?  The compiler does not have a
problem with the former, but does not like the latter.  I'm using
Drools 3.0.5.  I'm basically trying to say "there is a girl, and there
is not a boy whose age is 2 years less than the girl".

Any thoughts on this would be greatly appreciated.

Thanks,
-Chris West
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com


_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to