Question: I need to find out the template type of a Wikipedia page entry. Up to this point, I've relied on parsing the results from a query to Wikipedia, which works to a point. 

For instance, if I search for 
[Joel Spolsky](http://en.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&rvsection=0&&titles=Joel_Spolsky), I can regex match 'infobox' and find out that this page refers to [Infobox Person](http://en.wikipedia.org/wiki/Template:Infobox_person).

But the trouble is, there is no consistent naming scheme for Wikipedia template types, and 'infobox' is often not used in the name of the template. 

For instance, if I search for the [Pittsburgh Steelers](http://en.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&rvsection=0&&titles=pittsburgh_Steelers) I can't reliably find out a way to extract the [NFL team](http://en.wikipedia.org/wiki/Template:NFL_team) template from the results.

Is anyone aware of a way to query the template type of a Wikipedia page? Thanks :)

Answer: 
The easiest way would be to look at the categories of the page instead of the templates. For example, Joel Spolsky has the category "Living people", and Pittsburgh Steelers has the category "National Football League teams".
Maybe [DBpedia](http://dbpedia.org/About) can help. DBpedia etxracts structured data from Wikipedia, offers it for download and stores it in a publicly accessible database. For example, try the following query at <http://dbpedia.org/sparql> :

```
select distinct ?t where {
  ?t a <http://dbpedia.org/ontology/AmericanFootballTeam> .
}

```

It returns all American football teams known to DBpedia, in RDF format. Almost all languages have a RDF API nowadays, so it should be relatively easy to get the data you need.