private Set<OWLAnnotation> getAxiomAnnotationsExcludingXRefs(OWLAnnotationAssertionAxiom existingAx) { Set<OWLAnnotation> annotationsToCopy = new HashSet<>(); for (OWLAnnotation existingAnnotation : existingAx.getAnnotations()) { if (!isXRefProperty(existingAnnotation.getProperty())) { annotationsToCopy.add(existingAnnotation); } } return annotationsToCopy; } }
@Nonnull public List<OBOXRef> getXRefs(@Nonnull OWLAnnotationAssertionAxiom annotationAssertion) { return annotationAssertion.getAnnotations().stream() .filter(anno -> isXRefProperty(anno.getProperty())) .map(anno -> converter.toXRef(anno, anno.getAnnotations())) .filter(xref -> xref != null) .collect(toList()); }
public void visit(OWLAnnotationAssertionAxiom axiom) { hashCode = 47; hashCode = hashCode * MULT + axiom.getSubject().hashCode(); hashCode = hashCode * MULT + axiom.getProperty().hashCode(); hashCode = hashCode * MULT + axiom.getValue().hashCode(); hashCode = hashCode * MULT + axiom.getAnnotations().hashCode(); }
@Override public void visit(OWLAnnotationAssertionAxiom axiom) { hashCode = primes[12]; hashCode = hashCode * MULT + axiom.getSubject().hashCode(); hashCode = hashCode * MULT + axiom.getProperty().hashCode(); hashCode = hashCode * MULT + axiom.getValue().hashCode(); hashCode = hashCode * MULT + axiom.getAnnotations().hashCode(); }
@Override public void visit(OWLAnnotationAssertionAxiom axiom) { hashCode = 47; hashCode = hashCode * MULT + axiom.getSubject().hashCode(); hashCode = hashCode * MULT + axiom.getProperty().hashCode(); hashCode = hashCode * MULT + axiom.getValue().hashCode(); hashCode = hashCode * MULT + axiom.getAnnotations().hashCode(); }
@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()); } }
public boolean equals(Object obj) { if(obj == null) { return false; } if(obj == this) { return true; } if(!(obj instanceof OWLAnnotationAssertionAxiom)) { return false; } OWLAnnotationAssertionAxiom other = (OWLAnnotationAssertionAxiom) obj; return subject.equals(other.getSubject()) && property.equals(other.getProperty()) && value.equals(other.getValue()) && getAnnotations().equals(other.getAnnotations()); }
@Override protected Object getValueKey(Object value) { OWLAnnotation annotation = null; if (value instanceof OWLAnnotationAssertionAxiom) { OWLAnnotationAssertionAxiom axiom = (OWLAnnotationAssertionAxiom) value; if (axiom.getAnnotations().isEmpty()) { return axiom.getAnnotation(); } else { return axiom; } } else if (value instanceof AbstractAnnotationsList.AnnotationsListItem) { annotation = ((AbstractAnnotationsList.AnnotationsListItem) value).getAnnotation(); } else if (value instanceof OWLAnnotation) { annotation = (OWLAnnotation) value; } return annotation; }
private void tr(OWLAnnotationAssertionAxiom aanAx, Frame frame) { boolean success = tr(aanAx.getProperty(), aanAx.getValue(), aanAx.getAnnotations(), frame); if (!success) { untranslatableAxioms.add(aanAx); } }
@Override protected Object getValueKey(Object value) { OWLAnnotation annotation = null; if (value instanceof OWLAnnotationAssertionAxiom) { OWLAnnotationAssertionAxiom axiom = (OWLAnnotationAssertionAxiom) value; if (axiom.getAnnotations().isEmpty()) { return axiom.getAnnotation(); } else { return axiom; } } else if (value instanceof AbstractAnnotationsList.AnnotationsListItem) { annotation = ((AbstractAnnotationsList.AnnotationsListItem) value).getAnnotation(); } else if (value instanceof OWLAnnotation) { annotation = (OWLAnnotation) value; } return annotation; }
@Nonnull public List<OWLOntologyChange> replaceStringAnnotationValue(@Nonnull IRI annotationSubject, @Nonnull IRI annotationPropertyIRI, @Nonnull String replaceWith) { List<OWLOntologyChange> changes = new ArrayList<>(); OWLAnnotationProperty property = dataFactory.getOWLAnnotationProperty(annotationPropertyIRI); OWLLiteral value = dataFactory.getOWLLiteral(replaceWith); for (OWLOntology ontology : rootOntology.getImportsClosure()) { for (OWLAnnotationAssertionAxiom ax : ontology.getAnnotationAssertionAxioms(annotationSubject)) { if (ax.getProperty().getIRI().equals(annotationPropertyIRI)) { changes.add(new RemoveAxiom(ontology, ax)); if (!replaceWith.isEmpty()) { changes.add(new AddAxiom(rootOntology, dataFactory.getOWLAnnotationAssertionAxiom(property, annotationSubject, value, ax.getAnnotations()))); } } } } if (!replaceWith.isEmpty() && changes.isEmpty()) { // No previous value, so set new one changes.add(new AddAxiom(rootOntology, dataFactory.getOWLAnnotationAssertionAxiom(property, annotationSubject, value))); } return changes; }
private void replaceAnnotationAssertions(@Nonnull List<OWLOntologyChange> changes, @Nonnull Set<IRI> propertyIris, @Nonnull String replacement) { ontologies.forEach(o -> { IRI entityIri = info.getEntityToDeprecate().getIRI(); o.getAnnotationAssertionAxioms(entityIri).stream() .filter(ax -> propertyIris.contains(ax.getProperty().getIRI())) .filter(ax -> ax.getValue().asLiteral().isPresent()) .forEach(ax -> { changes.add(new RemoveAxiom(o, ax)); OWLLiteral currentLiteral = ax.getValue().asLiteral().get(); OWLLiteral replacementLiteral = new LiteralLexicalValueReplacer(dataFactory).replaceLexicalValue( currentLiteral, replacement); OWLAxiom replacementAx = dataFactory.getOWLAnnotationAssertionAxiom( ax.getProperty(), ax.getSubject(), replacementLiteral, ax.getAnnotations()); changes.add(new AddAxiom(o, replacementAx)); }); }); }
for (OWLAnnotation annotation : a.getAnnotations()) {
targetEntity.getIRI(), ax.getAnnotation(), ax.getAnnotations()); builder.removeAxiom(ont, origAx); targetEntity.getIRI(), replAnno, ax.getAnnotations()); builder.addAxiom(ont, replAx);
entity.getIRI(), newLiteral, ax.getAnnotations()); if (newAnnotationData.equals(ax)) { return;