Open daniwelter opened 3 weeks ago
I bet this PR is somehow related to this issue: https://github.com/ontodev/robot/pull/1104, but I am not sure. Timeline fits.
I am having the same problem. See https://github.com/PlantPhenoOntology/ppo/blob/odk-conversion/src/ontology/components/PPO_plant_structures.owl. The template is at https://github.com/PlantPhenoOntology/ppo/blob/odk-conversion/src/templates/PPO_plant_structures.tsv
I am using the latest ODK.
I can't replace RO:0000086 with 'has quality' as @daniwelter was able to do, because of the problem described in #1053.
Feeling sad.
Hi @ramonawalls. You should not need to use CURIEs everywhere in your templates. ROBOT is much happier if you use labels. And you should not need to quote labels most of the time -- only when they occur inside a logical expression. OBI has many examples: https://github.com/obi-ontology/obi/tree/master/src/ontology/templates.
In order to parse templates (whether labels or CURIEs) ROBOT needs to know that you're using Object Properties or Data Properties or Annotation Properties or Classes, etc. That's why the --input foo.owl
option is important.
Thank you again! I'm noting issue #442 so the examples only have to be in one place.
@jamesaoverton, could you please provide links to the corresponding input files used in the OBI examples?
This command runs the various OBI templates: https://github.com/obi-ontology/obi/blob/master/Makefile#L92. It imports obi-edit.owl
, which imports most of OBI, including previous template results. @matentzn can also provide many examples.
@matentzn here is an example of a template that generates duplicate datatypes and the corresponding OWL file:
https://github.com/PlantPhenoOntology/ppo/blob/odk-conversion/src/templates/PPO_plant_structures.tsv
A couple more points.
I updated my ppo-odk.yaml to include
- filename: PPO_plant_structures.owl
use_template: TRUE
template_options: --add-prefixes config/context.json --input https://raw.githubusercontent.com/PlantPhenoOntology/ppo/master/releases/2019-01-16/ppo.owl
templates:
- PPO_plant_structures.tsv
which generated the following robot command in my makefile
$(COMPONENTSDIR)/PPO_plant_structures.owl: $(TEMPLATEDIR)/PPO_plant_structures.tsv
if [ $(COMP) = true ] ; then $(ROBOT) template --add-prefixes config/context.json --input https://raw.githubusercontent.com/PlantPhenoOntology/ppo/master/releases/2019-01-16/ppo.owl \
$(patsubst %, --template %, $^) \
$(ANNOTATE_CONVERT_FILE); fi
.PRECIOUS: $(COMPONENTSDIR)/PPO_plant_structures.owl
but when I ran make all_components
nothing changed in PPO_plant_structures.owl.
I also tried copying the latest release of the file to my src/ontology directory and pointing at it
if [ true = true ] ; then robot --catalog catalog-v001.xml template --add-prefixes config/context.json --input ppo-input.owl \
--template ../templates/PPO_plant_structures.tsv \
annotate --ontology-iri http://purl.obolibrary.org/obo/ppo/components/PPO_plant_structures.owl annotate -V http://purl.obolibrary.org/obo/ppo/releases/2024-07-04/components/PPO_plant_structures.owl --annotation owl:versionInfo 2024-07-04 convert -f ofn --output components/PPO_plant_structures.owl.tmp.owl && mv components/PPO_plant_structures.owl.tmp.owl components/PPO_plant_structures.owl; fi
but it didn't make a difference.
There are good and bad news.
The bad news, the problem seems real:
robot template --input ontology.owl --template template.tsv -o out.owl
With:
template.tsv:
ID TYPE Subclass of
ID TYPE SC %
PPO:0001012 class (PPO:0000010 some PPO:0001004)
ontology.owl:
Prefix(:=<http://purl.obolibrary.org/obo/ppo.owl#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Ontology(<http://purl.obolibrary.org/obo/robot-issue-1203.owl>
Declaration(ObjectProperty(<http://purl.obolibrary.org/obo/PPO_0000010>))
)
results in:
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.w3.org/2002/07/owl#"
xml:base="http://www.w3.org/2002/07/owl"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
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#">
<Ontology/>
<rdfs:Datatype rdf:about="http://purl.obolibrary.org/obo/PPO_0001004"/>
<DatatypeProperty rdf:about="http://purl.obolibrary.org/obo/PPO_0000010"/>
{ REST OMITTED FOR BREVITY }....
It appears that the "oracle" (--input) does not work as intended.
Fortunately there is an easy fix, by simply asserting the type of the object property in the same template:
ID TYPE Subclass of
ID TYPE SC %
PPO:0000010 object property
PPO:0001012 class (PPO:0000010 some PPO:0001004)
It does not matter then wether you are using the --input parameter or not:
robot template --template template.tsv -o out.owl
Works as well.
Thank you, @matentzn! I'll give it a try.
It worked! Woohoo!
From the ROBOT Slack channel:
I'm having a weird issue with robot template since the last release. It's probably user error but since I upgraded to v1.9.6, any classes used in class expressions become duplicated as datatypes. This is an extract from my template file:
HANCESTRO:0010
turns out fine butHANCESTRO:0599
is now both a class and a datatype. I've tried various permutations, e.g. having a column header ofand then just
HANCESTRO:0599
in the cell, but the outcome is the same. I also double-checked some components that have been around for a while, and the problem occurs for these as well when it hasn't before (comparing with the current release version from April 2024).As per @jamesaoverton's suggestion, I then replaced
RO:0000086
with'has quality'
(and the same for any other object properties in my templates) and this fixed the issue.Problem replicated in release v1.9.6, 1.9.5 and 1.9.4. Last successful version uncertain but may have been 1.9.2 or 1.9.3.