In the following program, i want to compute the paths:
<code>
rule "base"
when
edge : Edge(x : first, y : second)
not Path(first == x, second == y)
then
insert(new Path(edge.getFirst(), edge.getSecond()));
end
rule "recursive"
when
edge : Edge(x : first, z : second)
path : Path(first == z, y : second)
not Path(first == x, second == y)
then
insert(new Path(edge.getFirst(), path.getSecond()));
end
</code>
My question: How to express the query "path(cityA, X)?" efficiently in drools?
Since the first element is bound to 'cityA', I am wondering whether
drools can make use of it. I think there should be more efficient way
than firing all rules.
Thanks,
Senlin Liang