Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

robot extract/merge should optionally inject provenance #977

Merged
merged 20 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optimize memory usage for update queries using `--temporary-file` switch [#978]
- Sort [`report`] violations by rule name within level [#955]
- Allow any case builtin `TYPE` in `template` [#971]
- [`extract`] and [`merge`] should optionally inject provenance [#977]

### Fixed
- Fix subClassOf cycles in related object selection [#979]
Expand Down Expand Up @@ -309,6 +310,7 @@ First official release of ROBOT!

[#979]: https://github.com/ontodev/robot/pull/979
[#978]: https://github.com/ontodev/robot/pull/978
[#977]: https://github.com/ontodev/robot/pull/977
[#973]: https://github.com/ontodev/robot/pull/973
[#971]: https://github.com/ontodev/robot/pull/971
[#960]: https://github.com/ontodev/robot/pull/960
Expand Down
19 changes: 18 additions & 1 deletion docs/annotate.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

It's important to add metadata to an ontology before releasing it, and to update the ontology version IRI.

General annotations can be added one-by-one with `--anotation`, and the IRIs can be set with `--version-iri` and `--ontology-iri`. You can specify as many annotation flags as you'd like in one command:
General annotations can be added one-by-one with `--annotation`, and the IRIs can be set with `--version-iri` and `--ontology-iri`. You can specify as many annotation flags as you'd like in one command:

robot annotate --input edit.owl \
--ontology-iri "https://github.com/ontodev/robot/examples/annotated.owl" \
Expand Down Expand Up @@ -38,6 +38,23 @@ This command can also remove all ontology annotations from your file with `--rem
--annotation-file annotations.ttl \
--output results/annotated_2.owl


## Annotating the Source

It’s also possible to annotate the ontology axioms with the ontology IRI or version IRI.

* `--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 annotate --input example2.owl \
--annotate-derived-from true \
--output results/example2_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 annotate --input example2.owl \
--annotate-defined-by true \
--output results/example2_defined_by.owl

---

## Error Messages
Expand Down
173 changes: 173 additions & 0 deletions docs/examples/example2.owl
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0"?>
<rdf:RDF xmlns="https://github.com/ontodev/robot/examples/edit.owl#"
xml:base="https://github.com/ontodev/robot/examples/edit.owl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:oboInOwl="http://www.geneontology.org/formats/oboInOwl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:obo="http://purl.obolibrary.org/obo/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:prov="http://www.w3.org/ns/prov#">
<owl:Ontology rdf:about="https://github.com/ontodev/robot/examples/edit.owl">
<owl:versionIRI rdf:resource="https://github.com/ontodev/robot/examples/2022-03-11/edit.owl"/>
<rdfs:comment>Comment from annotations.ttl file.</rdfs:comment>
</owl:Ontology>



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

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

<owl:AnnotationProperty rdf:about="http://www.w3.org/ns/prov#wasDerivedFrom"/>


<!-- http://purl.obolibrary.org/obo/IAO_0000115 -->

<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000115">
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">definition</rdfs:label>
</owl:AnnotationProperty>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
<owl:annotatedProperty rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<owl:annotatedTarget rdf:resource="http://www.w3.org/2002/07/owl#AnnotationProperty"/>
<prov:wasDerivedFrom rdf:resource="https://github.com/ontodev/robot/some_other_ont.owl"/>
</owl:Axiom>



<!-- http://purl.obolibrary.org/obo/IAO_0000116 -->

<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000116">
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">uberon</oboInOwl:hasOBONamespace>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">editor note</rdfs:label>
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/some_other_ont.owl"/>
</owl:AnnotationProperty>



<!-- http://purl.obolibrary.org/obo/IAO_0000232 -->

<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000232">
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">uberon</oboInOwl:hasOBONamespace>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">curator notes</rdfs:label>
</owl:AnnotationProperty>



<!-- http://www.geneontology.org/formats/oboInOwl#hasAlternativeId -->

<owl:AnnotationProperty rdf:about="http://www.geneontology.org/formats/oboInOwl#hasAlternativeId"/>




<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->




<!-- http://purl.obolibrary.org/obo/BFO_0000050 -->

<owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/BFO_0000050">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">part_of</rdfs:label>
</owl:ObjectProperty>



<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->




<!-- http://purl.obolibrary.org/obo/UBERON_0000061 -->

<owl:Class rdf:about="http://purl.obolibrary.org/obo/UBERON_0000061">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000465"/>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">anatomical structure</rdfs:label>
<rdfs:isDefinedBy rdf:resource="https://github.com/ontodev/robot/examples/some_other_ont.owl"/>
</owl:Class>



<!-- http://purl.obolibrary.org/obo/UBERON_0000062 -->

<owl:Class rdf:about="http://purl.obolibrary.org/obo/UBERON_0000062">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/UBERON_0010000"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://purl.obolibrary.org/obo/BFO_0000050"/>
<owl:someValuesFrom rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000467"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">organ</rdfs:label>
</owl:Class>


<owl:NamedIndividual rdf:about="http://purl.obolibrary.org/obo/UBERON_0013702_indv1">
<rdfs:isDefinedBy rdf:resource="http://purl.obolibrary.org/obo/pcl/some_other_ont.owl"/>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">dummy individal 1</rdfs:label>
</owl:NamedIndividual>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0013702_indv1"/>
<owl:annotatedProperty rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<owl:annotatedTarget rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
<prov:wasDerivedFrom rdf:resource="https://github.com/ontodev/robot/examples/2022-03-11/some_other_ontology.owl"/>
</owl:Axiom>

<owl:NamedIndividual rdf:about="http://purl.obolibrary.org/obo/UBERON_0013702_indv2">
<rdfs:isDefinedBy rdf:resource="http://purl.obolibrary.org/obo/pcl/some_other_ont.owl"/>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">dummy individal 2</rdfs:label>
</owl:NamedIndividual>

<owl:NamedIndividual rdf:about="http://purl.obolibrary.org/obo/UBERON_0013702_indv3">
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">dummy individal 3</rdfs:label>
</owl:NamedIndividual>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0013702_indv3"/>
<owl:annotatedProperty rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<owl:annotatedTarget rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
<prov:wasDerivedFrom rdf:resource="https://github.com/ontodev/robot/examples/2022-03-11/some_other_ontology.owl"/>
</owl:Axiom>

<owl:NamedIndividual rdf:about="http://purl.obolibrary.org/obo/UBERON_0013702_indv4">
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">dummy individal 4</rdfs:label>
</owl:NamedIndividual>

<owl:NamedIndividual rdf:about="http://purl.obolibrary.org/obo/UBERON_0013702_indv5">
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">dummy individal 5</rdfs:label>
</owl:NamedIndividual>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0013702_indv5"/>
<owl:annotatedProperty rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<owl:annotatedTarget rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</owl:Axiom>


</rdf:RDF>



<!-- Generated by the OWL API (version 0.0.1-SNAPSHOT) https://github.com/owlcs/owlapi -->

Loading