Noam
Noam

Reputation: 3391

Mapping dbpedia Wikipedia entity to the Wikipedia categories he's in

I'm using dbpedia spotlight to do NER. I would like to map each entity to wikipedia categories he's under. Is there an easy way to do this?

A simple example might be if I recognized the basketball player Michael Jordan I would want to fetch the categories he's under, probably NBA Players, Sports, Chicago Bulls Past Players, Etc...

Upvotes: 2

Views: 383

Answers (1)

svick
svick

Reputation: 244968

In DBpedia, Wikipedia categories are represented using the dcterms:subject property. So, to retrieve the categories for Michael Jordan, you can use SPARQL like:

PREFIX : <http://dbpedia.org/resource/>
PREFIX dcterms: <http://purl.org/dc/terms/>

SELECT ?cat WHERE {
    :Michael_Jordan dcterms:subject ?cat
}

Wikipedia also has an API to get categories of an article, using the categories module.

Upvotes: 3

Related Questions