2

this is a simple query by using sparql in dbpedia.

prefix dct:<http://purl.org/dc/terms/>

select   ?x   
where { ?x dct:subject <http://dbpedia.org/resource/Category:Cycle_racing_by_country>
  }

or

prefix dbc:<http://dbpedia.org/resource/Category:>
prefix dct:<http://purl.org/dc/terms/>


select   ?x   
where { ?x dct:subject dbc:Cycle_racing_by_country.
  }

it does not return any values.

so how to query http://dbpedia.org/page/Category:Cycle_racing_by_country and get its data?

Dev X
  • 353
  • 2
  • 15
  • 1
    It's not `/page/` in DBpedia, but `/resource/` in your case. `http://dbpedia.org/resource/Category:Cycle_racing_by_country` – UninformedUser May 30 '16 at 10:33
  • Also see some notes about dbpedia iris in [How to retrieve XML/RDF data from a dbpedia link or URL?](http://stackoverflow.com/questions/30279970/how-to-retrieve-xml-rdf-data-from-a-dbpedia-link-or-url) – Joshua Taylor May 30 '16 at 12:03
  • 1
    @devx the query shouldn't turn anything. When you visit the resource, there's aren't any "dct:subject of ..." items. It doesn't look like this category is the subject of any article, it's just a super-category of a bunch of categories. Can you give an example of what you'd expect your query to return? – Joshua Taylor May 30 '16 at 13:05
  • @JoshuaTaylor yes you are right, this is good comment and should be as answer, what I want is how to query this resource? to get all URIs in skos:broader then get rdfs:label for each of them? – Dev X May 30 '16 at 13:38
  • 2
    Use `dct:subject/skos:broader*` in predicate position. – UninformedUser May 30 '16 at 14:38
  • You may find questions/ answers like http://stackoverflow.com/questions/20762696/finding-common-categories-or-supercategories-of-resources helpful, too. – Joshua Taylor May 30 '16 at 15:39
  • http://stackoverflow.com/questions/27724741/how-to-build-simple-sparql-query-in-the-right-way is very similar in structure to what it sounds like you want to do – Joshua Taylor May 30 '16 at 15:42

1 Answers1

4

As aksw said in a comment, none of the DBpedia entities are identified by IRIS starting with http://dbpedia.org/page/, but rather with http://dbpedia.org/resource/.

It's easy to make this mistake though, because if you visit, e.g., http://dbpedia.org/resource/Johnny_Cash in the web browser,you get redirected to a URI with /page/ in it. A better solution on DBpedia's part would have been to use content type negotiation to return the html content directly when a browser requests the resource page.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353