@Override public Set<OWLAxiom> getJustification(Inference<?> inference) { if (Inferences.isAsserted(inference)) { Object conclusion = inference.getConclusion(); if (conclusion instanceof OWLAxiom) { return Collections .singleton((OWLAxiom) inference.getConclusion()); } } // else return Collections.emptySet(); }
private static void unwindProof(Proof<?> proof, Object entailment) { // Start recursive unwinding of conclusions LinkedList<Object> toDo = new LinkedList<Object>(); Set<Object> done = new HashSet<Object>(); toDo.add(entailment); done.add(entailment); for (;;) { Object next = toDo.poll(); if (next == null) { break; } for (Inference<?> inf : proof.getInferences(next)) { System.out.println(inf); // Recursively unwind premise inferences for (Object premise : inf.getPremises()) { if (done.add(premise)) { toDo.addFirst(premise); } } // Uncomment if only interested in one inference per derived expression (that is sufficient to reconstruct one proof) break; } } }
private static void unwindProof(Proof<?> proof, Object entailment) { // Start recursive unwinding of conclusions LinkedList<Object> toDo = new LinkedList<Object>(); Set<Object> done = new HashSet<Object>(); toDo.add(entailment); done.add(entailment); for (;;) { Object next = toDo.poll(); if (next == null) { break; } for (Inference<?> inf : proof.getInferences(next)) { System.out.println(inf); // Recursively unwind premise inferences for (Object premise : inf.getPremises()) { if (done.add(premise)) { toDo.addFirst(premise); } } // Uncomment if only interested in one inference per derived expression (that is sufficient to reconstruct one proof) break; } } }