Is the data originally in XML or a structure comparable to a DOM tree?<br>
<br>
If the answer is yes, there is a (admittedly not quite simple) approach wherewith<br>
you can solve such problems easily. However, it's probably not worth applying<br>
if there's only one such issue in your app. Just to give you an idea: You use additional facts describing the structure of your data.<br>
<br>
I'll furnish details but not unless it's necessary.<br><br>-W<br><br><div class="gmail_quote">On 18 November 2011 20:18, LCode <span dir="ltr"><<a href="mailto:j_whittlesea@hotmail.com">j_whittlesea@hotmail.com</a>></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;">I am trying to write a rule via the guided rule editor and (again!!) I am<br>
really struggling.<br>
<br>
The following is a simplified explanation of my scenario:<br>
<br>
I have a model where there is one 'Supermarket' object which has a list of<br>
integers 'locationID'. Elsewhere I have another list of 'Place' objects,<br>
each of which has an integer locationReference.<br>
<br>
Something like this....<br>
<br>
<Supermarket name = 'asda'><br>
<LocationID>21</LocationID><br>
<LocationID>18</LocationID><br>
<LocationID>19</LocationID><br>
</Supermarket><br>
<br>
<Places><br>
<Place><br>
<LocationReference>21</LocationReference><br>
</Place><br>
<Place><br>
<LocationReference>18</LocationReference><br>
</Place><br>
<Place><br>
<LocationReference>19</LocationReference><br>
</Place><br>
</Places><br>
<br>
<br>
I need to write a rule that fires when the *order* of locationIDs does not<br>
match the order of the locationReferences. So the above example would be<br>
fine but the model below would not...<br>
<br>
<Supermarket name = 'asda'><br>
<LocationID>18</LocationID><br>
<LocationID>21</LocationID><br>
<LocationID>19</LocationID><br>
</Supermarket><br>
<br>
<Places><br>
<Place><br>
<LocationReference>21</LocationReference><br>
</Place><br>
<Place><br>
<LocationReference>18</LocationReference><br>
</Place><br>
<Place><br>
<LocationReference>19</LocationReference><br>
</Place><br>
</Places><br>
<br>
I know that drools does not consider the order of facts in the model,<br>
however since both facts are java.util.Lists I wonder if it possible to<br>
compare the elements at position 0, 1, 2 etc. I am afraid my drl skills are<br>
really not up to scratch.<br>
<br>
Any thoughts?<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Ordered-lists-in-drl-tp3519453p3519453.html" target="_blank">http://drools.46999.n3.nabble.com/Ordered-lists-in-drl-tp3519453p3519453.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</font></blockquote></div><br>