query-58ecf21df3fdf641ceea7ab752ed8ee7
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
- https://query.wikidata.org/sparql
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" }
}