Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
Last active October 27, 2017 11:11
Show Gist options
  • Save lucaswerkmeister/490bc69af38403ad2baba66ba99cf6b7 to your computer and use it in GitHub Desktop.
Save lucaswerkmeister/490bc69af38403ad2baba66ba99cf6b7 to your computer and use it in GitHub Desktop.
Shape Expression for Diseases in Wikidata
# Shape Expression for Diseases in Wikidata
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX do: <http://purl.obolibrary.org/obo/DOID_>
start = @<wikidata-disease>
<wikidata-disease> {
p:P31 { # instance of disease
ps:P31 [ wd:Q12136 ]; # instance of disease
$<has-do-reference> prov:wasDerivedFrom @<do-reference>;
} ;
p:P279 { # subclass of
ps:P279 @<wikidata-disease>;
&<has-do-reference>
} * ;
p:P2888 EXTRA prov:wasDerivedFrom { # exact match
ps:P2888 [ do:~ ];
prov:wasDerivedFrom @<do-reference> ?
} + ;
}
<do-reference> {
# stated in
pr:P248 @<version-disease-ontology> ;
# retrieved
pr:P813 xsd:dateTime ;
# Disease ontology ID
pr:P699 @<disease-ontology-id> ;
}
<disease-ontology-id> LITERAL /^DOID:[0-9]+$/
<version-disease-ontology> {
# edition or translation of Disease Ontology
p:P629 { ps:P629 [ wd:Q5282129 ] } ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment