/** * Render an explanation without the axiom header. This function is not guaranteed to be supported by the subclasses since an explanation renderer may rely * on the axiom being explained to reorder the axioms or find irrelevant bits. * * @param explanations Set of explanations we are rendering * @throws OWLException * @throws IOException * @throws UnsupportedOperationException */ public void render(final Set<Set<OWLAxiom>> explanations) throws OWLException, IOException, UnsupportedOperationException { render((OWLAxiom) null, explanations); }
public void run() throws OWLOntologyCreationException, OWLException, IOException { PelletExplanation.setup(); // The renderer is used to pretty print clashExplanation final ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); // The writer used for the clashExplanation rendered final PrintWriter out = new PrintWriter(System.out); renderer.startRendering(out); // Create an OWLAPI manager that allows to load an ontology file and // create OWLEntities final OWLOntologyManager manager = OWL._manager; final OWLOntology ontology = manager.loadOntology(IRI.create(file)); // Create the reasoner and load the ontology final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); // Create an clashExplanation generator final PelletExplanation expGen = new PelletExplanation(reasoner); // Create some concepts final OWLClass madCow = OWL.Class(NS + "mad+cow"); final OWLClass animalLover = OWL.Class(NS + "animal+lover"); final OWLClass petOwner = OWL.Class(NS + "pet+owner"); // Explain why mad cow is an unsatisfiable concept Set<Set<OWLAxiom>> exp = expGen.getUnsatisfiableExplanations(madCow); out.println("Why is " + madCow + " concept unsatisfiable?"); renderer.render(exp); // Now explain why animal lover is a sub class of pet owner exp = expGen.getSubClassExplanations(animalLover, petOwner); out.println("Why is " + animalLover + " subclass of " + petOwner + "?"); renderer.render(exp); renderer.endRendering(); }
/** * {@inheritDoc} */ @Override public void startRendering(final Writer w) { _writer = new TextBlockWriter(w); _renderer = new ManchesterSyntaxObjectRenderer(this._writer); _renderer.setWrapLines(isWrapLines()); _renderer.setSmartIndent(isSmartIndent()); _index = 1; } }
/** * {@inheritDoc} */ @Override public void render(final OWLAxiom axiom, final Set<Set<OWLAxiom>> explanations) throws OWLException, IOException { setCurrentAxiom(axiom); if (_index == 1) { if (axiom != null) { _writer.print("Axiom: "); axiom.accept(_renderer); _writer.println(); _writer.println(); } if (explanations.isEmpty()) { _writer.println("Explanation: AXIOM IS NOT ENTAILED!"); return; } _writer.println("Explanation(s): "); } final String header = _index++ + ")"; _writer.print(header); renderSingleExplanation(explanations.iterator().next()); _writer.println(); }
public void run() throws OWLOntologyCreationException, OWLException, IOException { PelletExplanation.setup(); // The renderer is used to pretty print clashExplanation final ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); // The writer used for the clashExplanation rendered final PrintWriter out = new PrintWriter(System.out); renderer.startRendering(out); // Create an OWLAPI manager that allows to load an ontology file and // create OWLEntities final OWLOntologyManager manager = OWL._manager; final OWLOntology ontology = manager.loadOntology(IRI.create(file)); // Create the reasoner and load the ontology final OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ontology); // Create an clashExplanation generator final PelletExplanation expGen = new PelletExplanation(reasoner); // Create some concepts final OWLClass madCow = OWL.Class(NS + "mad+cow"); final OWLClass animalLover = OWL.Class(NS + "animal+lover"); final OWLClass petOwner = OWL.Class(NS + "pet+owner"); // Explain why mad cow is an unsatisfiable concept Set<Set<OWLAxiom>> exp = expGen.getUnsatisfiableExplanations(madCow); out.println("Why is " + madCow + " concept unsatisfiable?"); renderer.render(exp); // Now explain why animal lover is a sub class of pet owner exp = expGen.getSubClassExplanations(animalLover, petOwner); out.println("Why is " + animalLover + " subclass of " + petOwner + "?"); renderer.render(exp); renderer.endRendering(); }
/** * {@inheritDoc} */ @Override public void startRendering(final Writer w) { _writer = new TextBlockWriter(w); _renderer = new ManchesterSyntaxObjectRenderer(this._writer); _renderer.setWrapLines(isWrapLines()); _renderer.setSmartIndent(isSmartIndent()); _index = 1; } }
/** * {@inheritDoc} */ @Override public void render(final OWLAxiom axiom, final Set<Set<OWLAxiom>> explanations) throws OWLException, IOException { setCurrentAxiom(axiom); if (_index == 1) { if (axiom != null) { _writer.print("Axiom: "); axiom.accept(_renderer); _writer.println(); _writer.println(); } if (explanations.isEmpty()) { _writer.println("Explanation: AXIOM IS NOT ENTAILED!"); return; } _writer.println("Explanation(s): "); } final String header = _index++ + ")"; _writer.print(header); renderSingleExplanation(explanations.iterator().next()); _writer.println(); }
/** * {@inheritDoc} */ @Override public void startRendering(final Writer w) { _writer = new TextBlockWriter(w); _renderer = new ManchesterSyntaxObjectRenderer(this._writer); _renderer.setWrapLines(isWrapLines()); _renderer.setSmartIndent(isSmartIndent()); _index = 1; } }
/** * {@inheritDoc} */ @Override public void render(final OWLAxiom axiom, final Set<Set<OWLAxiom>> explanations) throws OWLException, IOException { setCurrentAxiom(axiom); if (_index == 1) { if (axiom != null) { _writer.print("Axiom: "); axiom.accept(_renderer); _writer.println(); _writer.println(); } if (explanations.isEmpty()) { _writer.println("Explanation: AXIOM IS NOT ENTAILED!"); return; } _writer.println("Explanation(s): "); } final String header = _index++ + ")"; _writer.print(header); renderSingleExplanation(explanations.iterator().next()); _writer.println(); }
/** * Render an explanation without the axiom header. This function is not guaranteed to be supported by the subclasses since an explanation renderer may rely * on the axiom being explained to reorder the axioms or find irrelevant bits. * * @param explanations Set of explanations we are rendering * @throws OWLException * @throws IOException * @throws UnsupportedOperationException */ public void render(final Set<Set<OWLAxiom>> explanations) throws OWLException, IOException, UnsupportedOperationException { render((OWLAxiom) null, explanations); }
/** * Render an explanation without the axiom header. This function is not guaranteed to be supported by the subclasses since an explanation renderer may rely * on the axiom being explained to reorder the axioms or find irrelevant bits. * * @param explanations Set of explanations we are rendering * @throws OWLException * @throws IOException * @throws UnsupportedOperationException */ public void render(final Set<Set<OWLAxiom>> explanations) throws OWLException, IOException, UnsupportedOperationException { render((OWLAxiom) null, explanations); }