@Override public Stream<OWLAxiom> getModule(Stream<OWLEntity> signature, boolean useSemantics, ModuleType moduletype) { return decomposer.getModule(signature, useSemantics, moduletype).stream() .map(AxiomWrapper::getAxiom).filter(ax -> ax != null); } }
/** * @param axioms axiom wrappers to decompose * @param c locality checker to use */ public Decomposer(List<AxiomWrapper> axioms, LocalityChecker c) { this.axioms = axioms; modularizer = buildModulariser(axioms, c); }
@Override public AtomList getAtomList() { return decomposer.getAOS(); }
removeTautologies(); Optional<OntologyAtom> bottomAtom = buildModule(new Signature(), rootAtom); if (bottomAtom.isPresent()) { bottomAtom.get().addAxioms(bottomAtom.get().getModule()); if (p.isUsed() && !p.getAtom().isPresent()) { assert rootAtom != null; createAtom(p, rootAtom); restoreTautologies(); rootAtom = null;
/** * @param axioms axioms * @param type type */ public AtomicDecompositionImpl(List<OWLAxiom> axioms, ModuleType type) { this.type = type; decomposer = new Decomposer(AxiomSelector.wrap(axioms), new SyntacticLocalityChecker()); int size = decomposer.getAOS(this.type).size(); atoms = new ArrayList<>(); for (int i = 0; i < size; i++) { final Atom atom = new Atom(asSet(decomposer.getAOS().get(i).getAtomAxioms())); atoms.add(atom); atomIndex.put(atom, i); for (OWLEntity e : atom.getSignature()) { termBasedIndex.put(e, atom); } } for (int i = 0; i < size; i++) { Set<OntologyAtom> dependentIndexes = decomposer.getAOS().get(i).getDependencies(); for (OntologyAtom j : dependentIndexes) { dependencies.put(atoms.get(i), atoms.get(j.getId())); dependents.put(atoms.get(j.getId()), atoms.get(i)); } } }
atom = buildModule(new Signature(ax.getAxiom().signature()), parent); atom.get().addDepAtom(createAtom(q, atom.get()));
/** * 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(); }
@Override public Set<OWLAxiom> getTautologies() { return asSet(decomposer.getTautologies()); }
/** * @param useSemantic * useSemantic * @param r * reasoner * @return module extractor */ @PortedFrom(file = "Kernel.h", name = "getModExtractor") public Decomposer getModExtractor(boolean useSemantic, OWLReasoner r) { if (useSemantic) { if (modSem == null) { modSem = new Decomposer(ontology.getAxioms(), new SemanticLocalityChecker(r)); } return modSem; } if (modSyn == null) { modSyn = new Decomposer(ontology.getAxioms(), new SyntacticLocalityChecker()); } return modSyn; }
removeTautologies(); Optional<OntologyAtom> bottomAtom = buildModule(new Signature(), rootAtom); if (bottomAtom.isPresent()) { bottomAtom.get().addAxioms(bottomAtom.get().getModule()); if (p.isUsed() && !p.getAtom().isPresent()) { assert rootAtom != null; createAtom(p, rootAtom); restoreTautologies(); rootAtom = null;
/** * @param axioms axioms * @param type type */ public AtomicDecompositionImpl(List<OWLAxiom> axioms, ModuleType type) { this.type = type; decomposer = new Decomposer(AxiomSelector.wrap(axioms), new SyntacticLocalityChecker()); int size = decomposer.getAOS(this.type).size(); atoms = new ArrayList<>(); for (int i = 0; i < size; i++) { final Atom atom = new Atom(asSet(decomposer.getAOS().get(i).getAtomAxioms())); atoms.add(atom); atomIndex.put(atom, i); for (OWLEntity e : atom.getSignature()) { termBasedIndex.put(e, atom); } } for (int i = 0; i < size; i++) { Set<OntologyAtom> dependentIndexes = decomposer.getAOS().get(i).getDependencies(); for (OntologyAtom j : dependentIndexes) { dependencies.put(atoms.get(i), atoms.get(j.getId())); dependents.put(atoms.get(j.getId()), atoms.get(i)); } } }
atom = buildModule(new Signature(ax.getAxiom().signature()), parent); atom.get().addDepAtom(createAtom(q, atom.get()));
@Override public Set<OWLAxiom> getTautologies() { return asSet(decomposer.getTautologies()); }
removeTautologies(); Optional<OntologyAtom> bottomAtom = buildModule(new Signature(), rootAtom); if (bottomAtom.isPresent()) { bottomAtom.get().addAxioms(bottomAtom.get().getModule()); if (p.isUsed() && !p.getAtom().isPresent()) { assert rootAtom != null; createAtom(p, rootAtom); restoreTautologies(); rootAtom = null;
/** * @param axioms axioms * @param type type */ public AtomicDecompositionImpl(List<OWLAxiom> axioms, ModuleType type) { this.type = type; decomposer = new Decomposer(AxiomSelector.wrap(axioms), new SyntacticLocalityChecker()); int size = decomposer.getAOS(this.type).size(); atoms = new ArrayList<>(); for (int i = 0; i < size; i++) { final Atom atom = new Atom(asSet(decomposer.getAOS().get(i).getAtomAxioms())); atoms.add(atom); atomIndex.put(atom, i); for (OWLEntity e : atom.getSignature()) { termBasedIndex.put(e, atom); } } for (int i = 0; i < size; i++) { Set<OntologyAtom> dependentIndexes = decomposer.getAOS().get(i).getDependencies(); for (OntologyAtom j : dependentIndexes) { dependencies.put(atoms.get(i), atoms.get(j.getId())); dependents.put(atoms.get(j.getId()), atoms.get(i)); } } }
atom = buildModule(new Signature(ax.getAxiom().signature()), parent); atom.get().addDepAtom(createAtom(q, atom.get()));
@Override public Stream<OWLAxiom> getModule(Stream<OWLEntity> signature, boolean useSemantics, ModuleType moduletype) { return decomposer.getModule(signature, useSemantics, moduletype).stream() .map(AxiomWrapper::getAxiom).filter(ax -> ax != null); } }
@Override public AtomList getAtomList() { return decomposer.getAOS(); }
/** * @param axioms axiom wrappers to decompose * @param c locality checker to use */ public Decomposer(List<AxiomWrapper> axioms, LocalityChecker c) { this.axioms = axioms; modularizer = buildModulariser(axioms, c); }
@Override public Set<OWLAxiom> getTautologies() { return asSet(decomposer.getTautologies()); }