freebase api @ hackto 2

37
The Freebase API Shawn Simister, September 2010

Upload: narphorium

Post on 08-May-2015

4.284 views

Category:

Technology


0 download

DESCRIPTION

My presentation about using the Freebase API that I gave at HackTO 2 in Toronto on September 25, 2010.

TRANSCRIPT

Page 1: Freebase API @ HackTO 2

The Freebase API

Shawn Simister, September 2010

Page 2: Freebase API @ HackTO 2
Page 3: Freebase API @ HackTO 2

An entity graph of people, places, and things.

Page 4: Freebase API @ HackTO 2

13 million entities

Page 5: Freebase API @ HackTO 2

Every entity has one or more IDs

Page 6: Freebase API @ HackTO 2

Each entity has one or more IDs

/en/u2

/m/0dw4g

/wikipedia/en_id/52780

/authority/facebook/u2

/authority/musicbrainz/name/ARTIST197

...

Page 7: Freebase API @ HackTO 2
Page 8: Freebase API @ HackTO 2

Entities are connected

Page 9: Freebase API @ HackTO 2

… with meaningful properties

Page 10: Freebase API @ HackTO 2

Approx. 400 million connections

Page 11: Freebase API @ HackTO 2
Page 12: Freebase API @ HackTO 2

Where does the data come from?

Page 13: Freebase API @ HackTO 2

Freebase schema

10,448 Propertiesdescribing ...

4,936 Types*organized into ...

641 Domains(~72 Commons)

*types with 10 or more instances

Page 14: Freebase API @ HackTO 2

One entity, many types

Person/people/person

Actor/film/actor

Politician/government/politician

/en/arnold_schwarzenegger

Page 15: Freebase API @ HackTO 2
Page 16: Freebase API @ HackTO 2

Freebase CommonsAmerican FootballArchitectureAstronomyAutomotiveAviationAwardsBaseballBasketballBicyclesBiologyBoatsBooksBroadcastBusinessCelebritiesChemistryComputersConferences

CricketData worldDigicamsEducationEngineeringEventsFashionFictional universesFilmFoodFreebaseGamesGeologyGovernmentHobbies and interestsIce hockeyInfluenceInternet

LanguageLawLibraryLocationMartial artsMeasurement unitMedia commonsMedicineMeteorologyMiltaryMusicOlympicsOperaOrganizationPeoplePeriodicalsPhysical geographyPhysics

ProjectsProtected placesRadioRailReligionRoyaltySoccerSpaceflightSportsSymbolsTennisTheaterTimeTransportationTravelTVVideo gamesVisual arts

Page 17: Freebase API @ HackTO 2
Page 18: Freebase API @ HackTO 2

Developing applicationswith Freebase data

Page 19: Freebase API @ HackTO 2

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

Page 20: Freebase API @ HackTO 2

MQL

Metaweb Query Language

Rhymes with “pickle”

JSON format

Query by example

Page 21: Freebase API @ HackTO 2

Querying Freebase

[{"id" : null,"name" : null,"type" : "/film/film"

}]

Page 22: Freebase API @ HackTO 2

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

}]

Page 23: Freebase API @ HackTO 2

Querying Freebase

[{"id" : null,"name" : null,"type" : "/film/film"

}]

Page 24: Freebase API @ HackTO 2

Querying Freebase

[{"id" : null,"name" : null,"type" : "/film/film","directed_by" : {

"id" : "/en/george_lucas"}

}]

Page 25: Freebase API @ HackTO 2

Querying Freebase[{

"id" : null,"name" : null,"type" : "/film/film","directed_by" : {

"id" : "/en/george_lucas"},"starring" : [{

"actor" : {"id" : "/en/harrison_ford"

}}]

}]

Page 26: Freebase API @ HackTO 2

http://freebase.com/tools/queryeditor

Page 27: Freebase API @ HackTO 2

Libraries

freebase-python (best supported)http://code.google.com/p/freebase-python

Other languageshttp://wiki.freebase.com/wiki/Libraries

Page 28: Freebase API @ HackTO 2

Acre

Page 29: Freebase API @ HackTO 2

http://acre.freebase.com

Page 30: Freebase API @ HackTO 2

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

Page 31: Freebase API @ HackTO 2
Page 32: Freebase API @ HackTO 2
Page 33: Freebase API @ HackTO 2
Page 34: Freebase API @ HackTO 2
Page 35: Freebase API @ HackTO 2
Page 36: Freebase API @ HackTO 2

Freebase Suggest

http://code.google.com/p/freebase-suggest/

Page 37: Freebase API @ HackTO 2

Everything you need to get started is available in the wiki

http://wiki.freebase.com/wiki/HackTO2

Thank you