Yql ans geo

449 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
449
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 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

    1. 1. http://www.flickr.com/photos/han_shot_first/6573340265/
    2. 2. YQL 1 API to rule them all http://www.flickr.com/photos/han_shot_first/6573340265/
    3. 3. What • YQL is Yahoo! Query Language – Web service – SQL like syntax – SELECT * FROM internet;
    4. 4. What Unstructured data Data via YQL
    5. 5. Console
    6. 6. Console Tables are here
    7. 7. Console Your query goes here
    8. 8. Console Output is here
    9. 9. Console Take-away URL here
    10. 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. 11. Output
    12. 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. 13. Unstructured data • Reading google spreadsheets • https://docs.google.com/spreadsheet/pub?key=0A gGxPO1AxEhldFZDNzAzQldLSGp2MzVGVXdlUnI xeUE&output=csv • select * from csv where url = ””
    14. 14. Why • Unstructured data – Yes, YQL is cool. But … • Why use YQL – When webservices are already available • Lets see why, via an example
    15. 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. 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. 17. Examples – Content Analysis
    18. 18. Examples – Content Analysis
    19. 19. Unstructured data, easy api access. What else? http://www.flickr.com/photos/brickultra/7178444546/
    20. 20. SQL like… JOINS? • YQL does not support joins natively • Supports sub-selects – Let’s look at an example
    21. 21. SQL like… JOINS? 1. Get content from a web page
    22. 22. SQL like… JOINS? 2. Identify entities in that content
    23. 23. SQL like… JOINS? 3. Search for photos with entity names
    24. 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. 25. How? – Devil is in the details http://www.flickr.com/photos/prodiffusion/8267223638/
    26. 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. 27. How to use • Javascript
    28. 28. Ask. Answer. Discover Y! Answers http://www.flickr.com/photos/funkyporcupine/8290971054/
    29. 29. Answers - Tables
    30. 30. http://developer.yahoo.com/answers/
    31. 31. Where, what’s there and how to reach Geo http://www.flickr.com/photos/carthalis/3562768042/
    32. 32. Current Location - Ask • Ask the user
    33. 33. Current Location - Ask • Ask the browser
    34. 34. Current Location - Ask
    35. 35. Current Location - Sniff http://isithackday.com/hacks/geo/js-location.html
    36. 36. Geocoding
    37. 37. Reverse geocoding
    38. 38. Woeid • Where-On-Earth-ID
    39. 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. 40. Geoplanet
    41. 41. Placemaker
    42. 42. Geo Hacks • http://trendsmap.com/local/india • http://isithackday.com/hacks/geo/
    43. 43. Happy hacking! Thank You http://www.flickr.com/photos/brickaholicproductions/5177947158/

    ×