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

WIP: Measurement rewrite #682

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
28 changes: 28 additions & 0 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,31 @@ qc/uberon_diff.txt: qc/uberon_consider_terms.txt qc/uberon_current_terms.txt
diff -u $^ | grep '^-[^-]' | sed 's/^-//'

all_diffs: $(ENTITY_DIFF_FILES) $(DIFF_REPORTS_FILES)

# ----------------------------------------
# Custom SPARQL queries
# ----------------------------------------

#$(BUILDDIR)/$(ONT).owl:
# echo "Skipped."

$(BUILDDIR)/$(ONT)-mod.owl: $(BUILDDIR)/$(ONT).owl
$(ROBOT) remove -i $(BUILDDIR)/$(ONT).owl --term http://purl.obolibrary.org/obo/IAO_0000136 --term http://purl.obolibrary.org/obo/RO_0002314 -o $@

measurement_anatomy: $(BUILDDIR)/$(ONT).owl $(SPARQLDIR)/measurementisaboutanatomy.sparql
$(ROBOT) materialize -i $< -r ELK --term IAO:0000136 query --use-graphs true -q $(SPARQLDIR)/measurementisaboutanatomy.sparql [email protected]

measurement_grouping: $(BUILDDIR)/$(ONT).owl $(SPARQLDIR)/measurementgroupingclasses.sparql
$(ROBOT) materialize -i $< -r ELK --term IAO:0000136 query --use-graphs true -q $(SPARQLDIR)/measurementgroupingclasses.sparql [email protected]

$(BUILDDIR)/define_measurements.owl: $(BUILDDIR)/$(ONT).owl ../templates/definemeasurements.tsv
$(ROBOT) template -i $< --template ../templates/definemeasurements.tsv --prefix "EFO: http://www.ebi.ac.uk/efo/EFO_" --prefix "RO: http://purl.obolibrary.org/obo/RO_" --prefix "UBERON: http://purl.obolibrary.org/obo/UBERON_" -o $@

$(BUILDDIR)/$(ONT)-iipo.owl: $(BUILDDIR)/$(ONT).owl
$(ROBOT) materialize -i $< -r ELK --term IAO:0000136 query --use-graphs true --update $(SPARQLDIR)/updatemeasurementisaboutanatomytoinheresin.ru remove --term http://purl.obolibrary.org/obo/IAO_0000136 --output $@

$(BUILDDIR)/$(ONT)-iipo-def.owl: $(BUILDDIR)/$(ONT)-iipo.owl $(BUILDDIR)/define_measurements.owl
$(ROBOT) merge -i $< -i $(BUILDDIR)/define_measurements.owl reason -r HERMIT remove --term http://purl.obolibrary.org/obo/RO_0002314 -o $@

iipo_exp.txt: $(BUILDDIR)/$(ONT)-mod.owl $(BUILDDIR)/$(ONT)-iipo-def.owl
$(ROBOT) diff --left $(BUILDDIR)/$(ONT)-mod.owl --right $(BUILDDIR)/$(ONT)-iipo-def.owl -o $@
467 changes: 467 additions & 0 deletions src/ontology/measurement_anatomy.csv

Large diffs are not rendered by default.

Empty file.
12 changes: 12 additions & 0 deletions src/ontology/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
# Wrapper script for docker.
#
# This is used primarily for wrapping the GNU Make workflow.
# Instead of typing "make TARGET", type "./run.sh make TARGET".
# This will run the make workflow within a docker container.
#
# The assumption is that you are working in the src/ontology folder;
# we therefore map the whole repo (../..) to a docker volume.
#
# See README-editors.md for more details.
docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS='-Xmx8G' --rm -ti obolibrary/odkfull "$@"
18 changes: 18 additions & 0 deletions src/sparql/measurementgroupingclasses.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?measurement ?measurementlabel ?anatomy ?anatomylabel

WHERE {
?measurement rdfs:subClassOf ?x .
?x rdf:type owl:Restriction ;
owl:onProperty <http://purl.obolibrary.org/obo/IAO_0000136>;
owl:someValuesFrom ?anatomy .
?measurement rdfs:subClassOf* <http://www.ebi.ac.uk/efo/EFO_0001444> .
?anatomy rdfs:subClassOf* <http://purl.obolibrary.org/obo/UBERON_0001062> .
?measurement rdfs:label ?measurementlabel .
?anatomy rdfs:label ?anatomylabel .
FILTER(isIRI(?anatomy) && isIRI(?measurement)) .
FILTER(regex(str(?label)," measurement$"))
}
17 changes: 17 additions & 0 deletions src/sparql/measurementisaboutanatomy.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?measurement ?measurementlabel ?anatomy ?anatomylabel

WHERE {
?measurement rdfs:subClassOf ?x .
?x rdf:type owl:Restriction ;
owl:onProperty <http://purl.obolibrary.org/obo/IAO_0000136>;
owl:someValuesFrom ?anatomy .
?measurement rdfs:subClassOf* <http://www.ebi.ac.uk/efo/EFO_0001444> .
?anatomy rdfs:subClassOf* <http://purl.obolibrary.org/obo/UBERON_0001062> .
?measurement rdfs:label ?measurementlabel .
?anatomy rdfs:label ?anatomylabel .
FILTER(isIRI(?anatomy) && isIRI(?measurement))
}
29 changes: 29 additions & 0 deletions src/sparql/updatemeasurementisaboutanatomytoinheresin.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>


DELETE {
?measurement rdfs:subClassOf ?x .
?x rdf:type owl:Restriction ;
owl:onProperty <http://purl.obolibrary.org/obo/IAO_0000136>;
owl:someValuesFrom ?anatomy .
}
INSERT {
?measurement rdfs:subClassOf ?x .
?x rdf:type owl:Restriction ;
owl:onProperty <http://purl.obolibrary.org/obo/RO_0002314>;
owl:someValuesFrom ?anatomy .
}

WHERE {
?measurement rdfs:subClassOf ?x .
?x rdf:type owl:Restriction ;
owl:onProperty <http://purl.obolibrary.org/obo/IAO_0000136>;
owl:someValuesFrom ?anatomy .
?measurement rdfs:subClassOf* <http://www.ebi.ac.uk/efo/EFO_0001444> .
?anatomy rdfs:subClassOf* <http://purl.obolibrary.org/obo/UBERON_0001062> .
?measurement rdfs:label ?measurementlabel .
?anatomy rdfs:label ?anatomylabel .
FILTER(isIRI(?anatomy) && isIRI(?measurement))
}
5 changes: 5 additions & 0 deletions src/templates/definemeasurements.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ID Measurement definition
ID EC EFO:0001444 and ('inheres in part of' some %)
EFO:0004515 UBERON:0001015
EFO:0004464 UBERON:0000955
EFO:0004742 UBERON:0001008