コード例 #1
0
  protected boolean isEntailed(
      OWLOntologyManager manager, OWLOntology premise, OWLOntology conclusion)
      throws OWLReasonerException {

    OWLReasoner reasoner = JcelReasonerManager.getInstance().getJcelReasoner(manager);
    this.reasoner = reasoner;

    reasoner.clearOntologies();
    reasoner.loadOntologies(Collections.singleton(premise));
    reasoner.classify();

    JcelEntailmentChecker checker =
        new JcelEntailmentChecker(reasoner, manager.getOWLDataFactory());

    boolean ret = true;
    for (Iterator<OWLLogicalAxiom> it = conclusion.getLogicalAxioms().iterator();
        ret && it.hasNext(); ) {
      OWLLogicalAxiom axiom = it.next();

      if (!checker.isEntailed(axiom)) {
        ret = false;
      }
    }
    return ret;
  }
コード例 #2
0
  protected boolean isConsistent(OWLOntologyManager manager, OWLOntology o)
      throws OWLReasonerException {
    OWLReasoner reasoner = JcelReasonerManager.getInstance().getJcelReasoner(manager);
    this.reasoner = reasoner;

    reasoner.clearOntologies();
    reasoner.loadOntologies(Collections.singleton(o));
    reasoner.classify();

    boolean ret = reasoner.isConsistent(o);
    return ret;
  }