owlcs / owlapi

OWL API main repository
822 stars 315 forks source link

getting java.lang.NoSuchMethodError when trying to add superclasses to an ontology #1016

Closed marwa811 closed 2 years ago

marwa811 commented 3 years ago

I want to add some subclasses to a class in a sourceOntology I use this code: for (OWLClass subclass : targetreasoner.getSubClasses(owlclass, true).getFlattened()) { OWLSubClassOfAxiom axiom=factory.getOWLSubClassOfAxiom(subclass, sourceOwlclass);
manager.applyChange(new AddAxiom(sourceOntology, axiom)); } manager.saveOntology(sourceOntology);

Then I got this exception: Exception in thread "main" java.lang.NoSuchMethodError: org.semanticweb.owlapi.model.OWLOntologyManager.applyChange(Lorg/semanticweb/owlapi/model/OWLOntologyChange;)Lorg/semanticweb/owlapi/model/parameters/ChangeApplied;

I tried different solutions but no one succeeds. I do not know how to solve this exception and save the changes to the ontology. Any help!!!

ignazio1977 commented 3 years ago

Same problem as issue #1009 I believe. I've just added a possible fix to that issue, please let me know if it works.