I've a dbpedia resource and I'd like to obtain all the dbpedia categories associated. For this purpose I wrote this SPARQL query
SELECT ?p ?o WHERE
{
<http://dbpedia.org/resource/Rihanna> ?p ?o .
}
focusing only on http://purl.org/dc/terms/subject property.
The results I've is a set of categories. Which could be a good manner to select the most relevant category which describes Rihanna singer?
This query orders Rihanna's categories by the total number of members in each category:
SELECT ?category (COUNT(?member) as ?memberCount) WHERE {
?member dct:subject ?category.
{ SELECT ?category WHERE { dbr:Rihanna dct:subject ?category. } }
}
ORDER BY ?memberCount
The assumption here is that, the fewer members a category has, the higher the relevance of that category for any particular member.
The results for this query list the following categories as most relevant to Rihanna:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With