Corrie and I were wondering about the average age of American Presidents at the time of election.
The answer is: 55.76. The youngest was Theodore Roosevelt, aged 43 at the time of election. The oldest was Ronald Reagan, aged 70 at the time of election.
I also made this nifty graph:

While these results are not terribly interesting, the process I used to get the data was: I used Freebase and MQL.
Here is the query that I used to get the data from Freebase:
[
{
"/government/politician/government_posit ions_held" : [
{
"from" : null,
"office_position_or_title" : "President of the United States"
}
],
"/people/person/date_of_birth" : null,
"name" : null,
"sort" : "/government/politician/government_posit ions_held.from",
"type" : "/government/us_president"
}
]
You can view the results of this query by loading the query into the Metaweb MQL Query Editor, then clicking "read >>".
I had to manually update many of the records in Freebase before I had a complete set of results, but I only had to do this once. Anybody else using Freebase will now be able to benefit from my work -- with knowledge of how to use MQL writes, loading data into Freebase looks almost trivial.
Once I had the results of the data, I wrote a quick perl script to convert the JSON results into a CSV file, which I then put into Numbers to make the graph above.
If I wasn't in a hurry to see some results, I probably could have used the Google Chart API and some Javascript and done this "in the cloud".
All the files I created for this project are available here: sargo.com/joel/age_of_presidents_at_elec tion.tar.gz
The answer is: 55.76. The youngest was Theodore Roosevelt, aged 43 at the time of election. The oldest was Ronald Reagan, aged 70 at the time of election.
I also made this nifty graph:

While these results are not terribly interesting, the process I used to get the data was: I used Freebase and MQL.
Here is the query that I used to get the data from Freebase:
[
{
"/government/politician/government_posit
{
"from" : null,
"office_position_or_title" : "President of the United States"
}
],
"/people/person/date_of_birth" : null,
"name" : null,
"sort" : "/government/politician/government_posit
"type" : "/government/us_president"
}
]
You can view the results of this query by loading the query into the Metaweb MQL Query Editor, then clicking "read >>".
I had to manually update many of the records in Freebase before I had a complete set of results, but I only had to do this once. Anybody else using Freebase will now be able to benefit from my work -- with knowledge of how to use MQL writes, loading data into Freebase looks almost trivial.
Once I had the results of the data, I wrote a quick perl script to convert the JSON results into a CSV file, which I then put into Numbers to make the graph above.
If I wasn't in a hurry to see some results, I probably could have used the Google Chart API and some Javascript and done this "in the cloud".
All the files I created for this project are available here: sargo.com/joel/age_of_presidents_at_elec
