RDF parse of DBPedia showing all Death Metal band members and their connections

Death Metal members and their connections

To anyone who likes Death Metal and would like to know who played with who in a graphical form. For you there is a DBpedia RDF parse that I’ve done over the last two days.
Recently I replaced the PDF by a vector graphic to allow better scaling. I suggest you view the image in a new tab or download it. Also notice that bands have the format db:BAND_NAME.

Death Metal Parse


Tutorial

You can download the data as RDF or JSON from DBpedia using SPARQL.


SELECT *
WHERE {
{?band_uri dbo:genre dbr:Death_metal }
UNION {?band_uri dbo:genre dbr:Melodic_death_metal}
UNION {?band_uri dbo:genre dbr:Folk_metal}
UNION {?band_uri dbo:genre dbr:Pagan_metal}
UNION {?band_uri dbo:genre dbr:Black_metal}
UNION {?band_uri dbo:genre dbr:Viking_metal}
UNION {?band_uri dbo:genre dbr:Gothic_metal}
UNION {?band_uri dbo:genre dbr:Power_metal}.
{?band_uri dbpedia2:currentMembers ?member_uri}
UNION {?band_uri dbpedia2:pastMembers ?member_uri}.
}

I prefer a simple script in R

library(SPARQL)
library(igraph)
library(network)
library(ergm)

endpoint <- "http://live.dbpedia.org/sparql"
options <- NULL
prefix <- c("db","http://dbpedia.org/resource/")
sparql_prefix <- "PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
"
q2 <- paste(sparql_prefix,
'SELECT *
WHERE {
{?band_uri dbo:genre dbr:Death_metal }
UNION {?band_uri dbo:genre dbr:Melodic_death_metal} 
UNION {?band_uri dbo:genre dbr:Folk_metal}
UNION {?band_uri dbo:genre dbr:Pagan_metal}
UNION {?band_uri dbo:genre dbr:Black_metal}
UNION {?band_uri dbo:genre dbr:Viking_metal}
UNION {?band_uri dbo:genre dbr:Gothic_metal}
UNION {?band_uri dbo:genre dbr:Power_metal}.
{?band_uri dbpedia2:currentMembers ?member_uri}
UNION {?band_uri dbpedia2:pastMembers ?member_uri}.
}')
res <- SPARQL(endpoint,q2,ns=prefix,extra=options)$results

member_band_matrix <- as.matrix(ifelse(table(res$member_uri, res$band_uri) > 0, 1, 0))

a_m <- graph.incidence(member_band_matrix)

write.graph(a_m,'death_members.graphml',format="graphml")

Afterwards you can use tools such as Gephi to visualise the data.


If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.

Facebooktwittergoogle_plusredditpinterestlinkedin