0

I'm new to SPARQL and DBpedia.

I am writing to you because I have a basic logic problem that is creating many problems for me.

The main problem I have is the following:

  • given the name of an artist, I have to get (via a SPARQL query) the list of albums of the given artist.

Here I am presented with a fundamental problem. Suppose the artist in question is "Drake". On wikipedia, under the heading Drake, there are several figures that have nothing to do with the artist.

the question is

  • given a query like this:

    SELECT *
    WHERE
      {
        ?artist  rdfs:label  "Drake"@en 
      }   
    

How can I specify that the Drake I'm looking for is the artist and not his namesake?

However, I would like this to be possible regardless of the name, because in the specific case of Drake I could specify Drake_(musician). But how can I set the problem to carry out this check regardless of the name given in input?

I ask this because ultimately, as explained at the beginning, given an artist as a parameter, I have to be able to get the list of albums produced by him.

I thank in advance whoever will be able to provide me with a useful answer.

Greetings to the Stack Overflow community.

TallTed
  • 9,069
  • 2
  • 22
  • 37
  • you have to provide more information to the query, e.g. restrict to the class of musicians, artists etc. or maybe require an occupation. The best way to start is too look at what exists in DBpedia: https://dbpedia.org/resource/Drake_(musician). For example, look at the `rdf:type` property on this page or check the `dct:subject` related categories. – UninformedUser May 05 '21 at 17:22
  • that also means, your label is wrong or better said doesn't fit the DBpedia label and is too specific. A fulltext search would be better. – UninformedUser May 05 '21 at 17:34
  • as an example, restrict it to persons first and also consider the Wikipedia disambiguation and redirect pages: `SELECT * WHERE { ?artist a dbo:Person ; (^dbo:wikiPageDisambiguates|^dbo:wikiPageRedirects)/rdfs:label "Drake"@en }` - it will still return multiple entities, so you have to add more constraint – UninformedUser May 05 '21 at 17:34
  • using a fulltext index, even more result, so again up to you to filter by artists: `SELECT * WHERE { ?artist rdfs:label ?l ; a dbo:Person . filter(lang(?l) = "en") ?l bif:contains "Drake" }` – UninformedUser May 05 '21 at 17:37
  • this query for example considers the category "Musician": `SELECT DISTINCT * WHERE { ?artist a dbo:Person ; (^dbo:wikiPageDisambiguates|^dbo:wikiPageRedirects)/rdfs:label "Drake"@en ; dct:subject/skos:broader* }` – UninformedUser May 05 '21 at 17:42
  • You might also do some exploring through the [Virtuoso Facet Browser which is also found on the DBpedia instance](https://dbpedia.org/fct/). – TallTed May 06 '21 at 17:36

0 Answers0