Galigator / openllet

Openllet is an OWL 2 reasoner in Java, build on top of Pellet.
https://www.w3.org/TR/owl2-primer/
Other
96 stars 26 forks source link

When ontology has DataProperty use with IncrementalClassifier throw exception. #46

Closed changliang8204 closed 1 year ago

changliang8204 commented 4 years ago

Exception in thread "partitioning" java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.add(Collections.java:1055) at openllet.modularity.GraphBuilder$AxiomVisitor.visit(GraphBuilder.java:117) at org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom.accept(OWLSubDataPropertyOfAxiom.java:46) at openllet.modularity.GraphBuilder.addAxiom(GraphBuilder.java:610) at java.util.concurrent.ConcurrentHashMap$KeySpliterator.forEachRemaining(ConcurrentHashMap.java:3527) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at openllet.modularity.GraphBasedModuleExtractor.extractModuleSignatures(GraphBasedModuleExtractor.java:46) at openllet.modularity.AbstractModuleExtractor.extractModuleSignatures(AbstractModuleExtractor.java:224) at openllet.modularity.AbstractModuleExtractor.extractModules(AbstractModuleExtractor.java:198) at openllet.modularity.IncrementalClassifier$2.run(IncrementalClassifier.java:503)

beause when ontology has DataProperty, GraphBuilder

public void visit(OWLSubDataPropertyOfAxiom axiom) {
            Node subNode = GraphBuilder.this._graph.createEntityNode(((OWLDataPropertyExpression)axiom.getSubProperty()).asOWLDataProperty());
            Node supNode = GraphBuilder.this._graph.createEntityNode(((OWLDataPropertyExpression)axiom.getSuperProperty()).asOWLDataProperty());
            subNode.getOutputs().add(supNode);
        }

subNode.getOutputs() return is Collections.unmodifiableSet!

Galigator commented 3 years ago

https://github.com/Galigator/openllet/commit/6c7aa8c86421b9a6fd9fe52119dacb75e71c8be9

Is a try to correct this problem. If you have a something that can be transform into unit test it could be nice.