diff --git a/docs/examples/example2_defined_by.owl b/docs/examples/example2_defined_by.owl index d15c175ac..4d66ccc07 100644 --- a/docs/examples/example2_defined_by.owl +++ b/docs/examples/example2_defined_by.owl @@ -107,33 +107,7 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/merged_defined_by.owl b/docs/examples/merged_defined_by.owl index d988d4fa2..64b7d520e 100644 --- a/docs/examples/merged_defined_by.owl +++ b/docs/examples/merged_defined_by.owl @@ -107,25 +107,7 @@ - - - - - - - - - - - - diff --git a/docs/merge.md b/docs/merge.md index b8d1a80c8..d601de544 100644 --- a/docs/merge.md +++ b/docs/merge.md @@ -36,13 +36,17 @@ It’s also possible to annotate the imported or merged ontology axioms with the * `--annotate-derived-from true`: annotates all axioms with the source's version IRI if it exists, else with the ontology IRI, using `prov:wasDerivedFrom`. If the axiom already has an annotation using this property (`prov:wasDerivedFrom`), the existing annotation will be kept and no new annotation will be added. +``` robot merge --catalog catalog.xml \ --input imports-nucleus.owl \ --annotate-derived-from true \ --output results/merged_derived_from.owl +``` * `--annotate-defined-by true`: annotates all entities (class, data, annotation, object property and named individual declaration axioms) with the source's IRI using `rdfs:isDefinedBy`. If the term already has an annotation using this property (`rdfs:isDefinedBy`), the existing annotation will be kept and no new annotation will be added. +``` robot merge --input example2.owl --input merge.owl \ --annotate-defined-by true \ --output results/merged_defined_by.owl +``` diff --git a/robot-command/src/main/java/org/obolibrary/robot/AnnotateCommand.java b/robot-command/src/main/java/org/obolibrary/robot/AnnotateCommand.java index 8a9d3499b..114444cb8 100644 --- a/robot-command/src/main/java/org/obolibrary/robot/AnnotateCommand.java +++ b/robot-command/src/main/java/org/obolibrary/robot/AnnotateCommand.java @@ -318,7 +318,9 @@ public CommandState execute(CommandState state, String[] args) throws Exception OWLAnnotationProperty rdfsIsDefinedBy = ontology.getOWLOntologyManager().getOWLDataFactory().getRDFSIsDefinedBy(); for (OWLEntity owlEntity : ontology.getSignature()) { - OntologyHelper.addEntityAnnotation(ontology, owlEntity, rdfsIsDefinedBy, ontIRI, false); + if (!(owlEntity.isOWLDatatype() && owlEntity.asOWLDatatype().isBuiltIn())) { + OntologyHelper.addEntityAnnotation(ontology, owlEntity, rdfsIsDefinedBy, ontIRI, false); + } } } } diff --git a/robot-core/src/main/java/org/obolibrary/robot/MergeOperation.java b/robot-core/src/main/java/org/obolibrary/robot/MergeOperation.java index 92d1a13a4..08b4737da 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/MergeOperation.java +++ b/robot-core/src/main/java/org/obolibrary/robot/MergeOperation.java @@ -363,8 +363,10 @@ private static void annotateWithOntologyIRI( OWLAnnotationProperty rdfsIsDefinedBy = targetOntology.getOWLOntologyManager().getOWLDataFactory().getRDFSIsDefinedBy(); for (OWLEntity owlEntity : sourceOntology.getSignature(includeImportsClosure)) { - OntologyHelper.addEntityAnnotation( - targetOntology, owlEntity, rdfsIsDefinedBy, ontIRI, false); + if (!(owlEntity.isOWLDatatype() && owlEntity.asOWLDatatype().isBuiltIn())) { + OntologyHelper.addEntityAnnotation( + targetOntology, owlEntity, rdfsIsDefinedBy, ontIRI, false); + } } } } diff --git a/robot-core/src/test/java/org/obolibrary/robot/MergeOperationTest.java b/robot-core/src/test/java/org/obolibrary/robot/MergeOperationTest.java index 6bf104b2f..b43bc885a 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/MergeOperationTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/MergeOperationTest.java @@ -101,9 +101,9 @@ public void testMergeDefinedBy() throws IOException { assertEquals(5, simple.getAxiomCount()); OWLOntology merged = MergeOperation.merge(ontologies, false, false, true, false); - assertEquals(9, merged.getAxiomCount()); + assertEquals(8, merged.getAxiomCount()); OWLOntology expected = loadOntology("/simple_defined_by.owl"); - assertEquals(9, expected.getAxiomCount()); + assertEquals(8, expected.getAxiomCount()); assertIdentical(expected, merged); } } diff --git a/robot-core/src/test/resources/simple_defined_by.owl b/robot-core/src/test/resources/simple_defined_by.owl index 890c1075d..89ecdae4d 100644 --- a/robot-core/src/test/resources/simple_defined_by.owl +++ b/robot-core/src/test/resources/simple_defined_by.owl @@ -27,24 +27,6 @@ - - - - - - - - - - - -