Sure, I agree, this would be an example:-<br><br><span style="font-family: courier new,monospace;">rule &quot;Family smurf&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">when</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    MyFact( smurf == &quot;pupa&quot; )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    ExternalObject( ) from placeHolder.namedQuery(&quot;Smurfs&quot;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Do something</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">end</span><br><br>If <span style="font-family: courier new,monospace;">MyFact</span> is updated in other rules the list will be refreshed &quot;from&quot; the named query.<br>
<br>So the preference might be to load the Objects into WM first:-<br><br><span style="font-family: courier new,monospace;">rule &quot;bootstrap&quot;</span><br><span style="font-family: courier new,monospace;">salience -100</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">when</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    $list : List( ) from placeHolder.namedQuery(&quot;Smurfs&quot;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">
then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    for(ExternalObject o : $list ) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        insert( o );</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">end</span><br style="font-family: courier new,monospace;"><br>
<span style="font-family: courier new,monospace;">rule &quot;Family smurf&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">when</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    MyFact( smurf == &quot;pupa&quot; )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    ExtenalObject( )</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    //Do something</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">end</span><br><br>
You could also have a layer of caching between the rules and RDBMS too; so your only performing a read from cache with the &quot;from&quot; keyword and not RDBMS itself.<br><br>How you choose is obviously up to you and the volatility of your data read from RDBMS.<br>
<br><br><br><div class="gmail_quote">2011/2/14 Mauricio Salatino <span dir="ltr">&lt;<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Beware with the use of the FROM Conditional Element, because if you are using another fact that doesn&#39;t come from the DB and you change them, the FROM CE will be continuously evaluated causing the execution of tons of queries multiple times.<br>

My two cents.<br>Greetings<br><br><div class="gmail_quote">2011/2/14 Michael Anstis <span dir="ltr">&lt;<a href="mailto:michael.anstis@gmail.com" target="_blank">michael.anstis@gmail.com</a>&gt;</span><div><div></div><div class="h5">
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You can access Objects from external resources using the &quot;from&quot; keyword (in fact the use of this with Hibernate named queries is a documented use-case, IIRC).<br><br>The Objects are not however inserted into WorkingMemory using &quot;from&quot; are should therefore be time-constant as their properties will not be included in truth maintenance.<br>


<br>If you require the Objects as Facts in WorkingMemory for the inference engine to reason with, you can write rules using &quot;from&quot; that insert into WorkingMemory.<div><div></div><div><br><br><div class="gmail_quote">

On 14 February 2011 11:27, hyjshanghai <span dir="ltr">&lt;<a href="mailto:hyjshanghai@gmail.com" target="_blank">hyjshanghai@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
As far as I know, Drools can only reason over facts in the working memory. It<br>
can not directly &quot;select&quot; from RDBMS. You have to load in all data items<br>
from the database and validate them in memory by Drools.<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Applying-rules-on-the-data-in-an-RDBMS-tp2468317p2491888.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Applying-rules-on-the-data-in-an-RDBMS-tp2468317p2491888.html</a><br>



Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div></div></div><font color="#888888"><br><br clear="all"><br>-- <br> - CTO @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com</a>  <br> - MyJourney @ <a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a><br>

 - Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br> <br> - Salatino &quot;Salaboy&quot; Mauricio -<br>
</font><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>