<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi,<br>
two questions : i) which version of Drools are you using, ii) did
you check whether the packageBuilder.getErrors()<br>
returns any error message?<br>
I've tried to reproduce the issue on 5.5.1-SNAPSHOT, and it seems
to work fine.<br>
This is the unit test case I have written:<br>
<br>
<a class="moz-txt-link-freetext" href="http://pastebin.com/NXh97u4W">http://pastebin.com/NXh97u4W</a><br>
<br>
Consider that many bugs were fixed in 5.5.1 and a maintenance
release 5.6 will be released in a few days<br>
Davide<br>
<br>
<br>
<br>
<br>
<br>
<br>
On 04/10/2013 08:33 PM, upalik wrote:<br>
</div>
<blockquote cite="mid:1365651202751-4023320.post@n3.nabble.com"
type="cite">
<p>This message was cross-posted to stack-exchange. If someone
wants to answer there, the URL is
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/15922343/drools-queries-strange-dependency">http://stackoverflow.com/questions/15922343/drools-queries-strange-dependency</a>
.
</p>
<p>I'm somewhat new to Drools, and experienced this strange
behavior during writing a query.
</p>
<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>
<p>My problem is this: The following query does not return any
result even when there are matching Hotels.
</p>
<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>
<p>if I add another query to the rule file, for exactly the
opposite condition as follows,
</p>
<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>
<p>What am I doing wrong? I'd be really grateful for any pointers.
<br>
</p>
<hr align="left" width="300">
View this message in context: <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/drools-queries-strange-dependency-tp4023320.html">drools
queries: strange dependency</a><br>
Sent from the <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools:
User forum mailing list archive</a> at Nabble.com.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</body>
</html>