[rules-users] Return value operator

Edson Tirelli tirelli at post.com
Thu May 17 08:38:14 EDT 2007


    Mithun,

    There are 3 similar constructs you can use in a rule:

INSIDE PATTERNS: inside patterns you can use:

1) predicate: a predicate is an expression in the target dialect language (
as we speak, only java fully supported, but soon we will have MVEL too ).
The expression MUST return a boolean value. Ex:

Cheese( $price : price -> ( $price * $factor < 100 ) )

2) return value: it is also an expression in the target dialect language,
but that returns a value that is compared against a field:

Cheese( price < ( 100 / $factor ) )

OUTSIDE PATTERNS: if we want to write an expression that is not inside a
pattern, you must use:

3) eval: it is an expression similar to a predicate (must return a boolean
value), but that is NOT inside any pattern:

eval( $price * $factor < 100 )

    IMPORTANT: in 4.0 MR3, it will not be mandatory to have the variable
binding for predicates anymore. Instead, we will use the same keyword to
identify predicates and evals. The difference is one will be inside a
pattern and the other outside. I will avoid examples now just in case
something changes until there... when it is ready we will provide the
examples and the documentation for the final release.

    []s
    Edson


2007/5/17, Mithun <mithun.gooty at spi.com>:
>
>
> hi all,
>
>      1.  can anybody help me in understanding the usage of Return Vlaue
> operator (->) and eval operator? Suggest few examples if possible.
>
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/Return-value-operator-tf3771432.html#a10662503
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070517/0913d449/attachment.html 


More information about the rules-users mailing list