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?

Musich87
  • 562
  • 1
  • 12
  • 31

1 Answers1

3

There are a few problems in your query. First, URIs are not strings, so you'd need to use <http://dbpedia.org/page/London> rather than "http://dbpedia.org/page/London". Second, that's the wrong URI for London. The resource is <http://dbpedia.org/resource/London>. (Yes, when you put that in a web browser, you get redirected to the …/page/London; that's not the URI of the resource, though.) The URI can be abbreviated as dbpedia:London on the public endpoint. Third, because URIs are not strings, you need to filter strstarts( str(?resource), … ), explicitly getting the string form of the URI. Thus:

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

SPARQL results

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Ok thanks, it works! I thought that "http://dbpedia.org/page/London" also was a URI because I wrote it in my browser to search this page. – Musich87 Jul 01 '14 at 13:02
  • @Musich87 `http://dbpedia.org/page/London` is certainly a URI, it's just not the one that identifies the London DBpedia resource. – Joshua Taylor Jul 01 '14 at 13:57