Actually it depends on the rules and configuration of the
GenericRuleReasoner.
For rules executed in backward mode it's exactly as ajs6f says, there's
no extra statements added to a model.
For rules executed in forward mode then the inferred triples are added
to the deductions graph (which is separate from the base graph which
holds the data). So I imagine that a listener on the deductions graph
should work. Not tested it myself though - the rule system largely
predates the current version of listeners.
However, note that even in forward mode the inferences are only trigged
when you ask a query or call prepare(). They are not immediately
triggered by just adding new base triples.
Dave
On 07/01/2019 18:36, ajs6f wrote:
Dave Reynolds will be able to say more, but my understanding is that inferred triples are
_not_ added to the model in the sense in which we might use Model::add to add a
Statement. They are simply presented by the implementation as the model is scanned,
"injected" by the inference machinery, so to speak.
As for your use case, perhaps you could use a rule to do this? Again, I don't
know a lot about this end of Jena, but perhaps you could write a custom
built-in function for the rules system [1] .
ajs6f
[1] https://jena.apache.org/documentation/inference/index.html#builtins
On Jan 7, 2019, at 10:32 AM, Nouwt, B. (Barry) <[email protected]>
wrote:
Hi everyone,
We would like Apache Jena to raise an event whenever a particular triple is inferred by the GenericRuleReasoner.
We tried to achieve this by registering our implementation of the ModelChangedListener interface to an InfModel, but our implementation does not get triggered when inferred statements are added by the reasoner.
Is there any (other) way to raise an event whenever an inferred statement is added to an InfModel?
Regards, Barry
B. (Barry) Nouwt
Medior Innovator Semantic Technology
Connected Business
T +31 (0)88 866 56 91
M +31 (0)64 977 53 56
E [email protected]
Location
This message may contain information that is not intended for you. If you are
not the addressee or if this message was sent to you by mistake, you are
requested to inform the sender and delete the message. TNO accepts no liability
for the content of this e-mail, for the manner in which you use it and for
damage of any kind resulting from the risks inherent to the electronic
transmission of messages.