Ejemplo n.º 1
0
 @Override
 public boolean isConsistent() {
   if (satisfiable == null) {
     satisfiable = consistency.check();
     Utility.logInfo("time for satisfiability checking: " + t.duration());
   }
   return satisfiable;
 }
Ejemplo n.º 2
0
  private OWLOntology relevantPart(QueryRecord queryRecord) {
    AnswerTuples rlAnswer = null, elAnswer = null;

    t.reset();
    try {
      rlAnswer =
          rlLowerStore.evaluate(queryRecord.getQueryText(), queryRecord.getAnswerVariables());
      Utility.logDebug(t.duration());
      queryRecord.updateLowerBoundAnswers(rlAnswer);
    } finally {
      if (rlAnswer != null) rlAnswer.dispose();
    }
    queryRecord.addProcessingTime(Step.LowerBound, t.duration());
    rlAnswer = null;

    t.reset();
    BasicQueryEngine upperStore =
        queryRecord.isBottom() || lazyUpperStore == null ? trackingStore : lazyUpperStore;

    String[] extendedQuery = queryRecord.getExtendedQueryText();

    queryUpperBound(
        upperStore, queryRecord, queryRecord.getQueryText(), queryRecord.getAnswerVariables());
    if (!queryRecord.processed() && !queryRecord.getQueryText().equals(extendedQuery[0]))
      queryUpperBound(upperStore, queryRecord, extendedQuery[0], queryRecord.getAnswerVariables());
    if (!queryRecord.processed() && queryRecord.hasNonAnsDistinguishedVariables())
      queryUpperBound(
          upperStore, queryRecord, extendedQuery[1], queryRecord.getDistinguishedVariables());

    queryRecord.addProcessingTime(Step.UpperBound, t.duration());
    if (queryRecord.processed()) {
      queryRecord.setDifficulty(Step.UpperBound);
      return null;
    }

    t.reset();
    try {
      elAnswer =
          elLowerStore.evaluate(
              extendedQuery[0],
              queryRecord.getAnswerVariables(),
              queryRecord.getLowerBoundAnswers());
      Utility.logDebug(t.duration());
      queryRecord.updateLowerBoundAnswers(elAnswer);
    } finally {
      if (elAnswer != null) elAnswer.dispose();
    }
    queryRecord.addProcessingTime(Step.ELLowerBound, t.duration());

    if (queryRecord.processed()) {
      queryRecord.setDifficulty(Step.ELLowerBound);
      return null;
    }

    t.reset();

    QueryTracker tracker = new QueryTracker(encoder, rlLowerStore, queryRecord);

    OWLOntology knowledgebase;
    t.reset();
    //		if (program.getGeneral().isHorn()) {
    //			knowledgebase = tracker.extract(lazyUpperStore, consistency.getQueryRecords(), true);
    //			queryRecord.addProcessingTime(Step.Fragment, t.duration());
    //			return knowledgebase;
    //		}
    //		else {
    knowledgebase = tracker.extract(trackingStore, consistency.getQueryRecords(), true);
    queryRecord.addProcessingTime(Step.Fragment, t.duration());
    //		}

    if (knowledgebase.isEmpty() || queryRecord.isBottom()) return knowledgebase;

    if (program.getGeneral().isHorn()) return knowledgebase;

    //		t.reset();
    //		if (queryRecord.isHorn() && lazyUpperStore != null) {
    ////			knowledgebase = tracker.extract(lazyUpperStore, consistency.getQueryRecords(), true);
    //		} else if (queryRecord.getArity() < 3) {
    //			IterativeRefinement iterativeRefinement = new IterativeRefinement(queryRecord, tracker,
    // trackingStore, consistency.getQueryRecords());
    //			knowledgebase = iterativeRefinement.extractWithFullABox(importedData.toString(),
    // program.getUpperBottomStrategy());
    //		}
    //
    //		queryRecord.addProcessingTime(Step.FragmentRefinement, t.duration());
    //
    //		if (knowledgebase == null)
    //			queryRecord.setDifficulty(Step.FragmentRefinement);

    return knowledgebase;
  }