I am working on this project which requires to perform ontology reasoning in code, so far I have written this rule. I am implementing this in java with the help of owlapi, and clarkparsia.pellet.owlapiv3.PelletReasoner.
//dexpi:Pump(?pump) ^ swrlb:greaterThan(?value, "10.0"^^xsd:double) ^ rdl:datumValue(?pump, ?value) -> dexpi:EjectorPump(?pump)
// Rule created using SWRLClassAtoms and DataPropertyAtoms
ontologyManager.applyChange(new AddAxiom(ontology, rule1));
So this section of code adds the rule to the ontology. I know the rules are defined correctly, since I can see this rule in protege, but How do I update the ontology according to the rule, i.e. change class type of all Pump instances whose datumValue is greaterThan 10 to EjectorPump.
I have tried these approaches so far.
Approach-1
// These lines uses pellet reasoner to perform reasoning
PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner(ontology);
InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner);
iog.fillOntology(factory, ontology);
Approach-2
List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<>();
gens.add(new InferredClassAssertionAxiomGenerator());
InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner, gens);
iog.fillOntology(factory, ontology);
Both of the approaches works perfectly fine but the problem is when they generate inference there is too much information I just want reclassification to be done like this if possible (This one is generated by protege. desired inference (generated by protege)
but instead, these codes reclassify like this code generated inference
Additionally, if you can direct me on how I can generate and show an explanation of reasoning, it will be a huge help. Thank you.