I am trying to properly tag all my music. I have already iterated my music through musicbrainz picard and MediaGo but Still Some of the songs are not tagged or partially tagged. I came across the DBpedia and SPARQL. Now the query I want to ask to SPARQL is, " Show me all the music albums between 2010-2015, It's Album Artist, All titles in the album, Genere, Release Year and Cover art " At first I tried the following query but I am unable to understand how it is not showing all the albums. I searched "Hybrid Theory" which was not there.
PREFIX dbpedia0: <http://dbpedia.org/ontology/>
SELECT ?album ?album_name WHERE {
?album a dbpedia0:Album .
?album dbpedia2:name ?album_name .
}
I also want to search album/film music info later, specifically in Cinema_of_India class.
Please guide me to the right direction.
With DBpedia, you first need to define the type of instance you are trying to extract. In this particular example, you are looking for albums thus:
?album a dbpedia-owl:Album .
Then you need to look for properties that belong to this album. As you have named them, you are looking for:
rdfs:label
dbpedia-owl:artist
dbpedia-owl:genre
dbpedia-owl:releaseDate
dbpprop:title
And lastly, you want to filter your album names only to contain English (or whatever language you are looking for) labels. Also, you have a constraint on your release date.
SELECT distinct *
WHERE {
?album a dbpedia-owl:Album .
?album rdfs:label ?albumName.
?album dbpedia-owl:artist ?Artist.
Optional{
?album dbpedia-owl:genre ?genre.
?album dbpedia-owl:releaseDate ?date.
?album dbpprop:title ?title.
}
Filter (
lang(?albumName)='en' &&
xsd:dateTime(?date) >= '2010-01-01T00:00:00Z'^^xsd:dateTime)
}
The reason I put some of the variables in the optional is that if there is an album that DBpedia doesn't contain these information, it will still show up.
You next query, also needs to follow that same logic. For example, if you are looking for a specific album you could use this query and get other restrictions on the album.
SELECT distinct * WHERE {
?album a dbpedia-owl:Album.
Filter( ?album=dbpedia:Hybrid_Theory)
}