示例#1
0
 @Override
 public void dispose() {
   if (encoder != null) encoder.dispose();
   if (rlLowerStore != null) rlLowerStore.dispose();
   if (lazyUpperStore != null) lazyUpperStore.dispose();
   if (elLowerStore != null) elLowerStore.dispose();
   if (trackingStore != null) trackingStore.dispose();
   super.dispose();
 }
示例#2
0
  @Override
  public boolean preprocess() {
    t.reset();
    Utility.logInfo("Preprocessing ... checking satisfiability ... ");

    String name = "data", datafile = importedData.toString();
    rlLowerStore.importRDFData(name, datafile);
    rlLowerStore.materialise("lower program", program.getLower().toString());
    //		program.getLower().save();
    if (!consistency.checkRLLowerBound()) return false;
    Utility.logInfo(
        "The number of sameAs assertions in RL lower store: " + rlLowerStore.getSameAsNumber());

    String originalMarkProgram = OWLHelper.getOriginalMarkProgram(ontology);

    elLowerStore.importRDFData(name, datafile);
    elLowerStore.materialise("saturate named individuals", originalMarkProgram);
    elLowerStore.materialise("lower program", program.getLower().toString());
    elLowerStore.initialiseKarma();
    if (!consistency.checkELLowerBound()) return false;

    if (lazyUpperStore != null) {
      lazyUpperStore.importRDFData(name, datafile);
      lazyUpperStore.materialise("saturate named individuals", originalMarkProgram);
      int tag = lazyUpperStore.materialiseRestrictedly(program, null);
      if (tag != 1) {
        lazyUpperStore.dispose();
        lazyUpperStore = null;
      }
      if (tag == -1) return false;
    }
    if (consistency.checkLazyUpper()) {
      satisfiable = true;
      Utility.logInfo("time for satisfiability checking: " + t.duration());
    }

    trackingStore.importRDFData(name, datafile);
    trackingStore.materialise("saturate named individuals", originalMarkProgram);

    //		materialiseFullUpper();
    //		GapByStore4ID gap = new GapByStore4ID(trackingStore);
    GapByStore4ID gap = new GapByStore4ID2(trackingStore, rlLowerStore);
    trackingStore.materialiseFoldedly(program, gap);
    predicatesWithGap = gap.getPredicatesWithGap();
    gap.clear();

    if (program.getGeneral().isHorn())
      encoder = new TrackingRuleEncoderWithGap(program.getUpper(), trackingStore);
    else encoder = new TrackingRuleEncoderDisjVar1(program.getUpper(), trackingStore);
    //			encoder = new TrackingRuleEncoderDisj1(program.getUpper(), trackingStore);
    //			encoder = new TrackingRuleEncoderDisjVar2(program.getUpper(), trackingStore);
    //			encoder = new TrackingRuleEncoderDisj2(program.getUpper(), trackingStore);

    program.deleteABoxTurtleFile();

    if (!isConsistent()) return false;

    consistency.extractBottomFragment();
    return true;
  }