SPARQL - select the most suitable dbpedia resource category

I have a dbpedia resource, and I would like to get all the dbpedia categories associated with it. For this, I wrote this SPARQL query

SELECT ?p ?o WHERE { <http://dbpedia.org/resource/Rihanna> ?p ?o . } 

focuses only on http://purl.org/dc/terms/subject .

results I have a set of categories. What could be a good way to choose the most appropriate category that describes singer Rihanna?

+6
source share
1 answer

This query orders Rihanna categories for the total number of participants 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 

It is assumed that the fewer category members, the higher the relevance of this category for any particular member.

The results for this query contain the following categories most important to Rihanna:

  • Barbados fashion designers
  • Barbadon people of Irish descent
  • Barbados Christians
  • Barbados people descended on Guyana.
  • Barbados singers
+7
source

All Articles