Search in sources :

Example 1 with AxiomChangeData

use of org.semanticweb.owlapi.change.AxiomChangeData in project webprotege by protegeproject.

the class EntitiesByRevisionCache method getEntitiesInternal.

private ImmutableSet<OWLEntity> getEntitiesInternal(Revision revision) {
    ImmutableSet.Builder<OWLEntity> result = ImmutableSet.builder();
    Set<IRI> iris = new HashSet<>();
    for (OWLOntologyChangeRecord change : revision) {
        if (change.getData() instanceof AxiomChangeData) {
            OWLAxiom ax = ((AxiomChangeData) change.getData()).getAxiom();
            java.util.Optional<? extends OWLObject> subject = axiomSubjectProvider.getSubject(ax);
            if (subject.isPresent()) {
                if (subject.get() instanceof OWLEntity) {
                    result.add((OWLEntity) subject.get());
                } else if (subject.get() instanceof IRI) {
                    iris.add((IRI) subject.get());
                }
            }
        }
    }
    for (IRI iri : iris) {
        for (EntityType<?> entityType : EntityType.values()) {
            OWLEntity entity = dataFactory.getOWLEntity(entityType, iri);
            if (hasContainsEntityInSignature.containsEntityInSignature(entity)) {
                result.add(entity);
            }
        }
    }
    return result.build();
}
Also used : OWLOntologyChangeRecord(org.semanticweb.owlapi.change.OWLOntologyChangeRecord) AxiomChangeData(org.semanticweb.owlapi.change.AxiomChangeData) ImmutableSet(com.google.common.collect.ImmutableSet) HashSet(java.util.HashSet)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 HashSet (java.util.HashSet)1 AxiomChangeData (org.semanticweb.owlapi.change.AxiomChangeData)1 OWLOntologyChangeRecord (org.semanticweb.owlapi.change.OWLOntologyChangeRecord)1