Search code examples
rdfsparqljenasemantic-webdbpedia

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


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.


Solution

  • 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)