为什么这段代码除了标题之外没有返回任何内容?

时间:2018-03-22 14:25:27

标签: sparql rdf dbpedia

尝试在DBPEDIA上运行这段代码,除了标题之外,它不会返回任何内容。

PREFIX dbo: <http://dbpedia.org/ontology/>

SELECT ?diseasename ?personname where {
 ?disease a dbo:Disease .
 ?person dbo:deathCause ?disease .
 ?person rdfs:label ?personname FILTER (lang(?personname) = "en").
 ?disease rdfs:label ?diseasename FILTER (lang(?diseasename) = "en").
 ?disease rdfs:label ?diseasename FILTER (?diseasename = "Brain tumor")
}

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

试试这个 -

PREFIX dbo: <http://dbpedia.org/ontology/>

SELECT ?diseasename ?personname where {
   ?disease a dbo:Disease .
   ?person dbo:deathCause ?disease .
   ?person rdfs:label ?personname 
      FILTER (lang(?personname) = "en").
   ?disease rdfs:label ?diseasename 
      FILTER (lang(?diseasename) = "en").
   ?disease rdfs:label ?diseasename 
      FILTER (?diseasename = "Brain tumor"@en)
}

- 或者,注意上面查询模式中的冗余,这个 -

PREFIX dbo: <http://dbpedia.org/ontology/>

SELECT ?diseasename ?personname where {
   ?disease a dbo:Disease .
   ?person dbo:deathCause ?disease .
   ?person rdfs:label ?personname 
      FILTER (lang(?personname) = "en").
   ?disease rdfs:label ?diseasename 
      FILTER (?diseasename = "Brain tumor"@en)
}