query-58ecf21df3fdf641ceea7ab752ed8ee7

rq turtle/ttl

MeSH Code tree handling for "health speciality" P672

C23 (clinical finding) suppressed

Set out in columns for QuickStatements, though itemLabel is not for that.

SELECT DISTINCT ?item ?itemLabel ?hs1 ?hs2 WHERE { ?item wdt:P31 wd:Q12136 . ?item wdt:P672 ?meshc . MINUS { ?item wdt:P1995 [ ]} BIND(IF (STRSTARTS(?meshc, 'C01.252'), "Q727028", 1/0) AS ?spec01a) #bacterial infectious disease BIND(IF (STRSTARTS(?meshc, 'C01.703'), "Q464067", 1/0) AS ?spec01b) #fungal infectious disease BIND(IF (STRSTARTS(?meshc, 'C02'), "Q1928978", 1/0) AS ?spec02) #viral infectious disease BIND(IF (STRSTARTS(?meshc, 'C03'), "Q1601794", 1/0) AS ?spec03) #parasitic infectious diseases BIND(IF (STRSTARTS(?meshc, 'C04'), "Q162555", 1/0) AS ?spec04) #oncology BIND(IF (STRSTARTS(?meshc, 'C05'), "Q4116663", 1/0) AS ?spec05) #musculoskeletal disorder BIND(IF (STRSTARTS(?meshc, 'C06'), "Q120569", 1/0) AS ?spec06) #gastroenterology BIND(IF (STRSTARTS(?meshc, 'C07'), "Q55082545", 1/0) AS ?spec07) #stomatognathic disease BIND(IF (STRSTARTS(?meshc, 'C08'), "Q203337", 1/0) AS ?spec08) #pulmonology BIND(IF (STRSTARTS(?meshc, 'C09'), "Q189553", 1/0) AS ?spec09) #otolaryngology BIND(IF (STRSTARTS(?meshc, 'C10'), "Q83042", 1/0) AS ?spec10) #neurology BIND(IF (STRSTARTS(?meshc, 'C11'), "Q161437", 1/0) AS ?spec11) #ophthalmology BIND(IF (STRSTARTS(?meshc, 'C12.294'), "Q6742925", 1/0) AS ?spec12a) #male reproductive system disease BIND(IF (STRSTARTS(?meshc, 'C12.777'), "Q7900883", 1/0) AS ?spec12b) #urinary system disease BIND(IF (STRSTARTS(?meshc, 'C13'), "Q80015", 1/0) AS ?spec13) #obstetrics gynecology BIND(IF (STRSTARTS(?meshc, 'C14'), "Q389735", 1/0) AS ?spec14) #cardiovascular disease BIND(IF (STRSTARTS(?meshc, 'C15.378'), "Q103824", 1/0) AS ?spec15a) #hematology BIND(IF (STRSTARTS(?meshc, 'C15.604'), "Q6708237", 1/0) AS ?spec15b) #lymphatic system disease BIND(IF (STRSTARTS(?meshc, 'C16.320'), "Q727096", 1/0) AS ?spec16a) #genetic disease BIND(IF (STRSTARTS(?meshc, 'C16.614'), "Q200779", 1/0) AS ?spec16b) #birth defect BIND(IF (STRSTARTS(?meshc, 'C17.3'), "Q1779300", 1/0) AS ?spec17a) #connective tissue disease BIND(IF (STRSTARTS(?meshc, 'C17.8'), "Q171171", 1/0) AS ?spec17b) #dermatology BIND(IF (STRSTARTS(?meshc, 'C18.452'), "Q2351083", 1/0) AS ?spec18a) #disease of metabolism BIND(IF (STRSTARTS(?meshc, 'C18.654'), "Q1361144", 1/0) AS ?spec18b) #nutrition disorder BIND(IF (STRSTARTS(?meshc, 'C19'), "Q162606", 1/0) AS ?spec19) #endocrinology BIND(IF (STRSTARTS(?meshc, 'C20'), "Q101929", 1/0) AS ?spec20) #immunology BIND(IF (STRSTARTS(?meshc, 'C21'), "Q3751709", 1/0) AS ?spec21) #environmental disease BIND(IF (STRSTARTS(?meshc, 'C22'), "Q170201", 1/0) AS ?spec22) #veterinary medicine

BIND(COALESCE(?spec01a,?spec01b,?spec02,?spec03,?spec04,?spec05,?spec06,?spec07,?spec08,?spec09,?spec10,?spec11,?spec12a,?spec12b,?spec13,?spec14,?spec15a,?spec15b,?spec16a,?spec16b,?spec17a,?spec17b,?spec18a,?spec18b,?spec19,?spec20,?spec21,?spec22,000000) AS ?hs2)

VALUES ?hs1 { "P1995" } VALUES ?hs2 { "Q727028" "Q464067" "Q1928978" "Q1601794" "Q162555" "Q4116663" "Q120569" "Q55082545" "Q203337" "Q189553" "Q83042" "Q161437" "Q6742925" "Q7900883" "Q80015" "Q389735" "Q103824" "Q6708237" "Q727096" "Q200779" "Q1779300" "Q171171" "Q2351083" "Q1361144" "Q162606" "Q101929" "Q3751709" "Q170201" } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#MeSH Code tree handling for "health speciality" P672
#C23 (clinical finding) suppressed
#Set out in columns for QuickStatements, though itemLabel is not for that.
SELECT DISTINCT ?item ?itemLabel ?hs1 ?hs2
WHERE {
 ?item wdt:P31 wd:Q12136 .
  ?item wdt:P672 ?meshc  .
  MINUS { ?item wdt:P1995 [ ]}
  BIND(IF (STRSTARTS(?meshc, 'C01.252'), "Q727028", 1/0) AS ?spec01a)  #bacterial infectious disease
  BIND(IF (STRSTARTS(?meshc, 'C01.703'), "Q464067", 1/0) AS ?spec01b)  #fungal infectious disease
  BIND(IF (STRSTARTS(?meshc, 'C02'), "Q1928978", 1/0) AS ?spec02)  #viral infectious disease
  BIND(IF (STRSTARTS(?meshc, 'C03'), "Q1601794", 1/0) AS ?spec03) #parasitic infectious diseases
  BIND(IF (STRSTARTS(?meshc, 'C04'), "Q162555", 1/0) AS ?spec04) #oncology
  BIND(IF (STRSTARTS(?meshc, 'C05'), "Q4116663", 1/0) AS ?spec05) #musculoskeletal disorder
  BIND(IF (STRSTARTS(?meshc, 'C06'), "Q120569", 1/0) AS ?spec06) #gastroenterology
  BIND(IF (STRSTARTS(?meshc, 'C07'), "Q55082545", 1/0) AS ?spec07) #stomatognathic disease
  BIND(IF (STRSTARTS(?meshc, 'C08'), "Q203337", 1/0) AS ?spec08) #pulmonology
  BIND(IF (STRSTARTS(?meshc, 'C09'), "Q189553", 1/0) AS ?spec09) #otolaryngology
  BIND(IF (STRSTARTS(?meshc, 'C10'), "Q83042", 1/0) AS ?spec10) #neurology
  BIND(IF (STRSTARTS(?meshc, 'C11'), "Q161437", 1/0) AS ?spec11) #ophthalmology 
  BIND(IF (STRSTARTS(?meshc, 'C12.294'), "Q6742925", 1/0) AS ?spec12a) #male reproductive system disease
  BIND(IF (STRSTARTS(?meshc, 'C12.777'), "Q7900883", 1/0) AS ?spec12b) #urinary system disease
  BIND(IF (STRSTARTS(?meshc, 'C13'), "Q80015", 1/0) AS ?spec13) #obstetrics gynecology
  BIND(IF (STRSTARTS(?meshc, 'C14'), "Q389735", 1/0) AS ?spec14) #cardiovascular disease
  BIND(IF (STRSTARTS(?meshc, 'C15.378'), "Q103824", 1/0) AS ?spec15a) #hematology
  BIND(IF (STRSTARTS(?meshc, 'C15.604'), "Q6708237", 1/0) AS ?spec15b) #lymphatic system disease
  BIND(IF (STRSTARTS(?meshc, 'C16.320'), "Q727096", 1/0) AS ?spec16a) #genetic disease
  BIND(IF (STRSTARTS(?meshc, 'C16.614'), "Q200779", 1/0) AS ?spec16b) #birth defect
  BIND(IF (STRSTARTS(?meshc, 'C17.3'), "Q1779300", 1/0) AS ?spec17a) #connective tissue disease
  BIND(IF (STRSTARTS(?meshc, 'C17.8'), "Q171171", 1/0) AS ?spec17b) #dermatology
  BIND(IF (STRSTARTS(?meshc, 'C18.452'), "Q2351083", 1/0) AS ?spec18a) #disease of metabolism 
  BIND(IF (STRSTARTS(?meshc, 'C18.654'), "Q1361144", 1/0) AS ?spec18b) #nutrition disorder
  BIND(IF (STRSTARTS(?meshc, 'C19'), "Q162606", 1/0) AS ?spec19) #endocrinology
  BIND(IF (STRSTARTS(?meshc, 'C20'), "Q101929", 1/0) AS ?spec20) #immunology
  BIND(IF (STRSTARTS(?meshc, 'C21'), "Q3751709", 1/0) AS ?spec21) #environmental disease
  BIND(IF (STRSTARTS(?meshc, 'C22'), "Q170201", 1/0) AS ?spec22) #veterinary medicine

  BIND(COALESCE(?spec01a,?spec01b,?spec02,?spec03,?spec04,?spec05,?spec06,?spec07,?spec08,?spec09,?spec10,?spec11,?spec12a,?spec12b,?spec13,?spec14,?spec15a,?spec15b,?spec16a,?spec16b,?spec17a,?spec17b,?spec18a,?spec18b,?spec19,?spec20,?spec21,?spec22,000000) AS ?hs2)

  VALUES ?hs1 { "P1995" }
  VALUES ?hs2 { "Q727028" "Q464067" "Q1928978" "Q1601794" "Q162555" "Q4116663" "Q120569" "Q55082545" "Q203337" "Q189553" "Q83042" "Q161437" "Q6742925" "Q7900883" "Q80015" "Q389735"  "Q103824" "Q6708237" "Q727096" "Q200779" "Q1779300" "Q171171" "Q2351083" "Q1361144" "Q162606" "Q101929" "Q3751709" "Q170201" }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v32("?hs1"):::projected v33("?hs2"):::projected v1("?item"):::projected v2("?meshc") v3("?spec01a") v4("?spec01b") v5("?spec02") v6("?spec03") v7("?spec04") v8("?spec05") v9("?spec06") v10("?spec07") v11("?spec08") v12("?spec09") v13("?spec10") v14("?spec11") v15("?spec12a") v16("?spec12b") v17("?spec13") v18("?spec14") v19("?spec15a") v20("?spec15b") v21("?spec16a") v22("?spec16b") v23("?spec17a") v24("?spec17b") v25("?spec18a") v26("?spec18b") v27("?spec19") v28("?spec20") v29("?spec21") v30("?spec22") a1((" ")) c6(["bd:serviceParam"]):::iri c8(["en"]):::literal c2(["wd:Q12136"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P672"--> v2 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P1995"--> a1 end bind1[/"if(starts-with(?meshc,'C01.252'),'Q727028','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind1 bind1 --as--o v3 bind2[/"if(starts-with(?meshc,'C01.703'),'Q464067','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind2 bind2 --as--o v4 bind3[/"if(starts-with(?meshc,'C02'),'Q1928978','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind3 bind3 --as--o v5 bind4[/"if(starts-with(?meshc,'C03'),'Q1601794','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind4 bind4 --as--o v6 bind5[/"if(starts-with(?meshc,'C04'),'Q162555','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind5 bind5 --as--o v7 bind6[/"if(starts-with(?meshc,'C05'),'Q4116663','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind6 bind6 --as--o v8 bind7[/"if(starts-with(?meshc,'C06'),'Q120569','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind7 bind7 --as--o v9 bind8[/"if(starts-with(?meshc,'C07'),'Q55082545','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind8 bind8 --as--o v10 bind9[/"if(starts-with(?meshc,'C08'),'Q203337','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind9 bind9 --as--o v11 bind10[/"if(starts-with(?meshc,'C09'),'Q189553','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind10 bind10 --as--o v12 bind11[/"if(starts-with(?meshc,'C10'),'Q83042','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind11 bind11 --as--o v13 bind12[/"if(starts-with(?meshc,'C11'),'Q161437','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind12 bind12 --as--o v14 bind13[/"if(starts-with(?meshc,'C12.294'),'Q6742925','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind13 bind13 --as--o v15 bind14[/"if(starts-with(?meshc,'C12.777'),'Q7900883','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind14 bind14 --as--o v16 bind15[/"if(starts-with(?meshc,'C13'),'Q80015','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind15 bind15 --as--o v17 bind16[/"if(starts-with(?meshc,'C14'),'Q389735','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind16 bind16 --as--o v18 bind17[/"if(starts-with(?meshc,'C15.378'),'Q103824','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind17 bind17 --as--o v19 bind18[/"if(starts-with(?meshc,'C15.604'),'Q6708237','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind18 bind18 --as--o v20 bind19[/"if(starts-with(?meshc,'C16.320'),'Q727096','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind19 bind19 --as--o v21 bind20[/"if(starts-with(?meshc,'C16.614'),'Q200779','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind20 bind20 --as--o v22 bind21[/"if(starts-with(?meshc,'C17.3'),'Q1779300','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind21 bind21 --as--o v23 bind22[/"if(starts-with(?meshc,'C17.8'),'Q171171','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind22 bind22 --as--o v24 bind23[/"if(starts-with(?meshc,'C18.452'),'Q2351083','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind23 bind23 --as--o v25 bind24[/"if(starts-with(?meshc,'C18.654'),'Q1361144','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind24 bind24 --as--o v26 bind25[/"if(starts-with(?meshc,'C19'),'Q162606','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind25 bind25 --as--o v27 bind26[/"if(starts-with(?meshc,'C20'),'Q101929','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind26 bind26 --as--o v28 bind27[/"if(starts-with(?meshc,'C21'),'Q3751709','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind27 bind27 --as--o v29 bind28[/"if(starts-with(?meshc,'C22'),'Q170201','1^^xsd:integer' / '0^^xsd:integer')"/] v2 --o bind28 bind28 --as--o v30 bind29[/"?spec01a?spec01b?spec02?spec03?spec04?spec05?spec06?spec07?spec08?spec09?spec10?spec11?spec12a?spec12b?spec13?spec14?spec15a?spec15b?spec16a?spec16b?spec17a?spec17b?spec18a?spec18b?spec19?spec20?spec21?spec22'000000^^xsd:integer'"/] v3 --o bind29 v4 --o bind29 v5 --o bind29 v6 --o bind29 v7 --o bind29 v8 --o bind29 v9 --o bind29 v10 --o bind29 v11 --o bind29 v12 --o bind29 v13 --o bind29 v14 --o bind29 v15 --o bind29 v16 --o bind29 v17 --o bind29 v18 --o bind29 v19 --o bind29 v20 --o bind29 v21 --o bind29 v22 --o bind29 v23 --o bind29 v24 --o bind29 v25 --o bind29 v26 --o bind29 v27 --o bind29 v28 --o bind29 v29 --o bind29 v30 --o bind29 bind29 --as--o v33 bind30[/VALUES ?hs1/] bind30-->v32 bind300(["P1995"]) bind300 --> bind30 bind31[/VALUES ?hs2/] bind31-->v33 bind310(["Q727028"]) bind310 --> bind31 bind311(["Q464067"]) bind311 --> bind31 bind312(["Q1928978"]) bind312 --> bind31 bind313(["Q1601794"]) bind313 --> bind31 bind314(["Q162555"]) bind314 --> bind31 bind315(["Q4116663"]) bind315 --> bind31 bind316(["Q120569"]) bind316 --> bind31 bind317(["Q55082545"]) bind317 --> bind31 bind318(["Q203337"]) bind318 --> bind31 bind319(["Q189553"]) bind319 --> bind31 bind3110(["Q83042"]) bind3110 --> bind31 bind3111(["Q161437"]) bind3111 --> bind31 bind3112(["Q6742925"]) bind3112 --> bind31 bind3113(["Q7900883"]) bind3113 --> bind31 bind3114(["Q80015"]) bind3114 --> bind31 bind3115(["Q389735"]) bind3115 --> bind31 bind3116(["Q103824"]) bind3116 --> bind31 bind3117(["Q6708237"]) bind3117 --> bind31 bind3118(["Q727096"]) bind3118 --> bind31 bind3119(["Q200779"]) bind3119 --> bind31 bind3120(["Q1779300"]) bind3120 --> bind31 bind3121(["Q171171"]) bind3121 --> bind31 bind3122(["Q2351083"]) bind3122 --> bind31 bind3123(["Q1361144"]) bind3123 --> bind31 bind3124(["Q162606"]) bind3124 --> bind31 bind3125(["Q101929"]) bind3125 --> bind31 bind3126(["Q3751709"]) bind3126 --> bind31 bind3127(["Q170201"]) bind3127 --> bind31 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end