[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1040) Multi-pattern accumulate support

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Fri Sep 21 09:40:11 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBRULES-1040?page=comments#action_12378044 ] 
            
Edson Tirelli commented on JBRULES-1040:
----------------------------------------

Geoffrey, look at my example:

"All connectives used in the source must be explicitly defined, like the "and" in the above example. "

So, you need to use "and", "not", "exists", etc in your source patterns in the accumulate:

rule "constraintsBroken"
  when
    $multipleQueensHorizontal : Long()
    from accumulate(
        $q1 : Queen($id : id, $y : y) and
        Queen(id > $id, y == $y)
      , count($q1)
    );
    $multipleQueensAscendingDiagonal : Long()
    from accumulate(
        $q2 : Queen($id : id, $ascendingD : ascendingD) and
        Queen(id > $id, ascendingD == $ascendingD)
      , count($q2)
    );
    $multipleQueensDescendingDiagonal : Long()
    from accumulate(
        $q3 : Queen($id : id, $descendingD : descendingD) and
        Queen(id > $id, descendingD == $descendingD)
      , count($q3)
    );
  then
    scoreCalculator.setScore( - $multipleQueensHorizontal - $multipleQueensAscendingDiagonal - $multipleQueensDescendingDiagonal));
end 

Let me know....

BTW, functions DOES work.

> Multi-pattern accumulate support
> --------------------------------
>
>                 Key: JBRULES-1040
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-1040
>             Project: JBoss Rules
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: Reteoo, Drl Parser/Builder
>    Affects Versions:  4.0.0.GA
>            Reporter: Geoffrey De Smet
>         Assigned To: Edson Tirelli
>             Fix For: 4.0.2
>
>
> [Edson said there might be already such an issue, but I couldn't find it looking through jira.]
> Something like this should be possible:
>   $multipleQueensHorizontal : Long()
>     from accumulate(
>         $q1 : Queen($id : id, $y : y);
>         Queen(id > $id, y == $y);
>       , count($q1)
>     );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list