public Set<OWLEntity> getSignature() { if (signature == null) { Set<OWLEntity> sig = new HashSet<OWLEntity>(); OWLEntityCollector collector = new OWLEntityCollector(); accept(collector); sig.addAll(collector.getObjects()); signature = new HashSet<OWLEntity>(sig); } return Collections.unmodifiableSet(signature); }
/** * Returns the entities referenced in an axiom. * * @param axiom axiom whose signature is being computed * @return the entities referenced in the axiom */ private Set<OWLEntity> getSignature(OWLAxiom axiom) { collector.reset(); axiom.accept(collector); return new HashSet<OWLEntity>(collector.getObjects()); }
private Set<OWLEntity> getEntities(OWLObject obj) { entityCollector.reset(); obj.accept(entityCollector); return entityCollector.getObjects(); }
public Set<OWLEntity> getReferencedEntities() { OWLEntityCollector collector = new OWLEntityCollector(); this.accept(collector); return collector.getObjects(); }
/** * A convenience method that obtains the entities which are * referenced in the axiom contained within this change. * @return A <code>Set</code> of entities which are referenced * by the axiom contained within this change. */ public Set<OWLEntity> getEntities() { OWLEntityCollector collector = new OWLEntityCollector(); axiom.accept(collector); return collector.getObjects(); } }
private void buildChildren(OWLClassExpression seed) { // Return the axioms that have the entity on the LHS OWLEntityCollector collector = new OWLEntityCollector(); seed.accept(collector); Set<OWLAxiom> result = new HashSet<OWLAxiom>(); for (OWLEntity ent : collector.getObjects()) { Set<OWLAxiom> axs = getAxiomsByLHS(ent); for (OWLAxiom ax : axs) { result.add(ax); usedAxioms.add(ax); } } rootAxioms.addAll(result); buildChildren(result); }
private void indexAxiomsByRHSEntities(OWLObject rhs, OWLAxiom axiom) { OWLEntityCollector collector = new OWLEntityCollector(); rhs.accept(collector); getIndexedSet(axiom, entitiesByAxiomRHS, true).addAll(collector.getObjects()); }
private Set<OWLAxiom> build(OWLAxiom parentAxiom) { usedAxioms.add(parentAxiom); OWLAxiomPartExtractor extractor = new OWLAxiomPartExtractor(); parentAxiom.accept(extractor); Set<OWLAxiom> result = new HashSet<OWLAxiom>(); for (OWLObject obj : extractor.getRHS()) { OWLEntityCollector collector = new OWLEntityCollector(); obj.accept(collector); for (OWLEntity ent : collector.getObjects()) { Set<OWLAxiom> axs = getAxiomsByLHS(ent); for (OWLAxiom ax : axs) { if (!usedAxioms.contains(ax)) { result.add(ax); usedAxioms.add(ax); } } } } return result; }
for (OWLEntity curObj : collector.getObjects()) { if (!objectsExpandedWithDefiningAxioms.contains(curObj)) { int added = expandWithDefiningAxioms(curObj, remainingSpace); ax.accept(collector); for (OWLEntity curObj : collector.getObjects()) { if (!objectsExpandedWithReferencingAxioms.contains(curObj)) { int added = expandWithReferencingAxioms(curObj, expansionLimit);
for (OWLEntity curObj : collector.getObjects()) { if (!objectsExpandedWithDefiningAxioms.contains(curObj)) { int added = expandWithDefiningAxioms(curObj, remainingSpace); ax.accept(collector); for (OWLEntity curObj : collector.getObjects()) { if (!objectsExpandedWithReferencingAxioms.contains(curObj)) { int added = expandWithReferencingAxioms(curObj, expansionLimit);
/** * Determines if a class description contains any unreferenced entities with * respect to the ontology that contains the entailments which are being * explained. * @param desc The description to be searched * @return <code>true</code> if the description references entities that * the ontology that contains entailments which are being explained, * otherwise <code>false</code> */ public static boolean containsUnreferencedEntity(OWLOntology ontology, OWLClassExpression desc) { OWLEntityCollector entityCollector = new OWLEntityCollector(); desc.accept(entityCollector); for (OWLEntity entity : entityCollector.getObjects()) { if (!ontology.containsEntityInSignature(entity)) { if (entity instanceof OWLClass && (((OWLClass) entity).isOWLThing() || ((OWLClass) entity).isOWLNothing())) { continue; } return true; } } return false; }
private void createMap() { for (OWLAxiom ax : axioms) { OWLAxiomPartExtractor extractor = new OWLAxiomPartExtractor(); ax.accept(extractor); OWLEntityCollector rhsCollector = new OWLEntityCollector(); for (OWLObject rhsObject : extractor.getRHS()) { rhsObject.accept(rhsCollector); } for (OWLEntity rhsEntity : rhsCollector.getObjects()) { index(rhsEntity, axiomsByRHS, ax); } OWLEntityCollector lhsCollector = new OWLEntityCollector(); for (OWLObject lhsObject : extractor.getLHS()) { lhsObject.accept(lhsCollector); } for (OWLEntity lhsEntity : lhsCollector.getObjects()) { index(lhsEntity, axiomsByLHS, ax); } } buildChildren(desc); }
private void handleAxiomAdded(OWLAxiom axiom) { entityCollector.reset(); axiom.accept(entityCollector); for (OWLEntity object : entityCollector.getObjects()) { referenceAdder.setAxiom(axiom); object.accept(referenceAdder); } for(OWLAnonymousIndividual ind : entityCollector.getAnonymousIndividuals()) { addToIndexedSet(ind, owlAnonymousIndividualReferences, axiom); } if(axiom.isAnnotated()) { addToIndexedSet(axiom.getAxiomWithoutAnnotations(), logicalAxiom2AnnotatedAxiomMap, axiom); } }
private void handleAxiomRemoved(OWLAxiom axiom) { entityCollector.reset(); axiom.accept(entityCollector); for (OWLEntity object : entityCollector.getObjects()) { referenceRemover.setAxiom(axiom); object.accept(referenceRemover); } for(OWLAnonymousIndividual ind : entityCollector.getAnonymousIndividuals()) { removeAxiomFromSet(ind, owlAnonymousIndividualReferences, axiom, true); } if(axiom.isAnnotated()) { removeAxiomFromSet(axiom.getAxiomWithoutAnnotations(), logicalAxiom2AnnotatedAxiomMap, axiom, true); } }
for (OWLEntity entity : collector.getObjects()) { if (entity instanceof OWLClass) { getLogger()
for (OWLEntity entity : collector.getObjects()) { if (entity instanceof OWLProperty) { properties.add((OWLProperty) entity);