Should queries with URIs like http://pt.dbpedia.org/resource/.. be different from the ones with URIs like http://dbpedia.org/resource/..?

两盒软妹~` 提交于 2019-12-13 17:20:54

问题


I'm making that SPARQL query:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?label WHERE { 
<http://pt.dbpedia.org/resource/Brasil> rdfs:label ?label.}

and I don't get any results for ?text . I checked that URI on my browser and found the rdfs:label property there. Is that problem caused by the URI form http://pt.dbpedia.org/? I've already used the same query with IRIs starting with http://dbpedia.org/resource/, e.g., http://dbpedia.org/resource/Google and those work. I'm using Jena, and can provide code showing how I'm dereferencing the IRI.


回答1:


If I run your query against the Portuguese DBpedia SPARQL endpoint (http://pt.dbpedia.org/sparql), I get the results you'd want ("Brasil"):

SELECT ?label WHERE { 
  <http://pt.dbpedia.org/resource/Brasil> rdfs:label ?label.
}

SPARQL results (one)

Running the same query against the main (English) DBpedia SPARQL endpoint (http://dbpedia.org/sparql), though, I get no results.

SELECT ?label WHERE { 
  <http://pt.dbpedia.org/resource/Brasil> rdfs:label ?label.
}

SPARQL results (none)

It looks like you need to be sure to query against the right endpoint. On the main SPARQL endpoint, though, you can ask about things that are owl:sameAs the Brasil resource in Portuguese DBpedia. E.g.,

SELECT ?label WHERE { 
  ?brasil owl:sameAs <http://pt.dbpedia.org/resource/Brasil> ;
          rdfs:label ?label .
}

SPARQL results (lots)

That gives you lots of results, though, since you're getting the names in lots of different languages. You could ask for labels just in Portuguese, though (and you probably want to add distinct here) and you can get "Brasil" and "Brazil":

SELECT distinct ?label WHERE { 
  ?brasil owl:sameAs <http://pt.dbpedia.org/resource/Brasil> ;
          rdfs:label ?label .
  filter( langMatches(lang(?label),"pt") )
}

SPARQL results (two)



来源:https://stackoverflow.com/questions/20335898/should-queries-with-uris-like-http-pt-dbpedia-org-resource-be-different-fro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!