Click here to load reader

Datasets by David Semeria

  • View
    765

  • Download
    2

Embed Size (px)

DESCRIPTION

LM Datasets - Promote data and code sharing on the web

Text of Datasets by David Semeria

2. Objects Properties (data) Methods (code)Interface LM Datasets 2 3. Objects Properties (data) Methods (code)Functional abstraction (GOOD)Interface LM Datasets 3 4. Objects Properties (data) Data abstraction (BAD) Methods (code)Functional abstraction (GOOD)Interface LM Datasets 4 5. Objects Properties (data)Data abstraction (BAD) Methods (code) Functional abstraction (GOOD)InterfaceContext: web services Interoperability is key LM Datasets5 6. InteroperabilityBrowserTwitter FacebookFlickrBit.lyLM Datasets6 7. InteroperabilityBrowserTwitter FacebookFlickrBit.lyLM Datasets7 8. How Much Glue Code?Twitter Facebook Facebook TwitterTwitterFlickrFacebook FlickrTwitterBit.lyFacebook Bit.ly FlickrTwitter Bit.ly Twitter Flickr Facebook Bit.lyFacebook Flickr Bit.ly Bitl.lyFlickr 12 sets of codeN2 - NLM Datasets 8 9. The General CaseBrowserService A Service BChoose from N options Choose from N optionsLM Datasets 9 10. The General CaseBrowserService A Service BChoose from N options Choose from N optionsFor N = 100 N2 N = 99,900LM Datasets 10 11. The ProblemAPIs are better than nothing, but theyremain a major impediment to a fully writable Web. (The same applies to corporate intranets)LM Datasets11 12. DatasetsA generic Global data definitionsrepresentation forhierarchical dataPermissionsLIBRARY( Front and back end )Key word: GENERICLM Datasets 12 13. Hierarchical Structuresroot nodenodenode leafleaf nodenodeleafleafleafleaf LM Datasets13 14. A people tree rootpeoplesportmusic Id: bowie Id: clapton name: David Bowie name: Eric Clapton soccer formula1Id: maldini Id: gerrard Id: alonsoId: hamiltonname: Paolo Maldini name: Steven Gerrardname: Fernando Alonso name: Lewis Hamilton LM Datasets 14 15. Generic RepresentationSroot node 1node 2node 1leaf 1leaf 2node 2R node 1 recordnode 2 recordleaf 1 recordleaf 2 recordLM Datasets15 16. JSON Exampleds: { s: { root:{ people: 1}, people:{ music:1, sport:1 }, sport: { soccer: 1, forumla1: 1 },music:{ bowie: 1, clapton: 1 },soccer: { maldini: 1, gerrard: 1 },formula1: { alonso: 1, hamilton: 1 }},r: { people:{ name: People,color: green}, music: { name: Musiccolor: black}, sport: { name: Sportcolor: white}, soccer:{ name: Soccer,colorred}, formula1:{ name: Formula One, color: yellow },bowie:{ name: David Bowie, color: black},clapton:{ name: Eric Clapton,color: black},Maldini:{ name: Paolo Maldini, color: red},Gerrard:{ name: Steven Gerrard,color: red},Alonso: { name: Fernando Alonso, color: red},Hamilton: { name: Lewis Hamilton,color: silver }} };LM Datasets 16 17. Some Code Examples Leverage structure No need for recursive tree walking Leverage native operations Object property look-up much faster than array iteration.LM Datasets 17 18. ID Exists ?function IdExists (id){return ds.r[id] != null;}LM Datasets18 19. Node or Leaf ? function nodeOrLeaf (id){return (ds.s[id]) ?node :leaf; } // assumes id existsLM Datasets19 20. Node contains id ? function contains (nodeId, id){if (ds.s[nodeId][id]){return true;}return false } // assumes nodeId existsLM Datasets 20 21. Parent Node function parentNode (id){for ( var k in ds.s ){if (ds.s[k][id]){return k;}}//error }LM Datasets 21 22. Move Item function move ( toNodeId, id ){delete( ds.s[parenNode(id)][id] );ds.s[toNodeId][id] = 1; } // assumes all ids existLM Datasets22 23. TemplatesDATASET FLOW +HTMLTEMPLATESLM Datasets23 24. NODE TEMPLATE:Flowing Templates

LEAF TEMPLATE:

{name}

LM Datasets 24 25. Flowing Templates NODE TEMPLATE:

LEAF TEMPLATE:

{name}

OUTPUT:David BowieEric ClaptonPaolo MaldiniSteven GerrardFernando AlonsoLewis HamiltonLM Datasets 25 26. Demo 1LM Datasets26 27. Data DefinitionsEXAMPLE DEFINITIONNameAgetype string type integerminLen 1minVal 0maxLen 50 maxVal 150canBeNumeric falseregex(w| )*function checkNameLM Datasets27 28. Inheritance PEOPLE PLACESTHINGS ......BASIC INFODETAILED INFO EMAIL INFO DETAILED & EMAIL INFOLM Datasets 28 29. Inheritance Across Root Types PEOPLE SERVICEBASIC INFOTWITTERDETAILED INFO TWITTER INFOTWITTER USER is a sub-type of both:SERVICE / TWITTER / TWITTER INFOTWITTER USERPEOPLE / BASIC INFOLM Datasets 29 30. InheritanceDemo 2LM Datasets 30 31. NormalizationJust like in the relational model, Datasetnormalization means we dont store the same information twice....LM Datasets31 32. Viewsets and RecordsetsVIEWSET A VIEWSET BrefsRECORD SET 1 sparse RECORD SET 2 SERVERLM Datasets32 33. Demo 3windowsLIVERPOOL MILAN #1MILAN #2DREAM TEAMview sets VS - LIVERPOOLVS - MILANVS DREAM TEAMRECORD SET FOOTBALLERSSERVERLM Datasets33 34. Demo 3windowsLIVERPOOL MILAN #1MILAN #2DREAM TEAMview sets VS - LIVERPOOLVS - MILANVS DREAM TEAMRECORD SET FOOTBALLERSSERVERLM Datasets34 35. Demo 3windowsLIVERPOOL MILAN #1MILAN #2DREAM TEAMview sets VS - LIVERPOOLVS - MILANVS DREAM TEAMRECORD SET FOOTBALLERSSERVERLM Datasets35 36. Demo 3windowsLIVERPOOL MILAN #1MILAN #2DREAM TEAMview sets VS - LIVERPOOLVS - MILANVS DREAM TEAMRECORD SET FOOTBALLERSSERVERLM Datasets36 37. Demo 3windowsLIVERPOOL MILAN #1MILAN #2DREAM TEAMview sets VS - LIVERPOOLVS - MILANVS DREAM TEAMRECORD SET FOOTBALLERSSERVERLM Datasets37 38. Demo 3windowsLIVERPOOL MILAN #1MILAN #2DREAM TEAMview sets VS - LIVERPOOLVS - MILANVS DREAM TEAMRECORD SET FOOTBALLERSSERVERLM Datasets38 39. Summary Dont hide your data in objectsLM Datasets 39 40. Summary Dont hide your data in objects APIs can be an obstacle (representation)LM Datasets40 41. Summary Dont hide your data in objects APIs can be an obstacle (representation) Above all, KEEP IT GENERIC !!LM Datasets41 42. Summary Dont hide your data in objects APIs can be an obstacle (representation) Above all, KEEP IT GENERIC !!Questions are welcome:[email protected]@hymanrothLM Datasets42

Search related