login about faq

Essentially, what I am trying to achieve is extract the name and country of birth of every composer from this Wikipedia list. This is my first attempt ever at using SPARQL, but here's what I've managed so far:

SELECT ?name ?birthplace WHERE {
?person foaf:name ?name .
?person dbpedia2:placeOfBirth ?birthplace .
?person <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Women_classical_composers> .
?country rdf:type dbpedia-owl:Country .
FILTER (str(?birthplace) = str(?country))
}
ORDER BY ?name

I'm running this through dbpedia's SNORQL and while I get an output in the format I want, I'm only using results from the "Women classical composers" Wikipedia category which only covers a portion of what is displayed in the "List of female composers by name" list. I've tried finding categories common to all the composers in the list which would allow me to select them with relative ease, but couldn't find any which were truly all-encompassing.

I do realise my question is rather similar to this one, but I unfortunately could not figure out my problem after reading this.

asked Feb 23 at 00:46

Jeremy's gravatar image

Jeremy
333


This one can't be done against the public endpoint.

There is a wikipedia data set that contains facts of the form "Page X links to Page Y", so if you had this data loaded into your SPARQL engine you could replace

?person <http://purl.org/dc/terms/subject>
    <http://dbpedia.org/resource/Category:Women_classical_composers> .

with

<http://dbpedia.org/resource/Category:Women_classical_composers> 
    <http://dbpedia.org/ontology/wikiPageWikiLink> ?person .

but the "wikipedia pagelinks" are not loaded into the public endpoint. If you loaded DBpedia into your own triple store, you could do this query.

Note to get your list of Woman classical composers you can (i) load just the pagelinks in your own triple store and do the rest against the DBpedia endpoint or (ii) use tools like awk to suck just a few pagelinks out of the N-Triples file (much faster than loading it all into a triple store) or (iii) extract links from the Wikipedia page.

answered Feb 23 at 09:02

database_animal's gravatar image

database_animal
6.6k410

I extracted the links from the Wikipedia page as you suggested, though my knowledge of SPARQL being quite limited (i.e. I never heard about it before yesterday), I ended up writing a script that queries the DBpedia endpoint for each link individually and downloads the results as a .csv file. I then simply concatenated all the files an obtained my results that way. This is a totally inefficient way of doing things and I'm sure there are much better ways, but at least I got what I wanted.

(Feb 24 at 15:19) Jeremy Jeremy'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

By RSS:

Answers

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

Tags:

×120
×10

Asked: Feb 23 at 00:46

Seen: 382 times

Last updated: Feb 24 at 15:19