I think I've got your use case: you are making XSLT on steroi^W some
kind of cheese that tastes stimulating and is dense in nutrients but
is in no way controversial.
It would allow user rules for removing stuff, and have built-in rules
for transitively removing unreferenced stuff, right?
On Mon, Dec 6, 2010 at 12:19 PM, Bruno Freudensprung
<bruno.freudensprung(a)temis.com> wrote:
I simply plan to read my XML and add the corresponding objects into
the session, then to fire the rules.
Ahh, silly me, rule processing is externally initiated in Drools, it's
not some kind of perpetual event engine.
Well... I wanted to delegate the whole "logic" to Drools
and I imagined
that I could "listen" to Drools' WorkingMemory's retraction events in
order to remove the corresponding elements from the input XML.
Would a query work instead of the event listener then?
I guess it would if the list of remaining stuff is good too...
Or you could mark the unneeded stuff instead of retracting, reason
over the marks, and be able to query the marked stuff directly:
rule "orphaned Type"
when
t : T(mark != true)
not I(type == t, mark == true)
then
modify (t) {setMark(true)}
end
rule "orphaned Instance"
when
t : T(mark == true)
I(type == t, mark != true)
then
modify(i) {setMark(true)}
end
// transform your rules "1" and "2" as well to sanitize input!
query "types to delete"
t : T(mark == true)
end
query "instances to delete"
i : I(mark == true)
end