@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "identifier")); Optional<IRI> optionalIri = ontology.getOntologyID().getOntologyIRI(); if (optionalIri.isPresent()) { String iri = optionalIri.get().toString(); OWLAnnotation identifier = factory.getOWLAnnotation(property, factory.getOWLLiteral(iri)); addChangeToOntology(new AddOntologyAnnotation(ontology, identifier)); } }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "contributor")); OWLAnnotation contributor = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getContributor())); addChangeToOntology(new AddOntologyAnnotation(ontology, contributor)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "description")); OWLAnnotation description = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getDescription())); addChangeToOntology(new AddOntologyAnnotation(ontology, description)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "date")); OWLAnnotation date = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getGenerationDate())); addChangeToOntology(new AddOntologyAnnotation(ontology, date)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "title")); OWLAnnotation title = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getTitle())); addChangeToOntology(new AddOntologyAnnotation(ontology, title)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "publisher")); OWLAnnotation publisher = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getCreator())); addChangeToOntology(new AddOntologyAnnotation(ontology, publisher)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "creator")); OWLAnnotation creator = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getCreator())); addChangeToOntology(new AddOntologyAnnotation(ontology, creator)); }
@Override public void addToOntology() { OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(RDFS_SEE_ALSO, pm); OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, IRI.create(requestInformation.getGeneratorIri())); addChangeToOntology(new AddOntologyAnnotation(ontology, annotation)); }
@Override public void addToOntology() { OWLLiteral titleLiteral = factory.getOWLLiteral(ontologyConstants.getTitle()); OWLAnnotation title = factory.getOWLAnnotation(factory.getRDFSLabel(), titleLiteral); addChangeToOntology(new AddOntologyAnnotation(ontology, title)); }
@Override public void addToOntology() { OWLLiteral descriptionLiteral = factory.getOWLLiteral(ontologyConstants.getDescription()); OWLAnnotation comment = factory.getOWLAnnotation(factory.getRDFSComment(), descriptionLiteral); addChangeToOntology(new AddOntologyAnnotation(ontology, comment)); }
@Override public void addToOntology() { OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(RDFS_IS_DEFINED_BY, pm); OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, IRI.create(requestInformation.getGeneratorIri())); addChangeToOntology(new AddOntologyAnnotation(ontology, annotation)); }
@Override public void addToOntology() { OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(OWL_INCOMPATIBLE_WITH, pm); IRI value = OntologyConstants.ONTOVIBE_CORE_IRI; OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, value); addChangeToOntology(new AddOntologyAnnotation(ontology, annotation)); }
@Override public void addToOntology() { OWLLiteral version = factory.getOWLLiteral(ontologyConstants.getVersion()); OWLAnnotation owlVersionInfo = factory.getOWLAnnotation(factory.getOWLVersionInfo(), version); addChangeToOntology(new AddOntologyAnnotation(ontology, owlVersionInfo)); }
@Override public void addToOntology() { OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(OWL_BACKWARD_COMPATIBLE_WITH, pm); IRI value = OntologyConstants.ONTOVIBE_MINIMAL_IRI; OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, value); addChangeToOntology(new AddOntologyAnnotation(ontology, annotation)); }
@Override public void addToOntology() { OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(OWL_PRIOR_VERSION, pm); IRI value = OntologyConstants.ONTOVIBE_CORE_IRI; OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, value); addChangeToOntology(new AddOntologyAnnotation(ontology, annotation)); }
@Override public void addToOntology() { OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(OWL_IMPORTS, pm); IRI value = OntologyConstants.ONTOVIBE_MINIMAL_IRI; OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, value); addChangeToOntology(new AddOntologyAnnotation(ontology, annotation)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DCTERMS + "contributor")); OWLAnnotation contributor = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getContributor())); addChangeToOntology(new AddOntologyAnnotation(ontology, contributor)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DCTERMS + "description")); OWLAnnotation description = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getDescription())); addChangeToOntology(new AddOntologyAnnotation(ontology, description)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DCTERMS + "identifier")); Optional<IRI> optionalIri = ontology.getOntologyID().getOntologyIRI(); if (optionalIri.isPresent()) { String iri = optionalIri.get().toString(); OWLAnnotation identifier = factory.getOWLAnnotation(property, factory.getOWLLiteral(iri)); addChangeToOntology(new AddOntologyAnnotation(ontology, identifier)); } }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DCTERMS + "title")); OWLAnnotation title = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getTitle())); addChangeToOntology(new AddOntologyAnnotation(ontology, title)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DCTERMS + "date")); OWLAnnotation date = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getGenerationDate())); addChangeToOntology(new AddOntologyAnnotation(ontology, date)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DCTERMS + "publisher")); OWLAnnotation publisher = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getCreator())); addChangeToOntology(new AddOntologyAnnotation(ontology, publisher)); }
@Override public void addToOntology() { OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DCTERMS + "creator")); OWLAnnotation creator = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getCreator())); addChangeToOntology(new AddOntologyAnnotation(ontology, creator)); }
public void addModelAnnotations(ModelContainer model, Collection<OWLAnnotation> annotations, METADATA metadata) { OWLOntology aBox = model.getAboxOntology(); List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLAnnotation annotation : annotations) { changes.add(new AddOntologyAnnotation(aBox, annotation)); } applyChanges(model, changes, metadata); }
public void updateAnnotation(ModelContainer model, OWLAnnotation update, METADATA metadata) { OWLOntology aBox = model.getAboxOntology(); List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); Set<OWLAnnotation> existing = model.getAboxOntology().getAnnotations(); OWLAnnotationProperty target = update.getProperty(); for (OWLAnnotation annotation : existing) { if (target.equals(annotation.getProperty())) { changes.add(new RemoveOntologyAnnotation(aBox, annotation)); } } changes.add(new AddOntologyAnnotation(aBox, update)); applyChanges(model, changes, metadata); }
private void addCommentToOntology(OWLOntology ont, String cmt) { OWLDataFactory df = getDataFactory(); OWLAnnotationProperty p = df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT.getIRI()); OWLLiteral v = df.getOWLLiteral(cmt); OWLAnnotation ann = df.getOWLAnnotation(p, v); AddOntologyAnnotation addAnn = new AddOntologyAnnotation(ont, ann); getManager().applyChange(addAnn); }
/** * Convenience method for adding an annotation assertion to the * ontology itself, taking a CURIE for the property and an Boolean literal. * * @param ontology the current ontology * @param propertyCURIE will be expanded to the full annotation * property IRI * @param value the literal value of the annotation * @return the annotation axiom */ protected static OWLAnnotation annotate(OWLOntology ontology, String propertyCURIE, IRI value) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory dataFactory = manager.getOWLDataFactory(); IRI iri = format.getIRI(propertyCURIE); OWLAnnotationProperty property = dataFactory.getOWLAnnotationProperty(iri); OWLAnnotation annotation = dataFactory.getOWLAnnotation( property, value); manager.applyChange( new AddOntologyAnnotation(ontology, annotation)); return annotation; }
/** * Convenience method for adding an annotation assertion to the * ontology itself, taking a CURIE for the property and an Boolean literal. * * @param ontology the current ontology * @param propertyCURIE will be expanded to the full annotation * property IRI * @param value the literal value of the annotation * @return the annotation axiom */ protected static OWLAnnotation annotate(OWLOntology ontology, String propertyCURIE, String value) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory dataFactory = manager.getOWLDataFactory(); IRI iri = format.getIRI(propertyCURIE); OWLAnnotationProperty property = dataFactory.getOWLAnnotationProperty(iri); OWLLiteral literal = dataFactory.getOWLLiteral(value); OWLAnnotation annotation = dataFactory.getOWLAnnotation( property, literal); manager.applyChange( new AddOntologyAnnotation(ontology, annotation)); return annotation; }
/** * Instantiates a {@link OWLExporter} from the specified parameters. * * @param fileOutputStream the file output stream * @throws Exception if something goes wrong in constructor */ public OWLExporter(OutputStream fileOutputStream) throws Exception { dos = new DataOutputStream(new BufferedOutputStream(fileOutputStream)); if (snomed == null) { // Create a new ontology snomed = manager .createOntology(new OWLOntologyID(snomedIRI, snomedVersionIRI)); format.setParameter("xml:base", snomedNamespace); // Obtain SNOMED root concept // TODO: this needs to be generalized UUID snomedRootUUID = Taxonomies.SNOMED.getUuids()[0]; ConceptVersionBI snomedRootConcept = OTFUtility.getConceptVersion(snomedRootUUID); // Add annotation based on root concept for (DescriptionVersionBI<?> desc : snomedRootConcept .getDescriptionsActive()) { if (desc.getText().contains("Release")) { manager.applyChange(new AddOntologyAnnotation(snomed, factory .getOWLAnnotation(factory .getOWLAnnotationProperty(OWLRDFVocabulary.OWL_VERSION_INFO .getIRI()), factory.getOWLLiteral(desc.getText())))); } if (desc.getText().contains("IHTSDO")) { manager.applyChange(new AddOntologyAnnotation(snomed, factory .getOWLAnnotation(factory .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT .getIRI()), factory.getOWLLiteral(desc.getText())))); } } manager.applyChange(new AddOntologyAnnotation(snomed, factory .getOWLAnnotation(factory .getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()), factory.getOWLLiteral(snomedOntologyName)))); } }
public OWLOntologyChange visit(AddOntologyAnnotation addOntologyAnnotation) { return new RemoveOntologyAnnotation(addOntologyAnnotation.getOntology(), addOntologyAnnotation.getAnnotation()); }
public OWLOntologyChange visit(RemoveOntologyAnnotation removeOntologyAnnotation) { return new AddOntologyAnnotation(removeOntologyAnnotation.getOntology(), removeOntologyAnnotation.getAnnotation()); }
public void ontologiesChanged(List<? extends OWLOntologyChange> changes) throws OWLException { for (OWLOntologyChange change : changes) if (!(change instanceof RemoveOntologyAnnotation || change instanceof AddOntologyAnnotation)) m_pendingChanges.add(change); }
@Override public void visit(AddOntologyAnnotation change) { defaultVisit(change); }
private void addComment(String comment, OWLOntology ontology) { final OWLOntologyManager manager = ontology.getOWLOntologyManager(); final OWLDataFactory factory = manager.getOWLDataFactory(); OWLAnnotation ontAnn = factory.getOWLAnnotation(factory.getRDFSComment(), factory.getOWLLiteral(comment)); manager.applyChange(new AddOntologyAnnotation(ontology, ontAnn)); }
@Override public Boolean visit(AddOntologyAnnotation change) { Objects.requireNonNull(change); return false; }
public void addAnnotationToOntology(String annotation, String value) { OWLDataFactory factory = manager.getOWLDataFactory(); final OWLAnnotationProperty owlAnnotationProperty = factory .getOWLAnnotationProperty(IRI.create(annotation)); final OWLAnnotationValue supportOntologyAnnValue = factory .getOWLLiteral(value, OWL2Datatype.RDF_PLAIN_LITERAL); final OWLAnnotation owlAnnotation = factory.getOWLAnnotation( owlAnnotationProperty, supportOntologyAnnValue); manager.applyChange(new AddOntologyAnnotation(getOntology(), owlAnnotation)); }