Download - Freebase API @ HackTO 2
The Freebase API
Shawn Simister, September 2010
An entity graph of people, places, and things.
13 million entities
Every entity has one or more IDs
Each entity has one or more IDs
/en/u2
/m/0dw4g
/wikipedia/en_id/52780
/authority/facebook/u2
/authority/musicbrainz/name/ARTIST197
...
Entities are connected
… with meaningful properties
Approx. 400 million connections
Where does the data come from?
Freebase schema
10,448 Propertiesdescribing ...
4,936 Types*organized into ...
641 Domains(~72 Commons)
*types with 10 or more instances
One entity, many types
Person/people/person
Actor/film/actor
Politician/government/politician
/en/arnold_schwarzenegger
Freebase CommonsAmerican FootballArchitectureAstronomyAutomotiveAviationAwardsBaseballBasketballBicyclesBiologyBoatsBooksBroadcastBusinessCelebritiesChemistryComputersConferences
CricketData worldDigicamsEducationEngineeringEventsFashionFictional universesFilmFoodFreebaseGamesGeologyGovernmentHobbies and interestsIce hockeyInfluenceInternet
LanguageLawLibraryLocationMartial artsMeasurement unitMedia commonsMedicineMeteorologyMiltaryMusicOlympicsOperaOrganizationPeoplePeriodicalsPhysical geographyPhysics
ProjectsProtected placesRadioRailReligionRoyaltySoccerSpaceflightSportsSymbolsTennisTheaterTimeTransportationTravelTVVideo gamesVisual arts
Developing applicationswith Freebase data
REST API
http://api.freebase.com/api/service/mqlread Read structured data
http://api.freebase.com/api/service/mqlwrite Write structured data
http://api.freebase.com/api/service/search Free text search
http://api.freebase.com/api/service/topic Simplified topic data
... and more
http://www.freebase.com/docs/web_services
MQL
Metaweb Query Language
Rhymes with “pickle”
JSON format
Query by example
Querying Freebase
[{"id" : null,"name" : null,"type" : "/film/film"
}]
Query results[{
"id" : "/en/3_10_to_yuma_1957","name" : "3:10 to Yuma","type" : "/film/film"
},{"id" : "/en/20_000_leagues_under_the_sea","name" : "20,000 Leagues Under the Sea","type" : "/film/film"
},{"id" : "/en/2010_the_year_we_make_contact","name" : "2010: The Year We Make Contact","type" : "/film/film"
},... and so on
}]
Querying Freebase
[{"id" : null,"name" : null,"type" : "/film/film"
}]
Querying Freebase
[{"id" : null,"name" : null,"type" : "/film/film","directed_by" : {
"id" : "/en/george_lucas"}
}]
Querying Freebase[{
"id" : null,"name" : null,"type" : "/film/film","directed_by" : {
"id" : "/en/george_lucas"},"starring" : [{
"actor" : {"id" : "/en/harrison_ford"
}}]
}]
http://freebase.com/tools/queryeditor
Libraries
freebase-python (best supported)http://code.google.com/p/freebase-python
Other languageshttp://wiki.freebase.com/wiki/Libraries
Acre
http://acre.freebase.com
Templating language
<acre:block if=”f”><h2>$f women with this name, including ...</h2><ul acre:for=”w in women”>
<li><a href=”http://www.freebase.com/view$w.id”>$w.name</a></li></ul>
</acre:block>
<acre:block if=”m”><h2>$m men with this name, including ...</h2><ul acre:for=”m in men”>
<li><a href=”http://www.freebase.com/view$m.id”>$m.name</a></li></ul>
</acre:block>
http://www.freebase.com/docs/acre_templates
Freebase Suggest
http://code.google.com/p/freebase-suggest/
Everything you need to get started is available in the wiki
http://wiki.freebase.com/wiki/HackTO2
Thank you