/** * build signature for ENTITY and all dependent entities from toProcess; * look for modules in Module; * * @param entity * entity * @param module * Module * @param toProcess * toProcess */ @PortedFrom(file = "Incremental.cpp", name = "buildSignature") public void buildSignature(OWLEntity entity, Collection<AxiomWrapper> module, Set<OWLEntity> toProcess) { toProcess.remove(entity); setupSig(entity); Collection<AxiomWrapper> newModule = getModExtractor(false, null).getModularizer().getModule(); if (module.size() == newModule.size()) { return; } // smaller module: recurse Signature modSig = getModExtractor(false, null).getModularizer().getSignature(); modSig.getSignature().stream().filter(toProcess::contains).forEach(p -> buildSignature(p, newModule, toProcess)); }
/** * @param signature * signature * @param useSemantic * useSemantic * @param type * type * @param r * reasoner * @return a set of axioms that corresponds to the atom with the id INDEX */ @PortedFrom(file = "Kernel.h", name = "getNonLocal") public Set<AxiomWrapper> getNonLocal(List<Expression> signature, boolean useSemantic, ModuleType type, OWLReasoner r) { // init signature Signature sig = new Signature(); sig.setLocality(type == ModuleType.TOP); signature.stream().filter(p -> p instanceof NamedEntity).map(p -> ((NamedEntity) p).getEntity()).forEach( sig::add); // do check LocalityChecker lc = getModExtractor(useSemantic, r).getModularizer().getLocalityChecker(); lc.setSignatureValue(sig); result.clear(); add(result, getOntology().getAxioms().stream().filter(p -> !lc.local(p.getAxiom()))); return result; }
/** * setup Name2Sig for a given entity; * * @param entity * entity */ @PortedFrom(file = "Incremental.cpp", name = "setupSig") public void setupSig(@Nullable OWLEntity entity) { moduleTimer.start(); // do nothing if entity doesn't exist if (entity == null) { return; } moduleTimer.start(); // prepare a place to update Signature sig = new Signature(); // calculate a module sig.add(entity); getModExtractor(false, null).getModule(sig.getSignature().stream(), false, ModuleType.BOT); // perform update name2Sig.put(entity, new Signature(getModExtractor(false, null).getModularizer().getSignature().getSignature() .stream())); moduleTimer.stop(); }
LocalityChecker lc = getModExtractor(false, null).getModularizer().getLocalityChecker(); for (Map.Entry<OWLEntity, Signature> p : name2Sig.entrySet()) { lc.setSignatureValue(p.getValue());