private void removeDirectives() { // TODO decide: move the set of directives into a constant/static collection? Set<IRI> directivesIRIs = new HashSet<IRI>(); directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_LogicalDefinitionViewRelation.getIRI()); directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsEquivalent.getIRI()); directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsGenusDifferentia.getIRI()); directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsHasSubClass.getIRI()); directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsIsA.getIRI()); directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsRelationship.getIRI()); directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsReverseGenusDifferentia.getIRI()); OWLOntology o = graph.getSourceOntology(); for(OWLAnnotation ann : o.getAnnotations()) { final OWLAnnotationProperty property = ann.getProperty(); if (directivesIRIs.contains(property.getIRI())) { manager.applyChange(new RemoveOntologyAnnotation(o, ann)); } } }
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); }
public void removeAnnotations(ModelContainer model, Collection<OWLAnnotation> annotations, METADATA metadata) { OWLOntology aBox = model.getAboxOntology(); List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLAnnotation annotation : annotations) { changes.add(new RemoveOntologyAnnotation(aBox, annotation)); } applyChanges(model, changes, metadata); }
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(RemoveOntologyAnnotation change) { defaultVisit(change); }
@Override public Boolean visit(RemoveOntologyAnnotation change) { Objects.requireNonNull(change); return false; }