我有一个SPARQL查询从DBPedia获取与疾病有关的维基百科文章列表,但结果不仅得到与疾病相关的文章,它还获得与它们无关的文章,甚至在健康。例如:
http://en.wikipedia.org/wiki/2010_in_film
http://en.wikipedia.org/wiki/2008_Western_Australian_gas_crisis
http://en.wikipedia.org/wiki/2003_Wimbledon_Championships_-_Women' s_Singles
http://en.wikipedia.org/wiki/1955_Hawaiian_submarine_eruption
等等
我的问题是,咨询是否正确?否则,这是在DBPedia中如何对某些文章进行分类的问题。这是查询:
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX category: <http://dbpedia.org/resource/Category:>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?d ?dn ?wikiPage ?icd9 ?icd10 ?disDB ?meshID ?mlp ?omim ?emed ?frbase
WHERE {
?d a <http://dbpedia.org/ontology/Disease>.
?d foaf:isPrimaryTopicOf ?wikiPage.
OPTIONAL { ?d <http://dbpedia.org/ontology/icd9> ?icd9. }
OPTIONAL { ?d <http://dbpedia.org/ontology/icd10> ?icd10. }
OPTIONAL { ?d <http://dbpedia.org/ontology/diseasesDb> ?disDB. }
OPTIONAL { ?d <http://dbpedia.org/ontology/meshId> ?meshID. }
OPTIONAL { ?d <http://dbpedia.org/property/medlineplus> ?mlp. }
OPTIONAL { ?d <http://dbpedia.org/ontology/omim> ?omim. }
OPTIONAL { ?d <http://dbpedia.org/property/emedicinetopic> ?emed.}
OPTIONAL {
?d owl:sameAs ?frbase.
FILTER(regex(str(?frbase),"freebase","i")).
}
OPTIONAL {
?d rdfs:label ?dn.
FILTER(lang(?dn) = 'en')
}
}