Neil Wilkinson, Technical Director of Yahoo!7 and Yahoo!Xtra, gave a presentation about Yahoo!'s open strategy and focus on YQL. He discussed how Yahoo! embraces open standards and contributes to open source projects. Wilkinson demonstrated how YQL can be used to query data from various Yahoo! APIs, mash it together, and display the results programmatically through simple examples in PHP, Javascript, and the YQL console. YQL provides a simple way to access data from many sources and integrate it for easy use in applications.
40. We use an IN clause to use the result of 1 API into the input of another API
41. Best demonstrated with an example:select content from search.termextract where context in ( select description from rss where url="http://nz.rss.news.yahoo.com/top_stories.xml" limit 1 )
42.
43. What if we used that data to get the other related news going on in the worldselect * from search.news wherequery in ( select content from search.termextract where context in ( select description from rss where url="http://nz.rss.news.yahoo.com/top_stories.xml" limit 1 ) )
44.
45. Let’s get web search results too:select * from search.web where query in ( select content from search.termextract where context in ( select description from rss where url="http://nz.rss.news.yahoo.com/top_stories.xml" limit 1 ) )
46.
47. Let’s get flickr results too:select * from flickr.photos.search where text in ( select content from search.termextract where context in ( select description from rss where url="http://nz.rss.news.yahoo.com/top_stories.xml" limit 1 ) )
48.
49. Using CURL to make a server-side web request<?php $ch = curl_init(“http://query.yahooapis.com/v1/public/yql?q=select…&format=json”); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $jsonContent = curl_exec($ch); curl_close($ch); $content = json_decode($jsonContent); ?>
63. This gets all main navigation items from the herald:select * from html where url='http://www.nzherald.co.nz' and xpath='//h2/a'
64.
65.
66. Your YQL query is cached for you by Yahoo! infrastructure
67. However, especially if your servers are in New Zealand, caching local to your server is important for scale and performance
68. Caching is also important to avoid hitting Yahoo!’s limit of 100,000 per application ID per day
69.
70. Mash up a huge variety of data including APIs, contributed open tables, your own tables and any publically available feed or webpage