Reputation: 34001
I'm trying to extract a list of articles from a specific category in Wikipedia. I'm trying to accomplish this via DBpedia. However, I can't actually find the specific 'term' or 'field' to reference a 'category'. Where is this documented?
The section 4.2. Classifications following section from the DBpedia documentation has a link to the DCMI vocabulary, but I do not see any relevant 'field' or 'term' for category.
Upvotes: 2
Views: 140
Reputation: 85883
When working with DBpedia, it's almost always easier to browse some data first and then figure out how to the write the query. For instance, in this case, you can take a look at dbpedia:Mount_Monadnock. You'll see that it's related by the dcterms:subject property to four categories:
If you look at the links that those point to, you'll see the right URIs, e.g.,
Now, if you're looking at the DBpedia SPARQL Endpoint web interface, you'll see a Namespace Prefixes link in the top right, which will show you the predefined (when you're working with the web interface) prefix:
Thus, you could use a query like this to get a list of articles in the Mountains of New Hampshire category:
select ?article {
?article dcterms:subject category:Mountains_of_New_Hampshire
}
The link to the documentation in the question points to
4.2. Classifications
… Wikipedia Categories are represented using the SKOS vocabulary and DCMI terms.
As we've seen, the dcterms:subject property is used to link articles to their categories. The SKOS vocabulary is used to connect categories. E.g., skos:broader is used to connect subcategories and supercategories. I agree that the documentation does not give quite as much information as one might expect, but this might be forgivable since the data is easy enough to browse (and the properties are described in the documentation on those vocabularies).
It's a bit more specific, and would have been hard to search for if I didn't already know what to look for, but this question and answer helps:
This is also helpful:
Upvotes: 4