[
http://jira.jboss.com/jira/browse/JBRULES-1040?page=comments#action_12378040 ]
Geoffrey De Smet commented on JBRULES-1040:
-------------------------------------------
As far as I can tell, it's not working:
rule "constraintsBroken"
when
$multipleQueensHorizontal : Long()
from accumulate(
$q1 : Queen($id : id, $y : y);
Queen(id > $id, y == $y);
, count($q1)
);
$multipleQueensAscendingDiagonal : Long()
from accumulate(
$q2 : Queen($id : id, $ascendingD : ascendingD);
Queen(id > $id, ascendingD == $ascendingD);
, count($q2)
);
$multipleQueensDescendingDiagonal : Long()
from accumulate(
$q3 : Queen($id : id, $descendingD : descendingD);
Queen(id > $id, descendingD == $descendingD);
, count($q3)
);
then
scoreCalculator.setScore( - $multipleQueensHorizontal -
$multipleQueensAscendingDiagonal - $multipleQueensDescendingDiagonal));
end
this gives problems on the ";" at each end.
so I tried this:
rule "constraintsBroken"
when
$multipleQueensHorizontal : Long()
from accumulate(
$q1 : Queen($id : id, $y : y)
Queen(id > $id, y == $y)
, count($q1)
);
$multipleQueensAscendingDiagonal : Long()
from accumulate(
$q2 : Queen($id : id, $ascendingD : ascendingD)
Queen(id > $id, ascendingD == $ascendingD)
, count($q2)
);
$multipleQueensDescendingDiagonal : Long()
from accumulate(
$q3 : Queen($id : id, $descendingD : descendingD)
Queen(id > $id, descendingD == $descendingD)
, count($q3)
);
then
scoreCalculator.setScore( - $multipleQueensHorizontal -
$multipleQueensAscendingDiagonal - $multipleQueensDescendingDiagonal));
end
which yields:
aused by: org.drools.rule.InvalidRulePackage: [69,6]: unknown:69:6 mismatched token:
[@178,2093:2093=',',<11>,69:6]; expecting type RIGHT_PAREN[69,14]:
unknown:69:14 Unexpected token '$q1'
at org.drools.rule.Package.checkValidity(Package.java:412)
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: Drl Parser/Builder, Reteoo
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