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

Removing self-xrefs from release #1665

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion src/ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,14 @@ release: $(BUILDDIR)/$(ONT).owl $(BUILDDIR)/$(ONT).obo $(BUILDDIR)/$(ONT).json $

$(BUILDDIR)/$(ONT).owl: $(SRC)
$(ROBOT) merge -i $< \
query \
--update ../sparql/inject-subset-declaration.sparql \
--update ../sparql/remove-internal-xrefs.sparql \
reason -s true -m false -r hermit \
annotate -a owl:versionInfo `cat version.txt` -a rdfs:comment `date +%Y-%m-%d` -O $(BASE)/$(ONT).owl -V $(BASE)/releases/v`cat version.txt`/$(ONT).owl -o $@

$(BUILDDIR)/$(ONT).obo: $(BUILDDIR)/$(ONT).owl
$(ROBOT) annotate -i $< --ontology-iri http://www.ebi.ac.uk/efo/efo.owl --version-iri http://www.ebi.ac.uk/efo/releases/v`cat version.txt`/efo.owl \
query --update ../sparql/inject-subset-declaration.sparql \
convert --check false -f obo -o $@

$(BUILDDIR)/$(ONT).json: $(BUILDDIR)/$(ONT).owl
Expand Down
51 changes: 51 additions & 0 deletions src/sparql/remove-internal-xrefs.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix oio: <http://www.geneontology.org/formats/oboInOwl#>

DELETE {
?axiom owl:annotatedSource ?cls ;
owl:annotatedProperty oio:hasDbXref ;
owl:annotatedTarget ?obj_curie ;
?x ?y .
?cls oio:hasDbXref ?obj_curie .
}
#SELECT DISTINCT ?cls ?obj_curie ?obj_iri
WHERE {
?cls a owl:Class ;
oio:hasDbXref ?obj_curie .

FILTER(REGEX(STR(?obj_curie),"^(GO|DOID|Orphanet|HP|MONDO|EFO):[0-9A-Za-z]+") || isURI(?obj_curie))

BIND(
URI(
IF(isURI(?obj_curie), ?obj_curie, REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(?obj_curie,
"GO:","http://purl.obolibrary.org/obo/GO_"),
"DOID:","http://purl.obolibrary.org/obo/DOID_"),
"Orphanet:","http://www.orpha.net/ORDO/Orphanet_"),
"HP:","http://purl.obolibrary.org/obo/HP_"),
"MONDO:","http://purl.obolibrary.org/obo/MONDO_"),
"EFO:","http://www.ebi.ac.uk/efo/EFO_")
)) as ?obj_iri)

OPTIONAL {
?axiom owl:annotatedSource ?cls ;
owl:annotatedProperty oio:hasDbXref ;
owl:annotatedTarget ?obj_curie ;
?x ?y .
OPTIONAL {
?axiom ?x1 ?y1 .
FILTER(?y!=?y1)
OPTIONAL {
?axiom ?x2 ?y2 .
FILTER(?y2!=?y1)
OPTIONAL {
?axiom ?x3 ?y3 .
FILTER(?y2!=?y3)
}
}
}
}

?obj_iri a owl:Class . ##<---TODO
}