If you assert engine as a seperate fact, you can then access the engine directly.<br><br>In the next version, you will be able to do <br>Car(engine.running == true) and it will be converted to a predicate (sugar) - but always less efficient in RETE terms then accessing a field directly on a fact. 
<br><br><div><span class="gmail_quote">On 1/11/07, <b class="gmail_sendername">Kabe</b> &lt;<a href="mailto:kabriel@gmail.com">kabriel@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi, i&#39;ve been attempting to use Drools/JBossRules (3.0.5) in a project i&#39;m working on and i&#39;ve run into a few issues that i could use some help with. For the most part i&#39;m struggling with design patterns on how to structure my facts and my programs object model.
<br><br>I&#39;m struggling a bit with how to properly introduce my object model into the working memory. For example, lets say i have an object model such as:<br><br>&nbsp;&nbsp; Car( <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Engine( <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boolean : running 
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) : engine, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; color, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Door( <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boolean : open <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )[]:doors <br>&nbsp;&nbsp; )[] : cars<br><br>This would model a list of cars and some fields such as engine, color, and doors. Now how would i create a rule that would return every car with a running engine? I can&#39;t seem to figure out how to correctly reference a field of a field of a fact. i would want to do something like Car( 
engine.running == true ) or Car( Engine( running == true ) ) but that doesn&#39;t work. I can&#39;t make the Engine itself a fact because it has to be a field of the Car, and i can&#39;t give the car a field that holds the state of the engine because then that breaks encapsulation and makes the Car class very bloated with the state of all of its many components.
<br><br>Is there a way to do this correctly? i could use a real messy predicate or something like this:<br><br>$car : Car()<br>eval( isCarRunning( $car ) )<br><br>But then what is the point of using Rete? doesn&#39;t that just equate down to about the same amount of work if i just put this in some standard java if/else code?
<br><br>Thanks for the help,<br><br>....<br><span class="sg">Kabe<br><br><br>

</span><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br></blockquote></div>
<br>