コード例 #1
0
  public Set<Map<Variable, Term>> retrieveBinding(Condition condition) {
    logger.debug(
        "Executing query "
            + condition
            + " over "
            + state.getIdentifier()
            + " with "
            + state.listInstances().size()
            + " instances and "
            + state.listAxioms().size()
            + " axioms.");
    try {
      reasoner.deRegisterOntology((IRI) (state.getIdentifier()));
    } catch (Exception e) {
      // allow for kaon
    }

    try {
      reasoner.registerOntology(state);
    } catch (InconsistencyException e) {
      logger.warn("Ontology registration failed.", e);
    }
    Set<Map<Variable, Term>> instances =
        reasoner.executeQuery(
            (IRI) state.getIdentifier(), condition.getRestrictedLogicalExpression());
    return instances;
  }
コード例 #2
0
 public boolean holds(Condition condition) {
   logger.debug(
       "Executing ground query "
           + condition
           + " over "
           + state.getIdentifier()
           + " with "
           + state.listInstances().size()
           + " instances and "
           + state.listAxioms().size()
           + " axioms.");
   try {
     reasoner.deRegisterOntology((IRI) (state.getIdentifier()));
   } catch (Throwable t) {
     // silent
     // TODO log warn
   }
   try {
     reasoner.registerOntology(state);
   } catch (InconsistencyException e) {
     logger.warn("Ontology registration failed.", e);
   }
   return reasoner.executeGroundQuery(
       (IRI) state.getIdentifier(), condition.getRestrictedLogicalExpression());
 }