测试是否缺少模式会返回与其匹配的三元组

时间:2019-04-23 20:35:51

标签: sparql rdf dbpedia

为什么查询的第一个结果是在值出现在页面上时都匹配两个测试的缺失?

#Leaders of Member states of the EU for which there is no value for gender or depiction in DBpedia

SELECT DISTINCT ?leader_No_gender ?leader_No_image

WHERE { 
?MS a dbo:Country; dct:subject <http://dbpedia.org/resource/Category:Member_states_of_the_European_Union>. 

{?MS dbo:leader ?leader_No_gender . 
FILTER NOT EXISTS {?leader_No_gender foaf:gender ?gender}
} 

UNION 

{?MS dbo:leader ?leader_No_image . 
FILTER NOT EXISTS {?leader_No_image foaf:depiction ?image}
} 
}

1 个答案:

答案 0 :(得分:1)

@AKSW property path-based queries建议将work on the latest Virtuoso Enterprise Edition (08.03.3312)用作DBpedia-Live的宿主。 (当然,这些结果与您在静态DBpedia上发现的结果有所不同,仍然基于2016-10数据集,并且仍在Virtuoso 07.20.3230上运行,后者仍然具有属性路径错误。)

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dct: <http://purl.org/dc/terms/>

SELECT DISTINCT 
  ?leader_No_gender 
  ?leader_No_image

WHERE 
  { 
    ?MS a           dbo:Country ; 
        dct:subject <http://dbpedia.org/resource/Category:Member_states_of_the_European_Union> . 

    { ?MS dbo:leader ?leader_No_gender . 
      FILTER NOT EXISTS { ?leader_No_gender dbo:wikiPageRedirects?/foaf:gender ?gender }
    } 

    UNION

    { ?MS dbo:leader ?leader_No_image . 
      FILTER NOT EXISTS { ?leader_No_image dbo:wikiPageRedirects?/foaf:depiction ?image }
    }
  }