I am fairly new to RDF and Sparql, the concept is still somewhat confusing to me. I am doing a very simple exercise in which I will be extracting a list of cities from http://dbpedia.org/page/Category:Cities_and_towns_in_Quebec

I have tried many ways to get a list of names of all the cities in quebec, so far with no luck. All the results were empty. this is the query I've written so far:

PREFIX dbp: <http://dbpedia.org/ontology/>
select ?node
  ?node a dbp:city .
  ?node dbp:City  <http://dbpedia.org/resource/Category:Cities_and_towns_in_Quebec> .
limit 10

what did I do wrong?


asked 15 Feb '13, 11:42

yonk's gravatar image

accept rate: 0%

I started by querying for { ?s ?p <http://dbpedia.org/resource/Category:Cities_and_towns_in_Quebec> } just to see what we had to work with and eventually came up with this:

  ?city skos:broader <http://dbpedia.org/resource/Category:Cities_and_towns_in_Quebec> . 
  ?city rdfs:label ?name . 

The categories in DBpedia are instances of skos:Concept, so I don't believe you'll see any typing about them being in other classes as well.

(It was nice to see Saint-Hyacinthe among the answers; that's where my great-great grandfather came from 175 years ago.)


permanent link

answered 15 Feb '13, 16:04

bobdc's gravatar image

accept rate: 15%

Not related with the question but why were on DBpedia cities represented as a skos:Concept rather than an instance of, say, dbpedia-owl:City?

(16 Feb '13, 07:05) fadirra fadirra's gravatar image

Very related, actually; because that's how DBpedia models categories.

(16 Feb '13, 08:24) bobdc bobdc's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Feb '13, 11:42

question was seen: 803 times

last updated: 16 Feb '13, 08:24