Hey Geoffrey,

  You guys are doing a great job testing things. Thanks.

  The correct syntax would be like that:

query "multipleMatchesPerTeamPerDay"
   $team : Team()
   Match( $id : id, homeTeam == $team, $day : day ) ||
   Match( $id : id, awayTeam == $team, $day : day )
   exists Match( id > $id, homeTeam == $team, day == $day ) ||
   exists Match(id > $id, awayTeam == $team, day == $day )
end

Although, seems there is a regression as it is raising an error saying variables are being declared twice. Although, when using "||" (or), variables MUST be bound in each logical outcome.

   Do you mind opening a JIRA for that?

   Thank you,

   Regards,
      Edson

Geoffrey De Smet wrote:

I got a simple domain model:

  public class Match {

    private Long id;

    private Team homeTeam;
    private Team awayTeam;

    private Day day;

    // getter, setters, ...
  }

And a rule (query) that checks if a team has 2 matches on the same day (no matter if they are the home or the away team):

  query "multipleMatchesPerTeamPerDay"
    $team : Team();
    Match($id : id, homeTeam == $team || awayTeam == $team, $day : day);
exists Match(id > $id, homeTeam == $team || awayTeam == $team, day == $day);
  end

But apparently I can't do this?

  unknown:12:50 Unexpected token '=='
  unknown:13:39 Unexpected token '$team'
  unknown:13:57 Unexpected token '=='
  unknown:18:33 Unexpected token 'day'

Line 12 is: Match($id : id, homeTeam == $team || awayTeam == $team, $day : day);

Is there any way to avoid having to write a separate rule (query) for every combination (home-home, away-home, home-away, away-away)?

Thanks for any help/advice.



--
 ---
 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

 IT executives: Red Hat still #1 for value
http://www.redhat.com/promo/vendor/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to