I'm learning Java and Drools at the same time; please be gentle if my
question is misdirected.
I'm working on creating my first nontrivial fact model. A policy can have
multiple vehicles; a vehicle can have multiple coverages. My data will come
into the rules engine via an XML file, and be output to XML after all rules
are fired. I'm looking for best practices.
I've seen it suggested to use a relational approach to my object graph. A
policy will have policyID 12345; its vehicles will have a policyID field,
and each will have a different vehicleNumber (e.g. 1, 2 and 3). A coverage
will have policyID (12345) and vehicleNumber(1), and a coverage identifier
of its own.
That seems simple, sleek and elegant. I hope to use it to write rules. But
I wonder if it will be resource-intensive when I get to outputting the XML.
I'm imagining having to write the policy node, then search all vehicles for
the 3 that are related to this policy, then search through all coverages for
the ones corresponding to each vehicle, etc.
Is it better to include some sort of collection? (Policy 12345 might
include a collection of vehicles, each of which would include a collection
of coverages.) If so, what kind of collection: an implementation of set?
list? map? More specifically, are there drawbacks or advantages to one
approach or another?
I'm very thankful for any guidance you'd like to offer.
Best regards,
Benjamin
--
View this message in context:
http://drools.46999.n3.nabble.com/Collections-versus-Relational-Approach-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.