[rules-users] Noob question: graph searching, query, root node for a given node
Borris
borris at chaos.org.uk
Wed Jun 18 08:31:54 EDT 2014
I'm after a quick bit of help on how to do something that I think should be
easy but I can't work out how.
I have a Java-side class that essentially is something like
declare Datum
description: String
broader: List <Datum>
narrower: List <Datum>
end
These are arranged in a graph. Root nodes have no items in their broader
list. I want a query that takes a datum and yields the root nodes for that
datum. I think this should look something like
query rootDatumsFor( Datum datum, Datum result )
not Datum() from $datum.broader
or
rootDatumsFor( $datum.broader, $result )
end
but I then get confused. When there are no broader items, I am unclear how
to assign $datum to $result. And I'm not convinced I'm doing the recursion
correctly either.
If an experienced Drools author could spend a minute and show me how to do
this sensibly, I would be very grateful.
--
View this message in context: http://drools.46999.n3.nabble.com/Noob-question-graph-searching-query-root-node-for-a-given-node-tp4030091.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list