On 22/02/12 15:18, Joshua TAYLOR wrote:
Hi all, I don't think this is a bug, strictly speaking, but it's a
behavior that surprised me a bit, and I'd like to check that it's
expected.
[clear explanation snipped]
However, it seems that while queries to an InfModel or OntModel backed
by a GenericRuleReasoner filter out functors, and functors don't
appear when an OntModel is written with OntModel.writeAll, the Model
returned by InfModel.getDeductionsModel includes the functors,
regardless of the value of filterFunctors. I don't know whether the
Model returned by getDeductionsModel should be considered as part of
"the results" from which functors should be filtered or not, but not
filtering functors from getDeductionsModel certainly does make the use
of "forward rules ... as if they were rewrite transformation rules"
more complicated.
So, is this the expected behavior?
Yes.
Whether it's the *right* design is questionable :) but it is, at least,
a long standing "feature".
The basic thinking was that the deductions model is a faithful
representation of the state derived by the rules. Any filter to hide
stuff is the responsibility of the wrapping InfModel. There are times,
not least during debugging, when the ability to see the exact deductions
state is helpful.
Is there an easy way to filter
functors from the deductions model? (I see that there is
Functor.acceptFilter, and that might be a start...)
You could create a simple Graph implementation based on WrappedGraph
which overrides the find operation to introduce
filterDrop(Functor.acceptFilter)
on the result iterator. Then you can create a filtered deductions model
by getting the graph, wrapping it with the graph filter and embedding it
back in the same context.
Dave