<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:12pt">How many train stops are you talking about? If it is only a few it might not matter if you don't have the many trains.<br><br>When you are writing your rule if you narrow down by matching schedule first and then comparing all the stops that might help. An alternative to comparing two collections in drools would be to write a custom function that could do some simple checks first like make sure that the size of both lists are the same. Another option if the list of train stops is a POJO itself is to make its hashkey so that two lists with the same values will have matching hashkeys.<br><br>Wendy<br><div><br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr
size="1"><b><span style="font-weight: bold;">From:</span></b> Brett Bergquist <brett@thebergquistfamily.com><br><b><span style="font-weight: bold;">To:</span></b> rules-users@lists.jboss.org<br><b><span style="font-weight: bold;">Sent:</span></b> Tue, May 3, 2011 3:20:52 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [rules-users] Question on modeling facts<br></font><br>
I am trying to write rules to distill down a minimal train schedule from a<br>set of overlapping train schedules. A train schedule contains a train<br>identifier, a schedule that it runs on, and a set of train stops. A rule<br>that I would like to write is to combine one or more train schedules if more<br>than one train runs on the same day (ie has the same schedule) and stops at<br>the same stops. This ignores the train identifier and will discard all<br>other train schedules that have a different train identifier but have the<br>same schedule and stops.<br><br>I am wondering how to model the equality test for the same set of stops. <br>Can I have my Train fact contain a collection of stops and then compare the<br>collections for equality? Will this be efficient? Is there a better way to<br>model this?<br><br>Any and all help will be greatly appreciated.<br><br>Brett<br><br><br>--<br><span>View this message in context: <a
target="_blank" href="http://drools.46999.n3.nabble.com/Question-on-modeling-facts-tp2895595p2895595.html">http://drools.46999.n3.nabble.com/Question-on-modeling-facts-tp2895595p2895595.html</a></span><br>Sent from the Drools: User forum mailing list archive at <a target="_blank" href="http://Nabble.com">Nabble.com</a>.<br>_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" 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></div></div>
</div></body></html>