我有兴趣使用 DBPedia 和 SPARQL 查询疾病与医学专业的映射。我想编写一个返回疾病名称和相关医学专业名称的查询。
我知道我可以通过此查询获取疾病列表:
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT ?disease WHERE {
?disease a dbo:Disease .
}
ORDER BY ?disease
我怎样才能获得相关的医学专业?我是 SPARQL 和 DBPedia 的新手!
最佳答案
我测试过here ;以下查询应该给出您想要的内容:
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT ?disease ?med_spec WHERE {
?disease a dbo:Disease .
?disease dbp:field ?med_spec .
}
结果(仅举几个例子):
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)
关于sparql - 为 DBPedia 构建简单的 SPARQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49617994/