org.semanticweb.owlapi.model.RemoveOntologyAnnotation Java Examples

The following examples show how to use org.semanticweb.owlapi.model.RemoveOntologyAnnotation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnmergeOperation.java    From robot with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Given a list of ontologies and a target ontology, remove all the axioms from the listed
 * ontologies and their import closure from the target ontology.
 *
 * @param ontologies the list of ontologies to unmerge
 * @param targetOntology the ontology to remove axioms from
 * @param includeAnnotations true if ontology annotations should be remove
 */
public static void unmergeFrom(
    List<OWLOntology> ontologies, OWLOntology targetOntology, boolean includeAnnotations) {
  for (OWLOntology ontology : ontologies) {
    logger.info("Removing axioms from: " + ontology);
    targetOntology.getOWLOntologyManager().removeAxioms(targetOntology, ontology.getAxioms());
    if (includeAnnotations) {
      for (OWLAnnotation annotation : ontology.getAnnotations()) {
        RemoveOntologyAnnotation remove =
            new RemoveOntologyAnnotation(targetOntology, annotation);
        targetOntology.getOWLOntologyManager().applyChange(remove);
      }
    }
    for (OWLOntology imported : ontology.getImportsClosure()) {
      targetOntology.getOWLOntologyManager().removeAxioms(targetOntology, imported.getAxioms());
    }
  }
}
 
Example #2
Source File: Mooncat.java    From owltools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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));
		}
	}
}
 
Example #3
Source File: OwlOntologyChangeProcessorVisitor.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(RemoveOntologyAnnotation change) {
	defaultVisit(change);
}