Skip to content

Instantly share code, notes, and snippets.

@mamund
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mamund/9578460 to your computer and use it in GitHub Desktop.
Save mamund/9578460 to your computer and use it in GitHub Desktop.
parsing an UBER doc
<data id="user01" name="user"> <!-- URL=false + innerText=false + children=true + parent=false, so this is a container that belongs to the document -->
<data name="actions"> <!-- URL=false + innerText=false + children=true + parent=true, so this is a container that belongs to "user01" -->
<data rel="item" url="/user/1" action="read" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belongs to "user01/actions" -->
<data rel="/rels/replace" url="user/1" action="replace" template="#userUpdate" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01/actions"-->
<data rel="/rels/delete" url="user/1" action="remove" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01/actions" -->
<data rel="/rels/suspend" url="/suspendUser/{id}" action="append" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01/actions" -->
<data rel="/rels/addEmail" url="/user/1?addEmail" action="append" model="{email}" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01/actions" -->
<data rel="related" url="http://example.org/blogs/user01" action="read">Visit my blog</data> <!-- URL=true + innerText=true + children=false + parent=true, so this is a transition (with annotation text) that belongs to "user01/actions" -->
</data>
<data name="properties"> <!-- URL=false + innerText=false + children=true + parent=true, so this is a container belongs to "user01"-->
<data name="givenName">mike</data> <!-- URL=false + innerText=true + children=false + parent=true, so this is a data element that belongs to "user01/properties"-->
<data name="faimlyName">amundsen</data> <!-- URL=false + innerText=true + children=false + parent=true, so this is a data element that belongs to "user01/properties" -->
<data name="email">m...@example.org</data> <!-- URL=false + innerText=true + children=false + parent=true, so this is a data element that belongs to "user01/properties" -->
</data>
</data>
@benhamill
Copy link

An alternative way to render this same data (right?):

<data id="user01" name="user" rel="item" url="/user/1" action="read"> <!-- URL=true + innerText=false + children=true + parent=false, so this is a container that belongs to the document as well as a transition --> 
  <data rel="/rels/replace" url="user/1" action="replace" template="#userUpdate" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01"-->
  <data rel="/rels/delete" url="user/1" action="remove" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01" -->
  <data rel="/rels/suspend" url="/suspendUser/{id}" action="append" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01" -->
  <data rel="/rels/addEmail" url="/user/1?addEmail" action="append" model="{email}" /> <!-- URL=true + innerText=false + children=false + parent=true, so this is a transition that belowngs to "user01" -->
  <data rel="related" url="http://example.org/blogs/user01" action="read">Visit my blog</data> <!-- URL=true + innerText=true + children=false + parent=true, so this is a transition (with annotation text) that belongs to "user01" -->

  <data name="givenName">mike</data> <!-- URL=false + innerText=true + children=false + parent=true, so this is a data element that belongs to "user01"-->
  <data name="faimlyName">amundsen</data> <!-- URL=false + innerText=true + children=false + parent=true, so this is a data element that belongs to "user01" -->
  <data name="email">m...@example.org</data> <!-- URL=false + innerText=true + children=false + parent=true, so this is a data element that belongs to "user01" -->
</data>

@mamund
Copy link
Author

mamund commented Mar 17, 2014

yep - this is a totally fine representation of the same data. my goal is to design UBER such that it allows differences like this w/o problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment