|
source |
all docs
for |
all versions |
oils.pub
Warning: Work in progress! Leave feedback on Zulip or Github if you'd like
this doc to be updated.
Tables, Object, and Documents - Notation, Query, Creation, Schema
This is part of maximal YSH!
Philosophy
- Oils is Exterior-First
- Tables, Objects, Documents - CSV, JSON, HTML
- Oils cleanup: TSV8, JSON8, HTM8
Tables
Data Type |
Notation |
Query |
Creation |
Schema |
Table |
TSV, CSV |
csvkit, xsv, awk-ish, etc.
SQL, Data Frames |
? |
? |
Object |
JSON |
jq
JSONPath: MySQL/Postgres/sqlite support it? |
jq |
JSON Schema |
Document |
HTML5 |
DOM API like getElementById()
CSS selectors
|
JSX Templates |
? |
Document |
XML |
XPath? XQuery? |
XSLT? |
three:
- DTD (document type definition, 1986)
- RelaxNG (2001)
- XML Schema aka XSD (2001)
|
Existing
Data Type |
Notation |
Query |
Creation |
Schema |
In-Memory |
Table |
TSV8 (is valid TSV) |
dplyr-like Data Frames
Maybe some SQL-pipe subset thing? |
table { } |
? |
By column: dict of "arrays"
By row: list of dicts
|
Object |
JSON8 (superset) |
JSONPath?
jq as a reshaping language |
Hay? Package { } |
JSON Schema? |
List and Dict |
Document |
HTM8 (subset) |
CSS selectors |
Markaby Style div { }
"sed" style |
? |
DocFrag - a span within a doc
DocTree - an Obj representation
? |
Oils
Note: SQL Databases Support all three models!
- sqlite, MySQL, and PostGres obviously have tables
- They all have JSON and JSONPath support!
- JSONPath syntax might differ a bit?
- XML support
- Postgres: XML type, XPath, more
- MySQL: XML extraction functions only
- sqlite: none
Design Issues
Streaming
- jq has a line-based streaming model, by taking advantage of the fact that
all JSON can be encoded without literal newlines
- HTML/XML don't have this property
- Solution: Netstring based streaming?
- can do it for both JSON8 and HTM8 ?
Mutual Nesting
- JSON must be UTF-8, so JSON strings can contain JSON
- ditto for JSON8, and J8 strings
- TSV cells can't contain tabs or newlines
- so they can't contain TSV
- if you remove all the newlines, they can contain JSON
- TSV8 cells use J8 strings, so they can contain JSON, TSV
- HTM8
- you can escape everything, so you can put another HTM8 doc inside
- and you can put JSON/JSON8 or TSV/TSV8
- although are there whitespace rules?
- all nodes can be like
<pre>
nodes, preserving whitespace, until
- you apply another function to it
HTML5 whitespace rules
- inside text context:
- multiple whitespace chars collapsed into a single one
- newlines converted to spaces
- leading and trailing space is preserved
<pre> <code> <textarea>
- whitespace is preserved exactly as written
- I guess HTM8 could use another function for this?
- quoted attributes
Related
Notes
RelaxNG, XSD, DTD
I didn't know there were these 3 schema types!
- DTD is older, associated with SGML created in 1986
- XML Schema and Relax NG created in 2001
- XML Schema use XML syntax, which is bad!
Algorithms?
Naming
Is
<span x=j'foo'>
identical to <span x="j'foo'">
in HTML5 ?
- it seems do
- ditto for
$""
- then we could disallow those pattern in double quotes?
- they would have to be quoted like &sq; or something
Generated on Fri, 10 Jan 2025 19:52:47 +0000