@Nonnull public OWLLiteral replaceLexicalValue(@Nonnull OWLLiteral literal, @Nonnull String replacement) { return replaceLexicalValue(literal, WHOLE_STRING_PATTERN, replacement); }
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)); }); }); }