You&#39;ll also have to learn about handling XML with Java, e.g., using JAXB, which<br>comes with JDK.<br><br>Given that you have an XML document, unmarshalling creates,<br>from the XML file, a hierarchy of objects. Usually they are are already linked in<br>
some way, depending on the way the XML schema is structured. (Typically, a<br>parent node contains a List of its children.) Then, you walk the document tree,<br>inserting some or all of the objects into Working Memory. After firing the rules,<br>
you simply marshal the document, starting at the root node to create the output<br>XML.<br><br>-W<br><br><div class="gmail_quote">On 30 July 2012 20:51, BenjaminWolfe <span dir="ltr">&lt;<a href="mailto:benjamin.e.wolfe@gmail.com" target="_blank">benjamin.e.wolfe@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;m learning Java and Drools at the same time; please be gentle if my<br>
question is misdirected.<br>
<br>
I&#39;m working on creating my first nontrivial fact model.  A policy can have<br>
multiple vehicles; a vehicle can have multiple coverages.  My data will come<br>
into the rules engine via an XML file, and be output to XML after all rules<br>
are fired.  I&#39;m looking for best practices.<br>
<br>
I&#39;ve seen it suggested to use a relational approach to my object graph.  A<br>
policy will have policyID 12345; its vehicles will have a policyID field,<br>
and each will have a different vehicleNumber (e.g. 1, 2 and 3).  A coverage<br>
will have policyID (12345) and vehicleNumber(1), and a coverage identifier<br>
of its own.<br>
<br>
That seems simple, sleek and elegant.  I hope to use it to write rules.  But<br>
I wonder if it will be resource-intensive when I get to outputting the XML.<br>
I&#39;m imagining having to write the policy node, then search all vehicles for<br>
the 3 that are related to this policy, then search through all coverages for<br>
the ones corresponding to each vehicle, etc.<br>
<br>
Is it better to include some sort of collection?  (Policy 12345 might<br>
include a collection of vehicles, each of which would include a collection<br>
of coverages.)  If so, what kind of collection: an implementation of set?<br>
list? map?  More specifically, are there drawbacks or advantages to one<br>
approach or another?<br>
<br>
I&#39;m very thankful for any guidance you&#39;d like to offer.<br>
<br>
Best regards,<br>
Benjamin<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Collections-versus-Relational-Approach-in-Fact-Model-tp4018965.html" target="_blank">http://drools.46999.n3.nabble.com/Collections-versus-Relational-Approach-in-Fact-Model-tp4018965.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>
</blockquote></div><br>