cdorn opened a new issue, #2868:
URL: https://github.com/apache/jena/issues/2868

   ### Version
   
   5.1.0
   
   ### What happened?
   
   Given OntModel m with inference model:
   var m = OntModelFactory.createModel( OntSpecification.OWL2_DL_MEM_RDFS_INF );
   
   Given we register some model changed listener:
   m.register(listener);
   
   and we create a type
   var type = m.createOntClass(SOMEURI);
   
   and we delete that type:
   type.deleteProperties();
   
   then listener is not called with any deleted statements. 
   
   I also identified the cause:
   inside ModelCom.register(ModelChangedListener listener) //line 1359
   the getGraph() call returns the inference graph and not the underlying 
UnionGraph, hence any fine granular changes in the union graph and below have 
no listener registered
   
   my current work around is pasted below in "Relevant output and stacktrace"
   not sure if that workaround would work for other OntModel implementations 
and inference models.
   
   ### Relevant output and stacktrace
   
   ```shell
   my current workaround is:
   private void register(OntModel model, ModelChangedListener listener) {
     var given = model.getGraph();
        if (given instanceof InfGraph infG) {
               Graph raw = infG.getRawGraph();
               if (raw instanceof UnionGraph ugraph) {
                
ugraph.getEventManager().register(((ModelCom)model).adapt(listener));
               }            
           }
           if (given instanceof UnionGraph ugraph) {
                
ugraph.getEventManager().register(((ModelCom)model).adapt(listener));
           }
        }
   ```
   
   
   ### Are you interested in making a pull request?
   
   Maybe


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to