Persistent Computing on the Web with JSON Schema and Referencing <ul><li>Kris Zyp </li></ul>
Overview <ul><li>JSON Referencing </li></ul><ul><li>JSON Schema </li></ul><ul><li>The possiblities... </li></ul>
JSON + Hyperlinks = JSON Referencing
JSON Referencing <ul><li>Cyclic </li></ul><ul><li>Multiple references </li></ul><ul><li>Cross-message references </li></ul...
JSON Referencing (ID Based)‏ <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, </li></ul></ul><ul><ul><li>“ id”:”kriszyp...
JSON Referencing (Path Based)‏ <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, “children”:[{“name”:”Jennika Zyp”}], </...
JSON Referencing (ID + Path)‏ <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, </li></ul></ul><ul><ul><li>“ id”:”kriszy...
JSON + Schema = JSON Schema
JSON Schema <ul><li>schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&...
JSON Schema <ul><li>Schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&...
JSON Schema <ul><li>Schema: </li></ul><ul><li>{“type”:”array”, “items”:[{“type”:”string”},{“type”:”number”}] } </li></ul><...
JSON Schema <ul><li>Schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&...
JSON Schema <ul><li>Schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&...
JSON Schema <ul><li>schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&...
What can we do with these?
JSON Schema + JSON Referencing <ul><li>{&quot;description&quot;:&quot;A Social Person&quot;,  “id”:”socialperson”, </li></...
JSON Referencing + REST <ul><li>Lazy loading - Generic clients can auto-load objects as necessary </li></ul><ul><li>Object...
JSON Referencing + REST <ul><li>GET /Person/3 </li></ul><ul><li>{ </li></ul><ul><li>“ name”:”Kris”, </li></ul><ul><li>“ fr...
JSON Referencing + JSON-RPC <ul><li>POST /person/kriszyp </li></ul><ul><li>{ </li></ul><ul><ul><li>“ method”:”addFriend”, ...
Applying data definitions to code
JSON Schema + Typed Code
JSON Schema Interfaces
JSON Schema Interface <ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&quot;:&quot;obje...
Cross-site Referencing <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, </li></ul></ul><ul><ul><li>“ id”:”kriszyp”, </l...
Cross-site Typing
Mobile code (run anywhere)‏ <ul><li>Code can run anywhere </li></ul><ul><ul><li>Server JavaScript Environment </li></ul></...
Connecting and structuring data for the future JSON Schema and JSON Referencing
 
Upcoming SlideShare
Loading in...5
×

JSON Referencing and Schema

9,864

Published on

Published in: Technology
1 Comment
12 Likes
Statistics
Notes
No Downloads
Views
Total Views
9,864
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
208
Comments
1
Likes
12
Embeds 0
No embeds

No notes for slide
  • JSON Referencing and Schema

    1. 1. Persistent Computing on the Web with JSON Schema and Referencing <ul><li>Kris Zyp </li></ul>
    2. 2. Overview <ul><li>JSON Referencing </li></ul><ul><li>JSON Schema </li></ul><ul><li>The possiblities... </li></ul>
    3. 3. JSON + Hyperlinks = JSON Referencing
    4. 4. JSON Referencing <ul><li>Cyclic </li></ul><ul><li>Multiple references </li></ul><ul><li>Cross-message references </li></ul><ul><li>Cross-site references </li></ul>http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo/
    5. 5. JSON Referencing (ID Based)‏ <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, </li></ul></ul><ul><ul><li>“ id”:”kriszyp”, “children”:[{“id”:”jennikazyp”,“name”:”Jennika Zyp”}], </li></ul></ul><ul><ul><li>“ spouse”:{ </li></ul></ul><ul><ul><ul><li>“ name”:”Nicole Zyp”, “spouse”:{“$ref”:”kriszyp”}, </li></ul></ul></ul><ul><ul><ul><li>“ children”:[{“$ref”:”jennikazyp”}] </li></ul></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>} </li></ul>
    6. 6. JSON Referencing (Path Based)‏ <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, “children”:[{“name”:”Jennika Zyp”}], </li></ul></ul><ul><ul><li>“ spouse”:{ </li></ul></ul><ul><ul><ul><li>“ name”:”Nicole Zyp”, “spouse”:{“$ref”:”#”}, </li></ul></ul></ul><ul><ul><ul><li>“ children”:{“$ref”:”#.children”} </li></ul></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>} </li></ul>
    7. 7. JSON Referencing (ID + Path)‏ <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, </li></ul></ul><ul><ul><li>“ id”:”kriszyp”, “children”:[{“name”:”Jennika Zyp”}], </li></ul></ul><ul><ul><li>“ friends”:[{“$ref”:”jesse#.spouse”}] </li></ul></ul><ul><li>} </li></ul>
    8. 8. JSON + Schema = JSON Schema
    9. 9. JSON Schema <ul><li>schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&quot;:&quot;object&quot;, </li></ul><ul><li>&quot;properties&quot;: </li></ul><ul><li>{&quot;name&quot;: {&quot;type&quot;:&quot;string&quot;}, </li></ul><ul><li>&quot;age&quot; : {&quot;type&quot;:&quot;integer&quot;, </li></ul><ul><li>&quot;maximum&quot;:125}} </li></ul><ul><li>} </li></ul><ul><li>instance: </li></ul><ul><li>{“name”:”Kris”, </li></ul><ul><li>“ age”:30} </li></ul>
    10. 10. JSON Schema <ul><li>Schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&quot;:&quot;object&quot;, </li></ul><ul><li>&quot;properties&quot;: </li></ul><ul><li>{&quot;name&quot;: {&quot;type&quot;:&quot;string&quot;}, </li></ul><ul><li>&quot;age&quot; : {&quot;type&quot;:&quot;integer&quot;, </li></ul><ul><li>&quot;maximum&quot;:125, “optional”:true}, “friends”: {“type”:”array”, “items”:{“type”:”object”}} } </li></ul><ul><li>} </li></ul><ul><li>instance: </li></ul><ul><li>{“name”:”Kris”, </li></ul><ul><li>“ friends”:[{“name”:”Nikki”}] </li></ul><ul><li>} </li></ul>
    11. 11. JSON Schema <ul><li>Schema: </li></ul><ul><li>{“type”:”array”, “items”:[{“type”:”string”},{“type”:”number”}] } </li></ul><ul><li>instance: </li></ul><ul><li>[“foo”,44] </li></ul>
    12. 12. JSON Schema <ul><li>Schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&quot;:[&quot;object&quot;,”string”] </li></ul><ul><li>} </li></ul><ul><li>instance: </li></ul><ul><li>“ foo” </li></ul><ul><li>instance: </li></ul><ul><li>{“prop”:3} </li></ul>
    13. 13. JSON Schema <ul><li>Schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&quot;:[&quot;object&quot;,”string”] </li></ul><ul><li>} </li></ul><ul><li>instance: </li></ul><ul><li>“ foo” </li></ul><ul><li>instance: </li></ul><ul><li>{“prop”:3} </li></ul>
    14. 14. JSON Schema <ul><li>schema: </li></ul><ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&quot;:&quot;object&quot;, </li></ul><ul><li>&quot;properties&quot;: </li></ul><ul><li>{&quot;name&quot;: {&quot;type&quot;:&quot;string&quot;}, </li></ul><ul><li>&quot;gender&quot; : {&quot;type&quot;:&quot;string&quot;, </li></ul><ul><ul><ul><ul><li>&quot;enum”:[“male”,”female”]}}, </li></ul></ul></ul></ul><ul><li>“ additionalProperties”:false </li></ul><ul><li>} </li></ul><ul><li>instance: </li></ul><ul><li>{“name”:”Kris”, </li></ul><ul><li>“ gender”:”male”} </li></ul>
    15. 15. What can we do with these?
    16. 16. JSON Schema + JSON Referencing <ul><li>{&quot;description&quot;:&quot;A Social Person&quot;, “id”:”socialperson”, </li></ul><ul><li>&quot;type&quot;:&quot;object&quot;, </li></ul><ul><li>&quot;properties&quot;: </li></ul><ul><li>{&quot;name&quot;: {&quot;type&quot;:&quot;string&quot;}, </li></ul><ul><li>&quot;age&quot; : { </li></ul><ul><ul><ul><li>&quot;type&quot;:&quot;integer&quot;, </li></ul></ul></ul><ul><li>&quot;maximum&quot;:125 </li></ul><ul><ul><li>}, </li></ul></ul><ul><ul><li>&quot;friends&quot; : { </li></ul></ul><ul><ul><ul><li>“ type” : ”array”, </li></ul></ul></ul><ul><ul><ul><li>“ items” : {“$ref”:”socialperson”} </li></ul></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>}, </li></ul><ul><li>“ extends”:{“$ref”:”person”} </li></ul><ul><li>} </li></ul>
    17. 17. JSON Referencing + REST <ul><li>Lazy loading - Generic clients can auto-load objects as necessary </li></ul><ul><li>Object identification can be used for saving state changes </li></ul>http://blog.medryx.org/2008/07/24/jsonreststore-overview/
    18. 18. JSON Referencing + REST <ul><li>GET /Person/3 </li></ul><ul><li>{ </li></ul><ul><li>“ name”:”Kris”, </li></ul><ul><li>“ friends”:[ </li></ul><ul><ul><li>{“$ref”:”4”}, </li></ul></ul><ul><ul><li>{“$ref”:”5”} </li></ul></ul><ul><li>] </li></ul><ul><li>} </li></ul>
    19. 19. JSON Referencing + JSON-RPC <ul><li>POST /person/kriszyp </li></ul><ul><li>{ </li></ul><ul><ul><li>“ method”:”addFriend”, </li></ul></ul><ul><ul><li>“ id”:”1”, </li></ul></ul><ul><ul><li>“ params”:[{“$ref”:”jessesmith”}] </li></ul></ul><ul><li>} </li></ul>
    20. 20. Applying data definitions to code
    21. 21. JSON Schema + Typed Code
    22. 22. JSON Schema Interfaces
    23. 23. JSON Schema Interface <ul><li>{&quot;description&quot;:&quot;A person&quot;, </li></ul><ul><li>&quot;type&quot;:&quot;object&quot;, </li></ul><ul><li>&quot;properties&quot;: </li></ul><ul><li>{&quot;name&quot;: {&quot;type&quot;:&quot;string&quot;} }, “methods”:{ “getName”:{“returns”:{“type”:”string”}, “params”:[]}, “setName”:{“params”:[{“type”:”string”}]}, } </li></ul><ul><li>} </li></ul>
    24. 24. Cross-site Referencing <ul><li>{ </li></ul><ul><ul><li>“ name”:”Kris Zyp”, </li></ul></ul><ul><ul><li>“ id”:”kriszyp”, </li></ul></ul><ul><ul><li>“ friends”:[ </li></ul></ul><ul><ul><ul><li>{“$ref”:” http://thezyps.com/person/nikki ”}, </li></ul></ul></ul><ul><ul><ul><li>{“$ref”:” http://social.com/user/33 ”} </li></ul></ul></ul><ul><ul><li>] </li></ul></ul><ul><li>} </li></ul>
    25. 25. Cross-site Typing
    26. 26. Mobile code (run anywhere)‏ <ul><li>Code can run anywhere </li></ul><ul><ul><li>Server JavaScript Environment </li></ul></ul><ul><ul><li>Browser JavaScript Environment </li></ul></ul><ul><li>Consistent persisted data structures across environments </li></ul>
    27. 27. Connecting and structuring data for the future JSON Schema and JSON Referencing
    1. A particular slide catching your eye?

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

    ×