SparQl/Gephi queries for sourcing stylistic origins and subgenres for music genres of the African Diaspora

I’m conducting research on music genres of the African Diaspora, and inputting data into Gephi to visualize the connections. Following the List of Musical Genres of the African Diaspora, I’m trying to source data pertaining to the stylistic origins as well as subgenres of the genres listed.

Unfortunately, the query I’m using in SparQl doesn’t work when I try to obtain stylistic origins and subgenres for Blues, Jazz, Afrobeat, Soca, and a few others.

I wondered if anybody here might have any insight/suggestions for revising the recipe to obtain that information? The digital librarian who provided me with this query also seems to be stumped and he suggested I reach out to this community. Any information would be helpful!

To obtain the list of music genres from the List of musical genres of the African diaspora including genre id, I use the following recipe:

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX : <http://dbpedia.org/resource/>

SELECT ?geId ?genre

WHERE
{
:List_of_musical_genres_of_the_African_diaspora dbo:wikiPageWikiLink ?genre .
?genre dbo:wikiPageID ?geId .
FILTER (?genre != <http://dbpedia.org/resource/Puerto_Rico>) .
}

After obtaining ID and Labels for each genre, I use the following complex query to obtain IDs and labels, stylistic origins, and music subgenres for each single genre:

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX : <http://dbpedia.org/resource/>

SELECT ?stOrId ?stylisticOrigin ?stOrLabelValue ?geId ?genre ?geLabelValue ?muSuId ?musicSubgenre ?muSuLabelValue

WHERE {
:List_of_musical_genres_of_the_African_diaspora dbo:wikiPageWikiLink ?genre .
?genre dbo:stylisticOrigin ?stylisticOrigin .
?genre dbo:wikiPageID ?geId .
?genre rdfs:label ?geLabel .
?genre dbo:musicSubgenre ?musicSubgenre .
?stylisticOrigin dbo:wikiPageID ?stOrId .
?stylisticOrigin rdfs:label ?stOrLabel .
?musicSubgenre dbo:wikiPageID ?muSuId .
?musicSubgenre rdfs:label ?muSuLabel .
FILTER (?geId = 28261) .
FILTER (LANG(?geLabel) = "en").
BIND(STR(?geLabel) AS ?geLabelValue).
FILTER (LANG(?stOrLabel) = "en").
BIND(STR(?stOrLabel) AS ?stOrLabelValue).
FILTER (LANG(?muSuLabel) = "en").
BIND(STR(?muSuLabel) AS ?muSuLabelValue).
}

For some reason, Blues, Jazz, Afrobeat, Soca, and a few others are just wired differently I suspect and so I am having trouble getting the data.

  • the data in DBpedia is heterogenous – if your check for example Blues, there is no musicSubgenre in the data – in the case you have to check for alternative properties or the data simply doesn’t exist. To handle optional data you can use OPTIONAL in SPARQL and avoid missing results.

    – 

Leave a Comment