0

The following snippet retrieves all artists (names) from around the world using the dbpedia.org database.

prefix dbo: <http://dbpedia.org/ontology/>

select distinct (str(?name_) as ?name) {
  ?artist a dbo:Artist ;
          rdfs:label ?name_ .
}

What I would like to do next, is extend this snippet so that a) I filter by a certain city and b) present the following optional fields:

  • name (this works already)
  • city name
  • birth date
  • sub class (e.g. Actor, MusicalArtist etc.)
user706838
  • 5,132
  • 14
  • 54
  • 78

1 Answers1

0

dbo:birthDate will give you the birth date of the artist.

dbo:birthPlace will give you the birth place of the artist.

rdf:type / dbc:subject will give you all the roles that the artist have. Be careful, this one can be tremendous. Perhaps should you refine your research (Yago, dbc, dbo, wikidata, ...).

Here is an example of artists born in Pinner and their birthDate :

prefix dbo: <http://dbpedia.org/ontology/>

select distinct (str(?name_) as ?name) ?birthPlace ?birthDate {
  ?artist a dbo:Artist ;
    rdfs:label ?name_ .
  ?artist dbo:birthPlace ?birthPlace .
  ?artist dbo:birthDate ?birthDate .
filter(?birthPlace = dbr:Pinner)
}
Gilles-Antoine Nys
  • 1,481
  • 16
  • 21
  • Awesome! Quick question: I noticed that I get duplicated answers, the only difference of which is that the first one express dates as `1962-10-03` whereas the second one uses the following notation `"1962-10-3"^^`. Do we know why this is happening and if so how can we avoid it? – user706838 May 21 '18 at 22:38
  • https://stackoverflow.com/questions/50060490/sparql-query-returns-multiple-birth-dates-for-same-person/50062493#50062493 ..This is why you get duplicate answers. – Erwarth May 22 '18 at 02:00