On Thu, Jul 3, 2008 at 3:56 PM, Paul Fodor [EMAIL PROTECTED] wrote:
Dear Sir,
I am new to Drools and I want to ask how can I implement the classical
transitive closure in Drools. For instance we have a bunch of facts
edge/2 and the transitive closure:
reach(X,Y):- edge(X,Y).
reach(X,Y):-
Even if the package says org.drools.examples, these files are not in
the Drools examples. I am just using that package to write these files
into while testing in Eclipse.
On Thu, Jul 3, 2008 at 4:31 PM, Paul Fodor [EMAIL PROTECTED] wrote:
On Thu, Jul 3, 2008 at 3:56 PM, Paul Fodor [EMAIL
How can I check if an instance was not already inserted?
For instance, my transitive closure works for non-cycled data, but it
re-derives the same relations for cycled data.
TransitiveClosure.drl:
package org.drools.examples
import org.drools.examples.TransitiveClosureExample.Edge;
import
You will have to use regular insert() instead of insertLogical(). This is
because:
rule reachDirect
salience 10
when
e : Edge(s1 : source, t1 : target)
not( Reach(source == s1, target == t1) )
then
insertLogical( new Reach(e.getSource(),e.getTarget()) );