Skip to content

Commit

Permalink
Merge pull request #1171 from hkir-dev/issue_1163
Browse files Browse the repository at this point in the history
annotate-defined-by parameter excludes datatypes
  • Loading branch information
jamesaoverton committed Dec 4, 2023
2 parents 182046b + 04a0052 commit 977bf65
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 146 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- '--annotate-with-source true' does not work with extract --method subset [#1160]
- Fix how Template adds entities to the QuotedEntityChecker [#1104]
- [`merge`] and 'annotate' operations '--annotate-defined-by' excludes reserved OWL 2 vocabularies [#1171]
- Handle IRIs that are not entities in export [#1168]

## [1.9.5] - 2023-09-20
Expand Down Expand Up @@ -381,6 +382,7 @@ First official release of ROBOT!
[`template`]: http://robot.obolibrary.org/template
[`validate`]: http://robot.obolibrary.org/validate

[#1171]: https://github.com/ontodev/robot/pull/1171
[#1168]: https://github.com/ontodev/robot/pull/1168
[#1160]: https://github.com/ontodev/robot/pull/1160
[#1148]: https://github.com/ontodev/robot/pull/1148
Expand Down
62 changes: 0 additions & 62 deletions docs/examples/example2_defined_by.owl
Original file line number Diff line number Diff line change
Expand Up @@ -78,62 +78,12 @@



<!-- http://www.w3.org/2000/01/rdf-schema#comment -->

<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#comment">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



<!-- http://www.w3.org/2000/01/rdf-schema#isDefinedBy -->

<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#isDefinedBy">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



<!-- http://www.w3.org/2000/01/rdf-schema#label -->

<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#label">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



<!-- http://www.w3.org/ns/prov#wasDerivedFrom -->

<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 Expand Up @@ -284,18 +234,6 @@
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
<rdfs:label>dummy individal 5</rdfs:label>
</owl:NamedIndividual>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Annotations
//
///////////////////////////////////////////////////////////////////////////////////////
-->

<rdf:Description rdf:about="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral"/>
</rdf:RDF>


Expand Down
42 changes: 0 additions & 42 deletions docs/examples/merged_defined_by.owl
Original file line number Diff line number Diff line change
Expand Up @@ -78,54 +78,12 @@



<!-- http://www.w3.org/2000/01/rdf-schema#comment -->

<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#comment">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



<!-- http://www.w3.org/2000/01/rdf-schema#isDefinedBy -->

<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#isDefinedBy">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



<!-- http://www.w3.org/2000/01/rdf-schema#label -->

<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#label">
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/edit.owl"/>
</rdf:Description>



<!-- http://www.w3.org/ns/prov#wasDerivedFrom -->

<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
2 changes: 2 additions & 0 deletions docs/merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ It’s also possible to annotate the imported or merged ontology axioms with the
robot merge --input example2.owl --input merge.owl \
--annotate-defined-by true \
--output results/merged_defined_by.owl

`--annotate-defined-by` excludes entities from the reserved OWL 2 vocabularies (RDF, RDFS, XSD and 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.getIRI().isReservedVocabulary()) {
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.getIRI().isReservedVocabulary()) {
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(7, merged.getAxiomCount());
OWLOntology expected = loadOntology("/simple_defined_by.owl");
assertEquals(9, expected.getAxiomCount());
assertEquals(7, expected.getAxiomCount());
assertIdentical(expected, merged);
}
}
37 changes: 0 additions & 37 deletions robot-core/src/test/resources/simple_defined_by.owl
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,6 @@
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="https://github.com/ontodev/robot/robot-core/src/test/resources/simple.owl"/>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Annotation properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->




<!-- http://www.w3.org/2000/01/rdf-schema#label -->

<rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#label">
<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 977bf65

Please sign in to comment.