List all U.S. Presidents in order of something similar to freebase.com's presidency_number

Task: List all U.S. Presidents in order of service, or something similar to
freebase.com's presidency_number.

I can do this easily using MQL against freebase.com data, but I was
wondering:

(1) does freebase.com now support sparql querying of its data?
    the "closest" thing I've found was http://rdf.freebase.com,
    which is not really a sparql endpoint

(2) Are you aware of any other dataset and terms
    I can use to achieve similar results?

    I tried querying DBPEDIA because the article
    http://en.wikipedia.org/wiki/U.S._Presidents
    shows a list of U.S. Presidents in order of service.
    But I didn't get very far because the properties/terms I used
    had -- at best -- incomplete data.

    sparql endpoint:  http://dbpedia.org/sparql
    default graph uri: http://dbpedia.org
    my preliminary/exploratory query:
    ---------------------------------------------
    select ?Prez ?electionDate ?orderInOffice ?presidentStart ?termStart
?order ?activeYearsStartDate
where {
  ?Prez a <http://dbpedia.org/class/yago/PresidentsOfTheUnitedStates> .
  OPTIONAL { ?Prez <http://dbpedia.org/property/electionDate> ?electionDate
.}
  OPTIONAL { ?Prez <http://dbpedia.org/property/orderInOffice>
?orderInOffice .}
  OPTIONAL { ?Prez <http://dbpedia.org/property/presidentStart>
?presidentStart .}
  OPTIONAL { ?Prez <http://dbpedia.org/property/termStart> ?termStart .}
  OPTIONAL { ?Prez <http://dbpedia.org/property/order> ?order .}
  OPTIONAL { ?Prez <http://dbpedia.org/property/activeYearsStartDate>
?activeYearsStartDate .}
}
   --------------------------------------------

 From the above exploratory query, the most promising property turned out to
be
 <http://dbpedia.org/property/order>.

 If I do the following follow-up query, I don't end up with a complete list:
 ----------------------------------------
 select ?Prez ?order ?orderInt
where {
  {
  ?Prez a <http://dbpedia.org/class/yago/PresidentsOfTheUnitedStates> .
  OPTIONAL { ?Prez <http://dbpedia.org/property/order> ?order .}
  FILTER regex(str(?order),"(st|nd|th)\\s+President of the United States",
"i")
  }
  UNION
  {
  ?Prez a <http://dbpedia.org/class/yago/PresidentsOfTheUnitedStates> .
  OPTIONAL { ?Prez <http://dbpedia.org/property/order> ?orderInt .}
  FILTER (datatype(?orderInt) = xsd:int)
  }
}
--------------------------------------------

I thought the sparql query I needed would be a straighforward one ...
Might I be missing something really simple, or is the dbpedia data just
not all there yet to support this particular need
(other than sticking with the MQL Freebase route for now)?

Thanks for any help!

Received on Sunday, 21 August 2011 21:59:39 UTC