You are assuming that a pattern X(...) automatically enters a
namespace where only attributes of X and bound variables are visible.
That's not quite true; since 5.3 or 5.4, the parser is on the lookout
for class names as well, and Person happens to be a class name.
Consequentially, the rather ghastly
$input:input(input.Input == "a")
works.
I don't have to spell out the moral of the story...?
-W
On 23/10/2013, richie <haoruiqian(a)gmail.com> wrote:
Why no rule will be fired if class name and attribute name is same?
Following is my drl file content:
package test
declare input
input : String
end
declare output
taskname : String
end
rule "Rule A"
dialect "mvel"
salience 0
no-loop
when
$input:input(input == "a")
$output:output()
then
modify ($output) {taskname = "Hello"};
end
But if I created a fact object of input and set attribute input to "a", it
did not fire any rules.
--
View this message in context:
http://drools.46999.n3.nabble.com/Why-no-rule-will-be-fired-if-class-name...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users