Draft for UNIVERSAL DATA ACCESS syntax

Gadgets in pages will need a universal syntax for specifying the location of their property value in the database. These will be stored in data-object attributes of HTML tags.

This syntax must delve inside of JSON objects, and work on any of the system tables. Not only quads.

It would be good to have this syntax match with Java Script Object Notation (JSON) itself so that it can be used in the browser without translation.

QUADS
<context>.<subject>.<verb>.value
<context>.<subject>.<verb>.JSON.value

TABLES (since all rows in all tables now have row ids)
<table>.row.<field>.value
<table>.row.<field>.JSON.value

PHP
<file>.<property>.value
<file>.<property>.JSON.value

But let's use square brackets for variability in the path. That is directly equivilent to JSON and will allow these to be used inside html attributes without parsing issues with < and > being inside a tag, even if quoted.

Finally, the system needs to know what type it is. An easy way is a prefix.

quad:context.subject.verb
quad:context.subject.verb.JSON.property

table:name.row.field
table:name.row.field.JSON.property

file:name.property
file:name.property.JSON.property

Then for varibility we only have a few things varied in the whole system. Mainly.

Each of those can be represented by [name] and replaced out of the current context.

Quad for a user profile-image

user.[uid].profile-image

which would easily translate simply by spliting on '.' and some substitution to
to pure JSON as

['user']['1810']['profile-image']

and json objects in values can be auto detected and translated to an object under the JSON property so that

user.[uid].data.JSON.firstname

would become

['user']['1810']['profile-image']['JSON']['firstname']

and perfectly access the value.

On the PHP side it would translate similarly to

{'user'}->{'1810'}->{'profile-image'}->{'JSON'}->{'firstname'}

in fact the two could be translated back and forth simply by replacing ][ with }->{ and the ends.

Thus any value in a quad, table, or file can be retrieved or stored with this simple syntax. The only remaining issue is contextual security and translation security.

I think both could be handled by an API validator that worked from dictionaries of valid path components in the current context.


This means that no field or property name can contain a period or a square bracket. Fortunatly this is already the case as far as I am aware.

The table syntax is sufficient for items that come out of the database initially such that the row ID is already available. Retrieving any table value on-the-fly would require a WHERE clause. That is entirly practical but will need more elaborite security to prevent tampering. An easily securable alternative could use named WHERE clauses stored server side and then only the name need be verified secure in a context.

proudly scribed using markdown?

Tags

  1. file
  2. data access
  3. quads
  4. spec
  5. scripts

Comments


Holmes says
This is not something that I plan to implement all at once. But things like the profile editor are growing fast and now want to branch out into the group table to edit group title … so I might as well start using this where it applies and grow it as it is needed.

With a system like this I only need to fill in data-object attributes in html tags and everything else is fully automatic. Cuts maintenance and expansion down to near zilch … just add the html element to a template, specify a field validator, and it’s done.

See Also

  1. Thought Conversation Rooms and Tag Clouds with 45 viewings related by tag "spec".
  2. Thought An Event is something that the news reports on with 42 viewings related by tag "quads".
  3. Thought Thinking Domain Quads with 13 viewings related by tag "quads".
  4. Thought The Mentography of Rights with 11 viewings related by tag "quads".
  5. Thought Quads with 8 viewings related by tag "quads".
  6. Thought One man's propaganda is another man's truth is a third man's JOKE with 7 viewings related by tag "scripts".
  7. Thought Quick Script Writing Tutorial with 7 viewings related by tag "scripts".
  8. Thought Mr President, to surge or not to surge ? with 6 viewings related by tag "scripts".
  9. Thought Why quads? Quads vs RDF with 6 viewings related by tag "quads".
  10. Thought Good info on plugins and scripting - not wanting it lost with 6 viewings related by tag "scripts".
  11. Thought group quads project with 5 viewings related by tag "quads".
  12. Thought A Faint Sound of Peace ... with 5 viewings related by tag "scripts".
  13. Thought Using FastBlogIt with Agile Processes with 5 viewings related by tag "quads".
  14. Thought One road to peace ... saying things that need to be said. with 4 viewings related by tag "scripts".
  15. Thought mentography of items with 3 viewings related by tag "quads".
  16. Thought items as quads with 3 viewings related by tag "quads".
  17. Thought Everything ? with 3 viewings related by tag "quads".
  18. Thought The Quintessential Jewish Script with 2 viewings related by tag "scripts".
  19. Thought Me represented in the Linked Data Cloud with 2 viewings related by tag "quads".
  20. Thought The Dogs Of War with 2 viewings related by tag "scripts".
  21. Thought Repeating Quads Structure on tagtalking dev blog with 1 viewings related by tag "quads".
  22. Thought Where are we in the script ? with 1 viewings related by tag "scripts".
  23. Thought items vs quads gives us forms with 0 viewings related by tag "quads".
  24. Thought A terrible question ... with 0 viewings related by tag "scripts".
  25. Thought What we do to each other matters, for that is the very being of our humanity. with 0 viewings related by tag "scripts".
  26. Thought about: Is Iran planning a cataclysmic strike for August 22? with 0 viewings related by tag "scripts".
  27. Thought Murder & Merde with 0 viewings related by tag "scripts".
  28. Thought form vs data with 0 viewings related by tag "quads".
  29. Thought about: The New Way Forward with 0 viewings related by tag "scripts".
  30. Thought about: Olmert gives IDF green light to expand ground offensive with 0 viewings related by tag "scripts".
  31. Thought Would that it was Otherwise with 0 viewings related by tag "scripts".
  32. Thought UN Resolution 1701 with 0 viewings related by tag "scripts".
  33. Thought Other Side of the Story Anyone ? with 0 viewings related by tag "scripts".
  34. Thought quads table in the database with 0 viewings related by tag "quads".
  35. Thought about: Al-Qaeda planning militant Islamic state within Iraq with 0 viewings related by tag "scripts".
  36. Thought Tracking internal Israeli politics with 0 viewings related by tag "scripts".
  37. Thought Quads Factoring with 0 viewings related by tag "quads".
  38. Thought A fatwa against a potential invasion of Iran with 0 viewings related by tag "scripts".
  39. Thought Seriously considering developing tagtalking.net based upon ... with 0 viewings related by tag "quads".
  40. Thought A Winning Script for Iraq with 0 viewings related by tag "scripts".
  41. Thought Pentals with 0 viewings related by tag "quads".
  42. Thought For humans to read and edit quads, they should be displayed and edited with humanly understood words. with 0 viewings related by tag "quads".
  43. Thought Quads Database for tagtalking with 0 viewings related by tag "quads".
  44. Thought The Power of Quads To Generate a Web Form with 0 viewings related by tag "quads".
  45. Thought about: About Dabble DB with 0 viewings related by tag "quads".
  46. Thought Changing Dynamics in Iraq with 0 viewings related by tag "scripts".
  47. Thought Tina and a quad with 0 viewings related by tag "quads".
  48. Thought Wise Advice From A Former President with 0 viewings related by tag "scripts".
  49. Thought Serendipituous playing in open LinkedData Spaces with 0 viewings related by tag "quads".