Yql ans geo
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Yql ans geo

on

  • 509 views

 

Statistics

Views

Total Views
509
Views on SlideShare
509
Embed Views
0

Actions

Likes
0
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Photo from http://www.flickr.com/photos/han_shot_first/6573340265/
  • Photo from http://www.flickr.com/photos/han_shot_first/6573340265/
  • It is a way to access the data from the internetSimple to learnSQL like syntaxDesc tables
  • YQL is the bridge which converts unstructured data into structured data which can be then consumed by your application
  • YQL provides the output in 2 formats
  • https://docs.google.com/spreadsheet/pub?key=0AgGxPO1AxEhldFZDNzAzQldLSGp2MzVGVXdlUnIxeUE&output=html
  • http://developer.yahoo.com/yql/console/#h=select%20*%20from%20social.profile%20where%20guid%20%3D%20mehttp://developer.yahoo.com/yql/console/#h=select%20*%20from%20flickr.photos.search%20where%20api_key%3D%22...%22%20and%20text%3D%22san%20francisco%22
  • http://developer.yahoo.com/yql/console/#h=select%20*%20from%20contentanalysis.analyze%20where%20text%20%3D%20%22But%20just%20when%20thoughts%20of%20last%20September%27s%20U.S.%20Open%20final%20started%20flashing%20though%20the%20mind%20of%20everyone%20packed%20on%20to%20Centre%20Court%2C%20when%20Djokovic%20rallied%20to%20win%20the%20third%20and%20fourth%20sets%2C%20Murray%20made%20sure%20that%20there%20would%20be%20no%20repeat.%22
  • http://developer.yahoo.com/yql/console/#h=select%20*%20from%20contentanalysis.analyze%20where%20text%20%3D%20%22But%20just%20when%20thoughts%20of%20last%20September%27s%20U.S.%20Open%20final%20started%20flashing%20though%20the%20mind%20of%20everyone%20packed%20on%20to%20Centre%20Court%2C%20when%20Djokovic%20rallied%20to%20win%20the%20third%20and%20fourth%20sets%2C%20Murray%20made%20sure%20that%20there%20would%20be%20no%20repeat.%22
  • Photo from http://www.flickr.com/photos/brickultra/7178444546/sizes/o/in/photostream/
  • http://developer.yahoo.com/yql/guide/joins.html
  • http://developer.yahoo.com/yql/console/#h=select%20content%20from%20html%20where%20url%3D%22http%3A//in.news.yahoo.com/murray-takes-two-set-lead-final-against-djokovic-153758871.html%22%20and%20xpath%3D%27//*%5B@id%3D%22mediaarticlebody%22%5D/div/p%5B29%5D%27
  • http://developer.yahoo.com/yql/console/#h=select%20entity%20from%20contentanalysis.analyze%20where%20text%20IN%20%28select%20content%20from%20html%20where%20url%3D%22http%3A//in.news.yahoo.com/murray-takes-two-set-lead-final-against-djokovic-153758871.html%22%20and%20xpath%3D%27//*%5B@id%3D%22mediaarticlebody%22%5D/div/p%5B29%5D%27%29
  • http://developer.yahoo.com/yql/console/#h=select%20*%20from%20flickr.photos.search%20where%20api_key%3D%22…%22%20and%20text%20IN%20%28select%20entity%20from%20contentanalysis.analyze%20where%20text%20IN%20%28select%20content%20from%20html%20where%20url%3D%22http%3A//in.news.yahoo.com/murray-takes-two-set-lead-final-against-djokovic-153758871.html%22%20and%20xpath%3D%27//*%5B@id%3D%22mediaarticlebody%22%5D/div/p%5B29%5D%27%29%29
  • Photo from http://www.flickr.com/photos/prodiffusion/8267223638/
  • http://www.flickr.com/photos/funkyporcupine/8290971054/sizes/l/in/photostream/
  • http://developer.yahoo.com/answers/
  • Photo from http://www.flickr.com/photos/carthalis/3562768042/sizes/o/in/photostream/
  • http://isithackday.com/hacks/geo/js-location.html
  • Photo from http://www.flickr.com/photos/brickaholicproductions/5177947158/sizes/l/in/photostream/

Yql ans geo Presentation Transcript

  • 1. http://www.flickr.com/photos/han_shot_first/6573340265/
  • 2. YQL 1 API to rule them all http://www.flickr.com/photos/han_shot_first/6573340265/
  • 3. What • YQL is Yahoo! Query Language – Web service – SQL like syntax – SELECT * FROM internet;
  • 4. What Unstructured data Data via YQL
  • 5. Console
  • 6. Console Tables are here
  • 7. Console Your query goes here
  • 8. Console Output is here
  • 9. Console Take-away URL here
  • 10. Output • XML – Human & machine readable • JSON – Javascript object notation – A JS object {} • Key, value pairs including arrays – Callback supported • func_name({“json”:”object”})
  • 11. Output
  • 12. Unstructured data • Page scrapping • select content from html where url="http://in.news.yahoo.com/murray-takes-two- set-lead-final-against-djokovic-153758871.html" and xpath='//*[@id="mediaarticlebody"]/div/p[29]’ • Xpath – path to a node in an XML document
  • 13. Unstructured data • Reading google spreadsheets • https://docs.google.com/spreadsheet/pub?key=0A gGxPO1AxEhldFZDNzAzQldLSGp2MzVGVXdlUnI xeUE&output=csv • select * from csv where url = ””
  • 14. Why • Unstructured data – Yes, YQL is cool. But … • Why use YQL – When webservices are already available • Lets see why, via an example
  • 15. Example – Profile, Flickr • !YQL – Get a user profile • http://social.yahooapis.com/v1/user/{guid}/profile – Search for photos in flickr • http://api.flickr.com/services/rest/?method=flickr.ph otos.search&api_key=…&text=djokovic&format=re st
  • 16. Example – Profile, Flickr • YQL – Get a user profile • select * from social.profile where guid = me – Search for photos in flickr • select * from flickr.photos.search where api_key="..." and text="san francisco"
  • 17. Examples – Content Analysis
  • 18. Examples – Content Analysis
  • 19. Unstructured data, easy api access. What else? http://www.flickr.com/photos/brickultra/7178444546/
  • 20. SQL like… JOINS? • YQL does not support joins natively • Supports sub-selects – Let’s look at an example
  • 21. SQL like… JOINS? 1. Get content from a web page
  • 22. SQL like… JOINS? 2. Identify entities in that content
  • 23. SQL like… JOINS? 3. Search for photos with entity names
  • 24. SQL like… JOINS? • A small demo – http://doc1.ydn.gq1.yahoo.com/mybloglog_test/yqljoin.html – JOINs doesn’t mean single API call • YQL still makes multiple calls – Only one IN allowed per select • Sub-select can also have one IN
  • 25. How? – Devil is in the details http://www.flickr.com/photos/prodiffusion/8267223638/
  • 26. How to use • PHP $yql_query = "select * from answers.getbycategory where category_id=2115500137"; $yql_url = "http://query.yahooapis.com/v1/public/yql?q=" . rawurlencode($yql_query) . "&format=json"; $session = curl_init($yql_url); curl_setopt($session, CURLOPT_RETURNTRANSFER,true); $json = curl_exec($session);
  • 27. How to use • Javascript
  • 28. Ask. Answer. Discover Y! Answers http://www.flickr.com/photos/funkyporcupine/8290971054/
  • 29. Answers - Tables
  • 30. http://developer.yahoo.com/answers/
  • 31. Where, what’s there and how to reach Geo http://www.flickr.com/photos/carthalis/3562768042/
  • 32. Current Location - Ask • Ask the user
  • 33. Current Location - Ask • Ask the browser
  • 34. Current Location - Ask
  • 35. Current Location - Sniff http://isithackday.com/hacks/geo/js-location.html
  • 36. Geocoding
  • 37. Reverse geocoding
  • 38. Woeid • Where-On-Earth-ID
  • 39. Woeid SELECT placeTypeName, name FROM geo.places.ancestors WHERE descendant_woeid = "55925520” SELECT placeTypeName, name FROM geo.places.ancestors WHERE descendant_woeid = "55925520”
  • 40. Geoplanet
  • 41. Placemaker
  • 42. Geo Hacks • http://trendsmap.com/local/india • http://isithackday.com/hacks/geo/
  • 43. Happy hacking! Thank You http://www.flickr.com/photos/brickaholicproductions/5177947158/