Your SlideShare is downloading. ×
0
ql.io and Node.js: Next GenerationOpen Source Web Querying System                                 Jonathan LeBlanc        ...
Topics We’ll Be Covering        Overview of ql.io        Language Specifications        Monkey Patching & Enhancements    ...
Topics We’ll Be Covering        Overview of ql.io        Language Specifications        Monkey Patching & Enhancements    ...
ql.io: The Problem is API Overload
ql.io: Developing for Mobile
ql.io: Reducing Workload + Processing                Reduced Documentation                Reduced Code Length             ...
ql.io: Increasing Performance (Requests)
ql.io: Error Handling and Reporting
ql.io: Open Standard Foundation
ql.io: Using the System     Web Endpoint     Standalone Server
ql.io: Quering the Web Endpoint        HTTP GET        http://ql.io/q?s=QUERY
ql.io: Using the Standalone Server      Data   (internal)                  ql.io        Node Host      Data   (external)
Topics We’ll Be Covering        Overview of ql.io        Language Specifications        Monkey Patching & Enhancements    ...
Language: Defining a Data Source   Include in Request   Include in .ql Table
Language: Create Table for Data Source  create table TABLE_NAME      on select get from "http://api.com/?val1={val1}"     ...
Language: Sample Github Issues Table  create table github.issues      on select get from "https://github.com/api/v2/json/ ...
Language: Obtain Data From New Tables        select * from TABLE_NAME           where val1="VALUE"           and val2="VAL...
Language: Sample Github Table Call         select * from github.issues             where user="jcleblanc"             and ...
Language: Insert Request      insert into bitly.shorten (longUrl)          values (http://ql.io/docs);               "http...
Language: Nested Selects select ItemID, ViewItemURLForNaturalSearch, Location     from details     where itemId     in (se...
ql.io: The Test Console      Test Console: http://ql.io/console
Language: Including Script Routes user = "jcleblanc"; slides = select * from slideshare where user="{user}"; twitter = sel...
Language: Using Script Routes curl --header "content-type: application/x-www-form-urlencoded"            -d "user=jcleblan...
Topics We’ll Be Covering        Overview of ql.io        Language Specifications        Monkey Patching & Enhancements    ...
Patching: Including the Monkey Patch  create table TABLE_NAME      on select get from "http://api.com/?val1={val1}"      u...
Patching: Validating Input Parameters exports[validate param] = function(args, param, value) {    switch(param) {        c...
Patching: The Body Patch exports[patch body] = function() {   return {      type: application/json,      content: JSON.str...
Patching: The Response Patch   exports[patch response] = function(args){      var body = args.body;       //modify respons...
Topics We’ll Be Covering        Overview of ql.io        Language Specifications        Monkey Patching & Enhancements    ...
Node.js: Installing the Package           npm install ql.io-engine
Node.js: Including the Engine       var Engine = require(ql.io-engine);       var engine = new Engine({                   ...
Node.js: Building the Script
Topics We’ll Be Covering        Overview of ql.io        Language Specifications        Monkey Patching & Enhancements    ...
Tools: API Masher    Visualization Engine:    https://github.com/jcleblanc/api-masher    Technology Backbone      – ql.io ...
Tools: API Masher var format = “<li><a href=‘{{link}}’ target=‘_blank’>     <img src=‘{{media:content.media:thumbnail.url}...
Tools: API Masher var query = “create table slideshare   on select get from ‘http://www.slideshare.net/rss/user/{user}’   ...
Tools: API Masher Results    Showcase Website: http://jcleblanc.com
Tools: External API Tables     Tables Source:     https://github.com/jcleblanc/ql.io-tables
ql.io: The Link
Thank You!http://slidesha.re/ql-io-node                  Jonathan LeBlanc Developer Evangelist: X.commerce            Emai...
Upcoming SlideShare
Loading in...5
×

2012: ql.io and Node.js

5,398

Published on

June 2012 presentation on ql.io and working with the system inside Node.js applications.

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

No Downloads
Views
Total Views
5,398
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
24
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • Mashing up multiple data sourcesPerformance issuesAdd slides showing performance hits
  • Most mobile applications will, on average, make at least 5+ HTTP data requests per UI paint.
  • Language based on a SQL-like syntax which exports all data to JSON
  • If you’re using the web endpoint you would make HTTP GET requests to the API endpoint, inserting your query in the request. A JSON response will be returned to you.
  • If you download the standalone server version of ql.io, it will sit on top of your existing node server (or within your node applications) and be able to query your internal data and/or external data sources
  • A create table call (to define a data source) may be included in the HTTP request to the ql.io web source or defined in a .ql file, which is added into the /tables directory of your application.
  • Update / Delete requests not currently supported, but are being actively worked on.
  • create table slideshare on select get from &quot;http://www.slideshare.net/rss/user/{user}&quot; resultset &quot;rss.channel&quot;;create table github.users on select get from &quot;http://github.com/api/v2/json/user/show/{user}&quot;;user = &quot;jcleblanc&quot;;slides = select * from slideshare where user=&quot;{user}&quot;;twitter = select * from github.users where user=&quot;{user}&quot;;return { &quot;slides&quot;: &quot;{slides}&quot;, &quot;twitter&quot;: &quot;{twitter}&quot;}
  • Route files are also stored with the .ql extension but are placed under the routes directory
  • var script = &quot;create table geocoder &quot; + &quot; on select get from &apos;http://maps.googleapis.com/maps/api/geocode/json?address={address}&amp;sensor=true&apos; &quot; + &quot; resultset &apos;results.geometry.location&apos;&quot; + &quot;select lat as lattitude, lng as longitude from geocoder where address=&apos;Mt. Everest&apos;&quot;;engine.execute(script, function(emitter) {emitter.on(&apos;end&apos;, function(err, res) {console.log(res.body[0]); });});
  • var script = &quot;create table geocoder &quot; + &quot; on select get from &apos;http://maps.googleapis.com/maps/api/geocode/json?address={address}&amp;sensor=true&apos; &quot; + &quot; resultset &apos;results.geometry.location&apos;&quot; + &quot;select lat as lattitude, lng as longitude from geocoder where address=&apos;Mt. Everest&apos;&quot;;engine.execute(script, function(emitter) {emitter.on(&apos;end&apos;, function(err, res) {console.log(res.body[0]); });});
  • Transcript of "2012: ql.io and Node.js"

    1. 1. ql.io and Node.js: Next GenerationOpen Source Web Querying System Jonathan LeBlanc Developer Evangelist: X.commerce Email: jleblanc@x.com Twitter: @jcleblanc Github: github.com/jcleblanc
    2. 2. Topics We’ll Be Covering Overview of ql.io Language Specifications Monkey Patching & Enhancements Integrating Into Your Node Applications Tools and More
    3. 3. Topics We’ll Be Covering Overview of ql.io Language Specifications Monkey Patching & Enhancements Integrating Into Your Node Applications Tools and More
    4. 4. ql.io: The Problem is API Overload
    5. 5. ql.io: Developing for Mobile
    6. 6. ql.io: Reducing Workload + Processing Reduced Documentation Reduced Code Length Reduced Result Syncing
    7. 7. ql.io: Increasing Performance (Requests)
    8. 8. ql.io: Error Handling and Reporting
    9. 9. ql.io: Open Standard Foundation
    10. 10. ql.io: Using the System Web Endpoint Standalone Server
    11. 11. ql.io: Quering the Web Endpoint HTTP GET http://ql.io/q?s=QUERY
    12. 12. ql.io: Using the Standalone Server Data (internal) ql.io Node Host Data (external)
    13. 13. Topics We’ll Be Covering Overview of ql.io Language Specifications Monkey Patching & Enhancements Integrating Into Your Node Applications Tools and More
    14. 14. Language: Defining a Data Source Include in Request Include in .ql Table
    15. 15. Language: Create Table for Data Source create table TABLE_NAME on select get from "http://api.com/?val1={val1}" using defaults val1="VALUE", val2="VALUE”;
    16. 16. Language: Sample Github Issues Table create table github.issues on select get from "https://github.com/api/v2/json/ issues/list/{user}/{repository}/ {state}/" using defaults state="open";
    17. 17. Language: Obtain Data From New Tables select * from TABLE_NAME where val1="VALUE" and val2="VALUE" limit 10 offset 3;
    18. 18. Language: Sample Github Table Call select * from github.issues where user="jcleblanc" and repository="reddit-php-sdk"; { "comments": 0, "body": "http://www.phpdoc.org/", "title": "Use standardized documentation", "updated_at": "2011/12/11 13:49:07 -0800", "html_url": "https://github.com/jcleblanc/reddit-php-sdk/issues/3", "state": "open” }
    19. 19. Language: Insert Request insert into bitly.shorten (longUrl) values (http://ql.io/docs); "http://bit.ly/uZIvmY"
    20. 20. Language: Nested Selects select ItemID, ViewItemURLForNaturalSearch, Location from details where itemId in (select itemId from finditems where keywords=mini cooper); [ "330730216553", "http://www.ebay.com/itm/Clubman-Auto-Sunroof-Prem-…", "Huntingdon Valley, Pennsylvania" ],
    21. 21. ql.io: The Test Console Test Console: http://ql.io/console
    22. 22. Language: Including Script Routes user = "jcleblanc"; slides = select * from slideshare where user="{user}"; twitter = select * from github.users where user="{user}"; return { "slides": "{slides}", "twitter": "{twitter}" } via route /social using method post;
    23. 23. Language: Using Script Routes curl --header "content-type: application/x-www-form-urlencoded" -d "user=jcleblanc" http://localhost:3000/social
    24. 24. Topics We’ll Be Covering Overview of ql.io Language Specifications Monkey Patching & Enhancements Integrating Into Your Node Applications Tools and More
    25. 25. Patching: Including the Monkey Patch create table TABLE_NAME on select get from "http://api.com/?val1={val1}" using defaults val1="VALUE" using patch "patch.js";
    26. 26. Patching: Validating Input Parameters exports[validate param] = function(args, param, value) { switch(param) { case duration : return !isNaN(value - 0) default: return true; } }
    27. 27. Patching: The Body Patch exports[patch body] = function() { return { type: application/json, content: JSON.stringify({message : aok}) }; }
    28. 28. Patching: The Response Patch exports[patch response] = function(args){ var body = args.body; //modify response body return body; }
    29. 29. Topics We’ll Be Covering Overview of ql.io Language Specifications Monkey Patching & Enhancements Integrating Into Your Node Applications Tools and More
    30. 30. Node.js: Installing the Package npm install ql.io-engine
    31. 31. Node.js: Including the Engine var Engine = require(ql.io-engine); var engine = new Engine({ connection: close });
    32. 32. Node.js: Building the Script
    33. 33. Topics We’ll Be Covering Overview of ql.io Language Specifications Monkey Patching & Enhancements Integrating Into Your Node Applications Tools and More
    34. 34. Tools: API Masher Visualization Engine: https://github.com/jcleblanc/api-masher Technology Backbone – ql.io – jQuery – Mustache Templates
    35. 35. Tools: API Masher var format = “<li><a href=‘{{link}}’ target=‘_blank’> <img src=‘{{media:content.media:thumbnail.url}}’ width=‘{{media:content.media:thumbnail.width}}’ height=‘{{media:content.media:thumbnail.height}}’ /></a> <br /><span class=‘small’> <a href=‘{{link}}’ target=‘_blank’>{{title}}</a></span></li>”;
    36. 36. Tools: API Masher var query = “create table slideshare on select get from ‘http://www.slideshare.net/rss/user/{user}’ resultset ‘rss.channel’; select * from slideshare where user=“jcleblanc” var insertEl = “widgetContainer”; parser.push(query, format, insertEl); parser.render();
    37. 37. Tools: API Masher Results Showcase Website: http://jcleblanc.com
    38. 38. Tools: External API Tables Tables Source: https://github.com/jcleblanc/ql.io-tables
    39. 39. ql.io: The Link
    40. 40. Thank You!http://slidesha.re/ql-io-node Jonathan LeBlanc Developer Evangelist: X.commerce Email: jleblanc@x.com Twitter: @jcleblanc Github: github.com/jcleblanc
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×