You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Andrii Berezovskyi <an...@kth.se> on 2019/06/11 17:28:36 UTC

Attaching a ModelChangedListener to the deductionsModel

Hello,

I would like to detect newly added/retracted inferences anytime triples are inserted/removed in the raw model. I tried to create an 'InfModel' backed by an RDFS reasoner and to attach a ModelChangesListener to its 'deductionsModel'.

However, only changes to the 'rawModel' are registered and not to the 'deductionsModel'. I suspect this to be due to the fact the deductions graph is cleared when 'prepare()' is called and my listener is attached to a model that never changes:

https://github.com/apache/jena/blob/bfce1741cb12f9cf544235d32fba6598bc7341b5/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/FBRuleInfGraph.java#L389

Maybe I missed something or taking a wrong direction (I saw the suggestion to use 'DatasetGraphMonitor' in https://stackoverflow.com/questions/51950233/jena-dataset-listener but thought to consult here first before rewriting my code). My MWE can be found under https://gist.github.com/berezovskyi/bcf75008263444bd410ac2ffa7aa00f4

Thank you in advance!

--
–Andrew.


Re: Attaching a ModelChangedListener to the deductionsModel

Posted by Andrii Berezovskyi <an...@kth.se>.
Hello Barry,

Thanks a lot for pointing me in the right direction! I will switch to InfGraph and listen on the lower level as you did.

One extra question: did you manage to separate inferences from separate transactions?

--
/Andrew
(from phone)



On Thu, Jun 13, 2019 at 1:34 PM +0200, "Nouwt, B. (Barry)" <ba...@tno.nl.INVALID>> wrote:


Hi Andrew, I asked a similar question before and got a satisfying answer: https://jena.markmail.org/thread/kn2tjj5jswmtqk4p

Regards, Barry

-----Original Message-----
From: Andrii Berezovskyi
Sent: dinsdag 11 juni 2019 19:29
To: users@jena.apache.org
Subject: Attaching a ModelChangedListener to the deductionsModel

Hello,

I would like to detect newly added/retracted inferences anytime triples are inserted/removed in the raw model. I tried to create an 'InfModel' backed by an RDFS reasoner and to attach a ModelChangesListener to its 'deductionsModel'.

However, only changes to the 'rawModel' are registered and not to the 'deductionsModel'. I suspect this to be due to the fact the deductions graph is cleared when 'prepare()' is called and my listener is attached to a model that never changes:

https://github.com/apache/jena/blob/bfce1741cb12f9cf544235d32fba6598bc7341b5/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/FBRuleInfGraph.java#L389

Maybe I missed something or taking a wrong direction (I saw the suggestion to use 'DatasetGraphMonitor' in https://stackoverflow.com/questions/51950233/jena-dataset-listener but thought to consult here first before rewriting my code). My MWE can be found under https://gist.github.com/berezovskyi/bcf75008263444bd410ac2ffa7aa00f4

Thank you in advance!

--
–Andrew.

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.


RE: Attaching a ModelChangedListener to the deductionsModel

Posted by "Nouwt, B. (Barry)" <ba...@tno.nl.INVALID>.
Hi Andrew, I asked a similar question before and got a satisfying answer: https://jena.markmail.org/thread/kn2tjj5jswmtqk4p

Regards, Barry

-----Original Message-----
From: Andrii Berezovskyi <an...@kth.se> 
Sent: dinsdag 11 juni 2019 19:29
To: users@jena.apache.org
Subject: Attaching a ModelChangedListener to the deductionsModel

Hello,

I would like to detect newly added/retracted inferences anytime triples are inserted/removed in the raw model. I tried to create an 'InfModel' backed by an RDFS reasoner and to attach a ModelChangesListener to its 'deductionsModel'.

However, only changes to the 'rawModel' are registered and not to the 'deductionsModel'. I suspect this to be due to the fact the deductions graph is cleared when 'prepare()' is called and my listener is attached to a model that never changes:

https://github.com/apache/jena/blob/bfce1741cb12f9cf544235d32fba6598bc7341b5/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/FBRuleInfGraph.java#L389

Maybe I missed something or taking a wrong direction (I saw the suggestion to use 'DatasetGraphMonitor' in https://stackoverflow.com/questions/51950233/jena-dataset-listener but thought to consult here first before rewriting my code). My MWE can be found under https://gist.github.com/berezovskyi/bcf75008263444bd410ac2ffa7aa00f4

Thank you in advance!

--
–Andrew.

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.