Hi,
two questions : i) which version of Drools are you using, ii) did you check whether the packageBuilder.getErrors()
returns any error message?
I've tried to reproduce the issue on 5.5.1-SNAPSHOT, and it seems to work fine.
This is the unit test case I have written:

http://pastebin.com/NXh97u4W

Consider that many bugs were fixed in 5.5.1 and a maintenance release 5.6 will be released in a few days
Davide






On 04/10/2013 08:33 PM, upalik wrote:

This message was cross-posted to stack-exchange. If someone wants to answer there, the URL is http://stackoverflow.com/questions/15922343/drools-queries-strange-dependency .

I'm somewhat new to Drools, and experienced this strange behavior during writing a query.

To start with, the Hotel class here is a subclass of PlaceImpl, which implements the interface Place. PlaceImpl itself is a subclass (via another class) of OntologyClassImpl, where the method getClasses() is implemented in the most trivial way: it returns an already existing java.util.Set of objects. In short, getClasses() is accessible from both Place interface and Hotel class.

My problem is this: The following query does not return any result even when there are matching Hotels.

query "qryRomantic" 
    $e:   Hotel (classes contains Semantics.AMB_Romantic)
end
However, if I replace Hotel with Place, then the query returns desired results, although the ONLY condition-setting rules are written for Hotel, as follows. (This rule actually gets fired several times.)
rule "Set semantic class Romantic"
no-loop
    when
        $hotel: Hotel( ... conditions go here ... )
    then
        modify ($hotel){
            addToClasses(Semantics.AMB_Romantic)
        }
end

It does not end there.

if I add another query to the rule file, for exactly the opposite condition as follows,

query "qryNonRomantic" 
    $e:   Hotel (classes not contains Semantics.AMB_Romantic)
end

then the first query starts to return the desired results, EVEN WHEN the new query is not called at all!

What am I doing wrong? I'd be really grateful for any pointers.


View this message in context: drools queries: strange dependency
Sent from the Drools: User forum mailing list archive at Nabble.com.


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users