1

I have a DBPedia resource as

http://dbpedia.org/page/London

. I would like to get French page of http://dbpedia.org/page/London using SPARQL. I have noticed that I can retrieve this information through owl:sameAs.

I am trying to write this query on http://dbpedia.org/sparql endpoint to retrieve http://fr.dbpedia.org/page/Londres page:

prefix owl: <http://www.w3.org/2002/07/owl#>
select ?resource where {
?resource owl:sameAs "http://dbpedia.org/page/London"
FILTER strStarts (?resource, "http://fr.dbpedia.org")

In particular, I thought to use "strStarts" property, because I have read this document: http://www.w3.org/TR/sparql11-query/#func-strstarts. This document says that "The STRSTARTS function corresponds to the XPath fn:starts-with function" and I thought to use this function to retrieve the triples that start with "http://fr.dbpedia.org".

But, from my query I don't get any result. Why? What am I doing wrong here?

4

1 回答 1

3

您的查询存在一些问题。首先,URI 不是字符串,因此您需要使用<http://dbpedia.org/page/London>而不是"http://dbpedia.org/page/London". 其次,这是伦敦的错误 URI。资源是<http://dbpedia.org/resource/London>。(是的,当您将其放入 Web 浏览器时,您会被重定向到…/page/London; 这不是资源的 URI。) URI 可以缩写为dbpedia:London公共端点上的。第三,由于 URI 不是字符串,因此您需要filter strstarts( str(?resource), … )显式获取 URI 的字符串形式。因此:

select ?resource where {
  ?resource owl:sameAs dbpedia:London
  filter strstarts(str(?resource), "http://fr.dbpedia.org")
}

SPARQL 结果

于 2014-07-01T12:42:56.340 回答