<p>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 .
<p>I'm somewhat new to Drools, and experienced this strange behavior during writing a query.
<p>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.
<p>My problem is this: The following query does not return any result even when there are matching Hotels.
<pre>
query "qryRomantic"
$e: Hotel (classes contains Semantics.AMB_Romantic)
end
</pre>
However, if I replace Hotel with Place, then the <i>query returns desired results</i>, although the ONLY condition-setting rules are written for Hotel, as follows. (This rule actually gets fired several times.)
<pre>
rule "Set semantic class Romantic"
no-loop
when
$hotel: Hotel( ... conditions go here ... )
then
modify ($hotel){
addToClasses(Semantics.AMB_Romantic)
}
end
</pre>
<p>It does not end there.
<p>if I add another query to the rule file, for exactly the opposite condition as follows,
<pre>
query "qryNonRomantic"
$e: Hotel (classes not contains Semantics.AMB_Romantic)
end
</pre>
<p>then the <i>first query</i> starts to return the desired results, <i>EVEN WHEN the new query is not called at all</i>!
<p>What am I doing wrong? I'd be really grateful for any pointers.
        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools.46999.n3.nabble.com/drools-queries-strange-dependency-tp4023320.html">drools queries: strange dependency</a><br/>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools: User forum mailing list archive</a> at Nabble.com.<br/>