[jboss-jira] [JBoss JIRA] (DROOLS-213) IsA operator does not evaluate correcly
Fabian Meyer (JIRA)
jira-events at lists.jboss.org
Thu Aug 8 09:41:26 EDT 2013
Fabian Meyer created DROOLS-213:
-----------------------------------
Summary: IsA operator does not evaluate correcly
Key: DROOLS-213
URL: https://issues.jboss.org/browse/DROOLS-213
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 6.0.0.Beta5
Reporter: Fabian Meyer
Assignee: Mark Proctor
package test;
declare T
@Traitable
id : String
end
declare trait A
id : String
end
declare trait B
id : String
end
rule "Print A"
when
$tmp : A()
then
System.out.println("(A) " + $tmp.getId());
end
rule "Print B"
when
$tmp : B()
then
System.out.println("(B) " + $tmp.getId());
end
rule "Print T isA A"
when
$tmp : T(this isA A)
then
System.out.println("(T isA A) " + $tmp.getId());
end
rule "Print T isA B"
when
$tmp : T(this isA B)
then
System.out.println("(T isA B) " + $tmp.getId());
end
rule "Print A isA B"
when
$tmp : A(this isA B)
then
System.out.println("(A isA B) " + $tmp.getId());
end
rule "Print B isA A"
when
$tmp : B(this isA A)
then
System.out.println("(B isA A) " + $tmp.getId());
end
rule "Init"
when
then
T $a = new T("a");
insert ($a);
don($a, A.class, true);
T $b = new T("b");
insert ($b);
don($b, B.class, true);
T $ab = new T("ab");
insert ($ab);
don($ab, A.class, true);
don($ab, B.class, true);
end
Results in output:
(B isA A) ab
(B) ab
(B) b
(A) ab
(A) a
Expected additional output:
(T isA B) b
(T isA B) ab
(T isA A) a
(T isA A) ab
(A isA B) ab
Also, the syntax of the "isA" operator is unclear. The example in the documentation of the operator uses quotes for the traits:
$sc : GoldenCustomer( $maxExpense : maxExpense > 1000,
this isA "SeniorCustomer"
)
If quotes are used for the example above, no output is generated at all.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list