Last active
December 6, 2016 13:20
-
-
Save KonradHoeffner/a351f5c119d992f7ed765de6ed695fb5 to your computer and use it in GitHub Desktop.
select_snik_triplecheckmate_class_table.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove leading zeroes and non-numerical characters from hash | |
# take first 9 numbers so it fits into a 32 bit integer | |
select distinct (substr(replace(replace(md5(?curi),"[a-f]",""),"^0+",""),1,9) as ?cid) ?curi replace(replace(str(?curi),"^([^/]*/){4}",""),"/",":") as ?cname (substr(replace(replace(md5(sample(?parent)),"[a-f]",""),"^0+",""),1,9) as ?cparent) (count(?child) as ?count_cache) (if(count(?child)=0,1,0) as ?is_leaf) | |
{ | |
?curi a owl:Class. | |
OPTIONAL { graph ?g {?curi rdfs:subClassOf ?parent.}} | |
filter(?g!=<http://snik.eu/ontology/virtual>) | |
OPTIONAL { {?child rdfs:subClassOf ?curi.} UNION {?child a ?curi.}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment