SlideShare a Scribd company logo
Yahoo Query Language:select * from internetDerek Gathright
Yahoo Query Language: Select * from Internet
var map = new YMap(document.getElementById('map'));…varcurrentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon );  map.addMarker(currentGeoPoint);……if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … }…http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c
var map = new YMap(document.getElementById('map'));…varcurrentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon );  map.addMarker(currentGeoPoint);……if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … }…http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c
var map = new YMap(document.getElementById('map'));…varcurrentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon );  map.addMarker(currentGeoPoint);……if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … }…http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=cYQLYQL stmt
Why YQL?Thousands of Web Services and sources that provide valuable dataRequire Developers to read documentation and form URLs/queries.Data is isolatedNeeds filtering, combining, tweaking, shaping even after it gets to the developer.
What is YQL?Cloud web service and SQL-Like Language Familiar to developersSynonymous with Data accessExpressive enough to get the right data.Self describing - show, desc tableAllows you to query, filter, join and update data across any structured data on the web / web servicesAnd Yahoo’s sherpa cloud storageReal time engine
YQL Statement Basicsshow: lists the supported tablesdesc: describes the structure of a tableselect: fetches datainsert/update/delete: modify datause: use an Open Data Tableset: define key-values across Open Data Tables
Insert / Update / DeleteWith INSERT/ UPDATE/ DELETESQL verbs you can modify data on the internet or cloudcreate tweets, add blog entries, update DBs etcstore tables or pieces of code in sherpaSome tables with I/U/DTwitter, Bit.ly shortenerYahoo profile status, application update streamAmazon SimpleDB
Demo: developer.yahoo.com/yql/
Get any data:Open Data Tables
Open Data Tableshttp://github.com/yql/yql-tables/tree/master
datatables.orgmirrors the master and builds a single environment with all tables (faster serving)
Console with community tables
Brings the power of the table model to new APIs
Schema defines mapping between YQL and Endpoint
Keys can either be query, path or matrix parameters
Keys can be marked as required
YQL Compiler validates existence of required keysYQLOpen Data Table example
Open Data Table example
Open Data Table example
ODT <execute> elementExtends Open Data Tables with server-side codeJavascript server-side scriptingNo DOM, events etc, pure JS scriptingE4X support - XML literals, filtering ...YQL no longer performs a GET request to the table binding URLYQL provides additional useful global objectsrequest, response, y.rest, y.include, y.query...Execute tag must return the data that will be the output of the YQL selectMove business logic of your application to the cloud
What you can do with <execute>access APIs that require authenticationNetflix OAuth, FlickrAuth, Google AuthSubjoin data across servicesgrab New York Times article tags and generate find associated flickr photoscombine multiple searches into a single result (twitter, web, news and images)augment data:city/state to APIs that just return zip codecreate APIs from web pagecelebrity birthdays scraped from imdb, caltraindata transformationconvert the result from xml to Google's kml format
hello world<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"><meta>    <sampleQuery>select * from {table} where a=’hello' and b=’world';</sampleQuery></meta><bindings><select itemPath="" produces="XML"><urls><url>http://fake.url/{a}</url></urls><inputs><key id='a' type='xs:string' paramType='path' required="true" /><key id='b' type='xs:string' paramType='variable' required="true" /></inputs><execute><![CDATA[// Your javascript goes here. We will run it on our serversresponse.object = <item><url>{request.url}</url><a>{a}</a>                   <b>{b}</b>                </item>;      ]]></execute>   </select>  </bindings></table>
Scraping a page<select produces="XML" itemPath="deals.deal">      <urls><url>http://deals.yahoo.com</url></urls>      <execute><![CDATA[vardealhtml = y.query("select * from html where url='http://deals.yahoo.com' and xpath='//div[contains(@class, \"product-display\")]'").results;var deals = <deals/>;function compress(object) {    if (!object) return "";    return object.toString().replace(/\s+/, " ")}for each (var div in dealhtml.div) {var deal = <deal/>;deal.name += <name>{compress(div.h3.a.text())}</name>;deal.link += <link>{div.div[0].a.@href}</link>;…deal.description += <description>{compress(div.p[0].*)}</description>;deal.logo += <logo>{compress(div.div[1].*)}</logo>;deals.deal += deal;}response.object = deals;      ]]></execute>    </select>
Twitter Selectselect *from twitter.statuswhere id="2108869549"andusername="xxx"and password="yyy”<select itemPath="" produces="XML">	<urls><url>http://twitter.com/statuses/show/{id}.xml</url></urls>	<inputs>		<key id="username" type="xs:string" required="false" paramType="variable"/>		<key id="password" type="xs:string" required="false" paramType="variable"/>		<key id="id" type="xs:integer" required="true" paramType="path"/>	</inputs>	<execute><![CDATA[varr = null;     	if (username && password) {         		y.include("http://yqlblog.net/samples/base64.js");varauthheader = "Basic "+Base64.encode(username+":"+password);r = request.header("Authorization",authheader).get().response;      	} else {r = request.get().response;      	}response.object = r;	]]></execute></select>

More Related Content

ODP
java ee 6 Petcatalog
PDF
The Ring programming language version 1.5.2 book - Part 44 of 181
PPTX
Quick & Easy Data Visualization with Google Visualization API + Google Char...
PPTX
SharePoint Conference 2018 - APIs, APIs everywhere!
PDF
Nativescript angular
PPTX
APIs, APIs Everywhere!
PPTX
Google Chart Tools
PPTX
Angular mix chrisnoring
java ee 6 Petcatalog
The Ring programming language version 1.5.2 book - Part 44 of 181
Quick & Easy Data Visualization with Google Visualization API + Google Char...
SharePoint Conference 2018 - APIs, APIs everywhere!
Nativescript angular
APIs, APIs Everywhere!
Google Chart Tools
Angular mix chrisnoring

Viewers also liked (20)

PPTX
TESTANDO
PPT
Kilifi Pictures
PDF
Edisi 6 Des Nas
PDF
Edisi 6 Des 2009 Nas
PPT
TIGHITCO Presentation
PDF
Project UpCity - Local Phase Report
KEY
Vim Cards - Keynote Format
PPT
Frdm
PPTX
Empower, engage, enrich pcca 2016
PPT
Innoz Presentation on SMSGYAN at MIT-EmTech 2011,Bangalore.
PPT
Aiesec 2008 2009 Report For Sandora
PDF
Edisi16oktnasional
PDF
Ecommerce 2k9
PDF
Edisi4novnas
PDF
6juni nas
PDF
The case of Labein Tecnalia technology institute as learning organization
PDF
Edisi aceh 26 07 10 baru
PDF
Edisi 18 Nov Nas
PPT
Почему проджект менеджеры убьют ваш стартап
PPTX
GXYSearch: job seeking advice
TESTANDO
Kilifi Pictures
Edisi 6 Des Nas
Edisi 6 Des 2009 Nas
TIGHITCO Presentation
Project UpCity - Local Phase Report
Vim Cards - Keynote Format
Frdm
Empower, engage, enrich pcca 2016
Innoz Presentation on SMSGYAN at MIT-EmTech 2011,Bangalore.
Aiesec 2008 2009 Report For Sandora
Edisi16oktnasional
Ecommerce 2k9
Edisi4novnas
6juni nas
The case of Labein Tecnalia technology institute as learning organization
Edisi aceh 26 07 10 baru
Edisi 18 Nov Nas
Почему проджект менеджеры убьют ваш стартап
GXYSearch: job seeking advice
Ad

Similar to Yahoo Query Language: Select * from Internet (20)

PPTX
Browser MVC with YQL and YUI
PPT
Introduction to YQL - Talk at HackU 2010, IIT Chennai
PPTX
YQL Overview
PPT
Lessons Learned - Building YDN
KEY
YQL Tutorial
PPT
YUI for your Hacks-IITB
KEY
YQL: Select * from Internet
KEY
YQL:: Select * from Internet
PPT
FOWA 09 - Open Strategy Applied
PPT
Yahoo - Open Applied
PPTX
Hack Day EU 2011 YQL
PPT
YQL - Christian Heilmann Open Hack London presentation
PDF
Yql hacku iitd_2012
PDF
Playing With The Web
PDF
Web services and JavaScript
PPTX
YQL talk at OHD Jakarta
PDF
A Quick Introduction to YQL
PPTX
YQL - HackU IIT Madras 2012
PDF
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
PPTX
YQL & Yahoo! Apis
Browser MVC with YQL and YUI
Introduction to YQL - Talk at HackU 2010, IIT Chennai
YQL Overview
Lessons Learned - Building YDN
YQL Tutorial
YUI for your Hacks-IITB
YQL: Select * from Internet
YQL:: Select * from Internet
FOWA 09 - Open Strategy Applied
Yahoo - Open Applied
Hack Day EU 2011 YQL
YQL - Christian Heilmann Open Hack London presentation
Yql hacku iitd_2012
Playing With The Web
Web services and JavaScript
YQL talk at OHD Jakarta
A Quick Introduction to YQL
YQL - HackU IIT Madras 2012
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
YQL & Yahoo! Apis
Ad

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Machine learning based COVID-19 study performance prediction
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Spectroscopy.pptx food analysis technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
Review of recent advances in non-invasive hemoglobin estimation
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Advanced methodologies resolving dimensionality complications for autism neur...
Dropbox Q2 2025 Financial Results & Investor Presentation
Machine learning based COVID-19 study performance prediction
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
Network Security Unit 5.pdf for BCA BBA.
Spectroscopy.pptx food analysis technology
The AUB Centre for AI in Media Proposal.docx
Reach Out and Touch Someone: Haptics and Empathic Computing
“AI and Expert System Decision Support & Business Intelligence Systems”
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Weekly Chronicles - August'25 Week I
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

Yahoo Query Language: Select * from Internet

  • 1. Yahoo Query Language:select * from internetDerek Gathright
  • 3. var map = new YMap(document.getElementById('map'));…varcurrentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint);……if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … }…http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c
  • 4. var map = new YMap(document.getElementById('map'));…varcurrentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint);……if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … }…http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=c
  • 5. var map = new YMap(document.getElementById('map'));…varcurrentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint);……if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … }…http://search.yahooapis.com/ImageSearchService/V1/imageSearch?appid=YahooDemo&query=Corvette&results=2http://weather.yahooapis.com/forecastrss?p=FRXX0076&u=cYQLYQL stmt
  • 6. Why YQL?Thousands of Web Services and sources that provide valuable dataRequire Developers to read documentation and form URLs/queries.Data is isolatedNeeds filtering, combining, tweaking, shaping even after it gets to the developer.
  • 7. What is YQL?Cloud web service and SQL-Like Language Familiar to developersSynonymous with Data accessExpressive enough to get the right data.Self describing - show, desc tableAllows you to query, filter, join and update data across any structured data on the web / web servicesAnd Yahoo’s sherpa cloud storageReal time engine
  • 8. YQL Statement Basicsshow: lists the supported tablesdesc: describes the structure of a tableselect: fetches datainsert/update/delete: modify datause: use an Open Data Tableset: define key-values across Open Data Tables
  • 9. Insert / Update / DeleteWith INSERT/ UPDATE/ DELETESQL verbs you can modify data on the internet or cloudcreate tweets, add blog entries, update DBs etcstore tables or pieces of code in sherpaSome tables with I/U/DTwitter, Bit.ly shortenerYahoo profile status, application update streamAmazon SimpleDB
  • 11. Get any data:Open Data Tables
  • 13. datatables.orgmirrors the master and builds a single environment with all tables (faster serving)
  • 15. Brings the power of the table model to new APIs
  • 16. Schema defines mapping between YQL and Endpoint
  • 17. Keys can either be query, path or matrix parameters
  • 18. Keys can be marked as required
  • 19. YQL Compiler validates existence of required keysYQLOpen Data Table example
  • 20. Open Data Table example
  • 21. Open Data Table example
  • 22. ODT <execute> elementExtends Open Data Tables with server-side codeJavascript server-side scriptingNo DOM, events etc, pure JS scriptingE4X support - XML literals, filtering ...YQL no longer performs a GET request to the table binding URLYQL provides additional useful global objectsrequest, response, y.rest, y.include, y.query...Execute tag must return the data that will be the output of the YQL selectMove business logic of your application to the cloud
  • 23. What you can do with <execute>access APIs that require authenticationNetflix OAuth, FlickrAuth, Google AuthSubjoin data across servicesgrab New York Times article tags and generate find associated flickr photoscombine multiple searches into a single result (twitter, web, news and images)augment data:city/state to APIs that just return zip codecreate APIs from web pagecelebrity birthdays scraped from imdb, caltraindata transformationconvert the result from xml to Google's kml format
  • 24. hello world<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"><meta> <sampleQuery>select * from {table} where a=’hello' and b=’world';</sampleQuery></meta><bindings><select itemPath="" produces="XML"><urls><url>http://fake.url/{a}</url></urls><inputs><key id='a' type='xs:string' paramType='path' required="true" /><key id='b' type='xs:string' paramType='variable' required="true" /></inputs><execute><![CDATA[// Your javascript goes here. We will run it on our serversresponse.object = <item><url>{request.url}</url><a>{a}</a> <b>{b}</b> </item>; ]]></execute> </select> </bindings></table>
  • 25. Scraping a page<select produces="XML" itemPath="deals.deal"> <urls><url>http://deals.yahoo.com</url></urls> <execute><![CDATA[vardealhtml = y.query("select * from html where url='http://deals.yahoo.com' and xpath='//div[contains(@class, \"product-display\")]'").results;var deals = <deals/>;function compress(object) { if (!object) return ""; return object.toString().replace(/\s+/, " ")}for each (var div in dealhtml.div) {var deal = <deal/>;deal.name += <name>{compress(div.h3.a.text())}</name>;deal.link += <link>{div.div[0].a.@href}</link>;…deal.description += <description>{compress(div.p[0].*)}</description>;deal.logo += <logo>{compress(div.div[1].*)}</logo>;deals.deal += deal;}response.object = deals; ]]></execute> </select>
  • 26. Twitter Selectselect *from twitter.statuswhere id="2108869549"andusername="xxx"and password="yyy”<select itemPath="" produces="XML"> <urls><url>http://twitter.com/statuses/show/{id}.xml</url></urls> <inputs> <key id="username" type="xs:string" required="false" paramType="variable"/> <key id="password" type="xs:string" required="false" paramType="variable"/> <key id="id" type="xs:integer" required="true" paramType="path"/> </inputs> <execute><![CDATA[varr = null; if (username && password) { y.include("http://yqlblog.net/samples/base64.js");varauthheader = "Basic "+Base64.encode(username+":"+password);r = request.header("Authorization",authheader).get().response; } else {r = request.get().response; }response.object = r; ]]></execute></select>
  • 27. Twitter Updateinsert into twitter.status(status,username,password)values ("new tweet from YQL",”xxx”,”yyy”);<insert itemPath="" produces="XML"> <urls> <url>http://twitter.com/statuses/update.xml</url> </urls> <inputs> <value id="username" type="xs:string" required="true" paramType="variable"/> <value id="password" type="xs:string" required="true" paramType="variable"/> <value id="status" type="xs:string" required="true" paramType="variable"/> </inputs> <execute><![CDATA[ y.include("http://yqlblog.net/samples/base64.js");varauthheader = "Basic "+Base64.encode(username+":"+password);var content = "status="+status;response.object = request.header("Authorization",authheader).post(content).response; ]]></execute></insert>
  • 28. Twitter Deletedelete from twitter.statuswhere id="2108869549"and username="xxx"and password="yyy”<delete itemPath="" produces="XML"> <urls> <url>http://twitter.com/statuses/destroy/{id}.xml</url> </urls> <inputs> <key id="username" type="xs:string" required="true" paramType="variable"/> <key id="password" type="xs:string" required="true" paramType="variable"/> <key id="id" type="xs:string" required="true" paramType="path"/> </inputs> <execute><![CDATA[y.include("http://yqlblog.net/samples/base64.js");varauthheader = "Basic "+Base64.encode(username+":"+password);response.object = request.header("Authorization",authheader).del().response; ]]></execute></delete>
  • 29. ConclusionMore easily build applicationsfewer lines of codedata processing done away from appconsistent and familiar syntax for all data access
  • 30. ConclusionBuild applications that run fasterservice in the cloud does the work
  • 31. store tables, environments, js, text files…
  • 32. conversion, filtering, parallel requests...With smaller network footprintfewer (client) callssmaller data amountscloser to the data, fatter pipes
  • 35. Easy to integrate into any development environment w/ HTTPQuestions?http://developer.yahoo.com/yqlDerek Gathrightdrg@yahoo-inc.comtwitter.com/derekmeetup.com/socaljs