private List<OWLOntologyChange> getChangesForAnnotationSubject(OWLAnnotationSubject subject, OWLOntology ont) { List<OWLOntologyChange> changes = new ArrayList<>(); for (OWLAnnotationAssertionAxiom ax : ont.getAnnotationAssertionAxioms(subject)) { changes.add(new RemoveAxiom(ont, ax)); } return changes; }
@Override @Deprecated public Set<OWLAnnotationAssertionAxiom> getAnnotationAssertionAxioms( OWLAnnotationSubject owlAnnotationSubject) { return withReadLock(() -> delegate.getAnnotationAssertionAxioms(owlAnnotationSubject)); }
@Override @Deprecated public Set<OWLAnnotationAssertionAxiom> getAnnotationAssertionAxioms( OWLAnnotationSubject entity, Imports imports) { return withReadLock(() -> delegate.getAnnotationAssertionAxioms(entity, imports)); }
@Override public Stream<OWLAnnotationAssertionAxiom> getAnnotationAssertionAxioms(@Nonnull IRI subject, @Nonnull OWLAnnotationProperty property) { return rootOntology.getAnnotationAssertionAxioms(subject).stream() .filter(ax -> ax.getProperty().equals(property)); }
@Override public Set<OWLAnnotationAssertionAxiom> getAnnotationAssertionAxioms(OWLAnnotationSubject subject) { Set<OWLAnnotationAssertionAxiom> result = new HashSet<>(); for(OWLOntology ontology : rootOntology.getImportsClosure()) { result.addAll(ontology.getAnnotationAssertionAxioms(subject)); } return result; } }
@Override public Set<? extends OWLAxiom> visit(IRI iri) { Set<OWLAxiom> axioms = Sets.newHashSet(); axioms.addAll(ontology.getAnnotationAssertionAxioms(iri)); for(OWLEntity entity : ontology.getEntitiesInSignature(iri, Imports.INCLUDED)) { axioms.addAll(getDefiningAxioms(entity, ontology)); } return axioms; } }));
public Set<OWLAxiom> getAxioms(Set<OWLOntology> ontologies, Set<OWLEntity> entities) { Set<OWLAxiom> result = new HashSet<>(); for (OWLEntity e : entities) { for(OWLOntology ont : ontologies) { result.addAll(ont.getReferencingAxioms(e)); result.addAll(ont.getAnnotationAssertionAxioms(e.getIRI())); } } return result; }
@Override public Set<? extends OWLAxiom> visit(IRI iri) { Set<OWLAxiom> axioms = Sets.newHashSet(); axioms.addAll(ontology.getAnnotationAssertionAxioms(iri)); for(OWLEntity entity : ontology.getEntitiesInSignature(iri, Imports.INCLUDED)) { axioms.addAll(getDefiningAxioms(entity, ontology)); } return axioms; } }));
public Set<OWLAxiom> getAxioms(Set<OWLOntology> ontologies, Set<OWLEntity> entities) { Set<OWLAxiom> result = new HashSet<OWLAxiom>(); for (OWLEntity e : entities) { for(OWLOntology ont : ontologies) { result.addAll(ont.getReferencingAxioms(e)); result.addAll(ont.getAnnotationAssertionAxioms(e.getIRI())); } } return result; }
public Set<OWLAxiom> getAxioms(Set<OWLOntology> ontologies, Set<OWLEntity> entities) { Set<OWLAxiom> result = new HashSet<OWLAxiom>(); for (OWLEntity e : entities) { for(OWLOntology ont : ontologies) { result.addAll(ont.getReferencingAxioms(e)); result.addAll(ont.getAnnotationAssertionAxioms(e.getIRI())); } } return result; }
private ImmutableCollection<OWLAnnotationAssertionAxiom> getAxioms(@Nonnull IRI subject) { return axiomsBySubject.get(subject, (iri) -> rootOntology.getImportsClosure().stream() .flatMap(ont -> ont.getAnnotationAssertionAxioms(iri).stream()) .collect(toImmutableList())); }
private Set<OWLAxiom> getRelevantAxioms(OWLClass subject, boolean includeAnnotations) { var relevantAxioms = new HashSet<OWLAxiom>(); for (OWLOntology ont : rootOntology.getImportsClosure()) { relevantAxioms.addAll(ont.getSubClassAxiomsForSubClass(subject)); relevantAxioms.addAll(rootOntology.getEquivalentClassesAxioms(subject)); if (includeAnnotations) { relevantAxioms.addAll(ont.getAnnotationAssertionAxioms(subject.getIRI())); } } return relevantAxioms; }
@Nonnull public List<OBOXRef> getXRefs(@Nonnull OWLEntity term) { return rootOntology.getAnnotationAssertionAxioms(term.getIRI()).stream() .filter(ax -> isXRefProperty(ax.getProperty())) .map(ax -> converter.toXRef(ax.getAnnotation(), ax.getAnnotations())) .collect(toList()); } }
private Set<OWLAxiom> getRelevantAxioms(OWLNamedIndividual subject) { var relevantAxioms = new HashSet<OWLAxiom>(); for (OWLOntology ontology : rootOntology.getImportsClosure()) { relevantAxioms.addAll(ontology.getClassAssertionAxioms(subject)); relevantAxioms.addAll(ontology.getAnnotationAssertionAxioms(subject.getIRI())); relevantAxioms.addAll(ontology.getObjectPropertyAssertionAxioms(subject)); relevantAxioms.addAll(ontology.getDataPropertyAssertionAxioms(subject)); } return relevantAxioms; }
@Override public Boolean visit(OWLClass ce) { return !modelManager.getActiveOntology().getAxioms(ce, Imports.EXCLUDED).isEmpty() || !modelManager.getActiveOntology().getAnnotationAssertionAxioms(ce.getIRI()).isEmpty(); }
@Override public Boolean visit(OWLDataProperty property) { return !modelManager.getActiveOntology().getAxioms(property, Imports.EXCLUDED).isEmpty() || !modelManager.getActiveOntology().getAnnotationAssertionAxioms(property.getIRI()).isEmpty(); }
@Override public Boolean visit(OWLObjectProperty property) { return !modelManager.getActiveOntology().getAxioms(property, Imports.EXCLUDED).isEmpty() || !modelManager.getActiveOntology().getAnnotationAssertionAxioms(property.getIRI()).isEmpty(); }
@Override public Boolean visit(OWLNamedIndividual individual) { return !modelManager.getActiveOntology().getAxioms(individual, Imports.EXCLUDED).isEmpty() || !modelManager.getActiveOntology().getAnnotationAssertionAxioms(individual.getIRI()).isEmpty(); }
@Override public Boolean visit(OWLAnnotationProperty property) { return !modelManager.getActiveOntology().getAxioms(property, Imports.EXCLUDED).isEmpty() || !modelManager.getActiveOntology().getAnnotationAssertionAxioms(property.getIRI()).isEmpty(); } }
private void deprecateSourceEntities(OntologyChangeList.Builder<OWLEntity> builder) { sourceEntities.forEach(sourceEntity -> { // Add an annotation assertion to deprecate the source entity OWLAnnotationAssertionAxiom depAx = dataFactory.getDeprecatedOWLAnnotationAssertionAxiom(sourceEntity.getIRI()); builder.addAxiom(rootOntology, depAx); // Preserve labels and other annotations on the source entity ontologyStream(rootOntology, Imports.INCLUDED) .forEach(ont -> ont.getAnnotationAssertionAxioms(sourceEntity.getIRI()) .forEach(ax -> builder.addAxiom(ont, ax))); }); }