Yes, the idea is to insert Models, Brands, Parts, and possibly additional facts.
You might want to keep lists of child objects or used parts in the
parent objects - see Michael's rule.
Otherwise:
Relating a Model to a Brand and a Brand to a Manufacturer is simple: a
"parent" reference is sufficient. For Parts, you might want to
establish a Gozinto fact, combining a Part and a Model.
rule "whereIsPV999999"
when
$part: Part( partName == "PV999999" )
Gozinto( part == $part, $model: model )
Model( this == $model, $brand: brand )
Brand( this == $brand, $manu: manufacturer )
Manufacturer( this == $manu )
then
System.out.println( "PV999999 used in " + $model + "/" + $brand
+
" by " + $manu );
end
For deciding between using this or the "contains" search in potential parents,
there are issues w.r.t. the number of objects you have, the rules
you'd really use, and how frequently what is evaluated, and concerning
the ease of rule maintenance.
It is indeed possible to extract all from a small set of Manufacturer
facts, but nested "from" CEs are most likely bad for performance.
-W
On 02/05/2012, James K <james_kosa(a)verizon.net> wrote:
Luane - Yes, it would be a normalized database, there would be only
one
entry
for a manufacturer with all of the child records related by Foreign Keys or
relational tables.
Excuse my ignorance I am relatively new to Drools, can you please expand on
the following:
"...(...$p.getPartsName()...) "
This is where I am having a hard time on how to navigate into the nested
collections. Or are you saying to insert the PART, MODEL, BRAND, etc as
individual facts? How would I relate it back Automanufacturer fact?
--
View this message in context:
http://drools.46999.n3.nabble.com/Accessing-properties-of-an-object-withi...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users