Presented at the Freebase NYC Workshop, December 2009. Covers basic MQL query construction, basic service calls and eMQL adapter construction. PHP Code can be found at http://dev.mqlx.com/~jamie/nyc2009
20. eMQL: MQL Extensions
• Request data from other service providers
• Services accessed transparently within MQL query
• Use Freebase Keys/Properties in external service request
• Uses:
• real-time data services
• Stock quotes, sensor data
• premium services
• requests can specify private "api keys" for the service
• fine grained & authoritative data sources
24. eMQL Service Request
• Pre
• Modify MQL query to provide additional information
necessary to complete request
• e.g., retrieve specific namespace keys
• Fetch
• Produce (retrieve, calculate, format) value for the
eMQL property
• Reduce (optional)
• Create a result that looks across all results returned
in the query
• Help
• Document how the property is used
30. http://services.tvrage.com/tools/quickinfo.php?show=NCIS
Show ID@4628
Show Name@NCIS
Show URL@http://www.tvrage.com/NCIS
Premiered@2003
Started@Sep/23/2003
Ended@
Latest Episode@07x09^Child's Play^Nov/24/2009
Next Episode@07x10^Faith^Dec/15/2009
RFC3339@2009-12-15T20:00:00-5:00
GMT+0 NODST@1260921600
Country@USA
Status@Returning Series
Classification@Scripted
Genres@Action | Crime | Drama | Military/War
Network@CBS
Airtime@Tuesday at 08:00 pm
Runtime@60
31. TV Episode Adapter
eMQL Driver
TV Rage
Time
query dispatched
pre
eMQL
MQL Query
Extend MQL query to retrieve
TV Rage Key (program identifier)
updated MQL
query
Adapter
TV Rage Service
run MQL
query
MQL
results Life Cycle
fetch
get series
data
next episode
number,
name,date
get episode
data
next
episode
URL
format results
results
return
query
results
32. Using Foreign Identifiers
to locate Freebase Topics
• /authority Namespace
• Organizations managing stable entity identifiers
• /source - identifiers only appearing in URLs
• Keys can be for URLs to other sites
• And vice-versa!
35. Using Freebase RDF URIs
http://rdf.freebase.com/ns/<freebase-key>
• Performs content negotiation (HTTP ACCEPT Header)
• Produces HTML for standard browsers
• Produces RDF if you ask for it
• Easily translated to MQL style Freebase identifiers
http://rdf.freebase.com/ns/en.ncis = /en/ncis