Hi,
I'am trying to use Query and i'am facing a little problem :
Given this simple rule :
package be.test.person
import be.test.person.*
query "get adult"
adult : Adult( )
end
query "get person"
person : Person( )
end
declare Adult
name : String
end
rule "A person over 18 is an adult"
when
Person( age >= 18)
then
System.out.println("Adult detected");
insert(new Adult());
end
Lets suppose one Person over 18 is inserted inside the working memory, the result of the
query < get adult > is 0 (Please note the declaration of Adult type inside the
rule)
If I create a Java class Adult (commenting the one in the .drl file) and then run the
query again, this time the result is 1
Also, the signature of org.drools.runtime.rule.WorkingMemory.getQueryResults(String) says
IllegalArgumentException when query is not found in the KnowledgeBase. This doesn't
seems to be the case when I use a fake query name.
I'am using drools 5.1.1
Any idea on this ?
Thanks