Reputation: 23
I am interested in querying the mapping of diseases to medical specialties using DBPedia and SPARQL. I'd like to write a query that returns a disease name, and the associated medical specialty name.
I know I can get a list of diseases with this query:
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT ?disease WHERE {
?disease a dbo:Disease .
}
ORDER BY ?disease
How can I also get the associated medical specialty? I am new to SPARQL and DBPedia!
Upvotes: 2
Views: 302
Reputation: 25997
I tested it here; the following query should give what you want:
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT ?disease ?med_spec WHERE {
?disease a dbo:Disease .
?disease dbp:field ?med_spec .
}
That yields (just a few examples):
http://dbpedia.org/resource/Dengue_fever http://dbpedia.org/resource/Infectious_disease_(medical_specialty)
http://dbpedia.org/resource/Dermatitis http://dbpedia.org/resource/Dermatology
http://dbpedia.org/resource/Diabetes_insipidus http://dbpedia.org/resource/Endocrinology
http://dbpedia.org/resource/Diabetic_ketoacidosis http://dbpedia.org/resource/Endocrinology
http://dbpedia.org/resource/Diabetic_retinopathy http://dbpedia.org/resource/Ophthalmology
http://dbpedia.org/resource/Diarrhea http://dbpedia.org/resource/Gastroenterology
http://dbpedia.org/resource/Diarrhea http://dbpedia.org/resource/Infectious_disease_(medical_specialty)
Upvotes: 2