Skip to content

Commit

Permalink
resolves issue #1163
Browse files Browse the repository at this point in the history
  • Loading branch information
hkir-dev committed Dec 1, 2023
1 parent 4630074 commit 6408553
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 67 deletions.
26 changes: 0 additions & 26 deletions docs/examples/example2_defined_by.owl
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,7 @@
<owl:AnnotationProperty rdf:about="http://www.w3.org/ns/prov#wasDerivedFrom">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</owl:AnnotationProperty>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Datatypes
//
///////////////////////////////////////////////////////////////////////////////////////
-->




<!-- http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral -->

<rdf:Description rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



<!-- http://www.w3.org/2001/XMLSchema#string -->

<rdf:Description rdf:about="http://www.w3.org/2001/XMLSchema#string">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



Expand Down
18 changes: 0 additions & 18 deletions docs/examples/merged_defined_by.owl
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,7 @@
<owl:AnnotationProperty rdf:about="http://www.w3.org/ns/prov#wasDerivedFrom">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</owl:AnnotationProperty>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Datatypes
//
///////////////////////////////////////////////////////////////////////////////////////
-->




<!-- http://www.w3.org/2001/XMLSchema#string -->

<rdf:Description rdf:about="http://www.w3.org/2001/XMLSchema#string">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



Expand Down
4 changes: 4 additions & 0 deletions docs/merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
18 changes: 0 additions & 18 deletions robot-core/src/test/resources/simple_defined_by.owl
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,6 @@
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/robot-core/src/test/resources/simple.owl"/>
</rdf:Description>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Datatypes
//
///////////////////////////////////////////////////////////////////////////////////////
-->




<!-- http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral -->

<rdf:Description rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/robot-core/src/test/resources/simple.owl"/>
</rdf:Description>



Expand Down

0 comments on commit 6408553

Please sign in to comment.