I opened the first issue (bug) with testcase patch here:
http://jira.jboss.com/jira/browse/JBRULES-554
As for the second issue (feature request), it looks like "connective
constraints" is already done on the trunk, so I 'll not open it.
Are there any rule/query examples of such "connective constraints"?
With kind regards,
Geoffrey De Smet
Michael Neale wrote:
In 3.2 (trunk) we have added what are known as "connective constraints"
which will do what you want (yes they are different from conditional
elements in behaviour).
But not yet, in 3.0 can you do that.
On 11/10/06, *John Cocktolstoy* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Hi guys,
I got the same errors but thought it is how it should work - if you
bind different names in each column there is no error. That was the
reason why I were convinced that JBossRules don't support nested
"and"s and "or"s :-). Is this bug registered on JIRA yet? Any
chances this bug will be fixed soon?
regards
John
On 11/10/06, *Geoffrey De Smet* < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Edson Tirelli wrote, On 2006-11-10 12:37 AM:
>
> 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?
I will and I 'll add a testcase patch us usual :)
Still I believe something like
Match($id : id, homeTeam == $team || awayTeam == $team, $day
: day)
should be possible in the long term, because:
- it avoids duplicating the id and day constraints, which makes
the rule
a lot easier to read
- drools could be smart enough to compile that in a way to reuse
the
beta nodes of id and day maybe? - if it doesn't already
Do you mind if I open a second (long-term feature request) JIRA
for that
too?
>
> 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.
> >
>
>
--
With kind regards,
Geoffrey De Smet
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email