Hi all,
I need to query DBpedia to get the genre and release date of all the songs
that got picked in the BBC Radio 4 Desert Island Discs show. I'm using the
Jena API, in Java, to send all the SPARQL queries to the
http://dbpedia.org/sparql endpoint. Because I only have the title of the
songs and the name of the artist, I need to query by these strings. To
restrict the search, I've added the constraints on the resource type. If I
don't put a type constraint, the query times out. Here is one of the
queries I use for getting the song URI, genre and release date:
SELECT DISTINCT *
WHERE {
{
?song rdf:type <http://dbpedia.org/ontology/Single> .
?song rdfs:label ?songTitle .
OPTIONAL {?song dbpedia-owl:genre ?genre} .
OPTIONAL {?song dbpedia2:genre ?genre} .
OPTIONAL {?song dbpedia-owl:releaseDate ?releaseDate} .
FILTER ( regex(?songTitle, "Fallen Soldier", "i") ) .
FILTER (LANG(?songTitle) = 'en') .
}
UNION {
?song rdf:type <http://dbpedia.org/ontology/MusicalWork> .
?song rdfs:label ?songTitle .
OPTIONAL {?song dbpedia-owl:genre ?genre} .
OPTIONAL {?song dbpedia2:genre ?genre} .
OPTIONAL {?song dbpedia-owl:releaseDate ?releaseDate} .
FILTER ( regex(?songTitle, "Fallen Soldier", "i") ) .
FILTER (LANG(?songTitle) = 'en') .
}
UNION {
?song rdf:type <http://dbpedia.org/ontology/Work> .
?song rdfs:label ?songTitle .
OPTIONAL {?song dbpedia-owl:genre ?genre} .
OPTIONAL {?song dbpedia2:genre ?genre} .
OPTIONAL {?song dbpedia-owl:releaseDate ?releaseDate} .
FILTER ( regex(?songTitle, "Fallen Soldier", "i") ) .
FILTER (LANG(?songTitle) = 'en') .
}
UNION {
?song rdf:type <http://umbel.org/umbel/rc/MusicalComposition> .
?song rdfs:label ?songTitle .
OPTIONAL {?song dbpedia-owl:genre ?genre} .
OPTIONAL {?song dbpedia2:genre ?genre} .
OPTIONAL {?song dbpedia-owl:releaseDate ?releaseDate} .
FILTER ( regex(?songTitle, "Fallen Soldier", "i") ) .
FILTER (LANG(?songTitle) = 'en') .
}
} LIMIT 1
I've also tried to split the query into two: first to get the song URI by
title, and then get the genre and release date (which is a bit faster than
this one, but still very slow; sometimes it times out as it is.. ).
My question is, is there any way to optimize this search by literals ? It
takes up to 5 minutes per song to return results and I need to handle about
14,000 of them.
Thanks in advance!
Regards,
Alina Elena Băluşescu
MSc student in Advanced Computer Science department
The University of Manchester
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion