Schema
To learn more about the architecture of csvs, see other User Guides, the Reference and the Requirements.
to schema
if entry has no `_:_` return {}
for each trunk of entry except _
for each leaf of entry.trunk
append trunk to schema.leaf.trunks
append leaf to schema.trunk.leaves
return schema
is connected
Schema -> Base -> Branch -> Boolean
This tells if a branch is connected to base branch.
if branch equals base
return true
for each trunk of branch
if trunk equals base
return true
if trunk is connected to base
return true
otherwise
return false
find crown
This finds all branches that are connected to the base branch.
if leaf is connected to base
return leaf
get nesting level
for each trunk of branch
get nesting level of trunk
increment level
test cases
- naught
- schema: record schema array
- branch: datum
- expected: 0
- first
- schema: record schema array
- branch: export tags
- expected: 1
- second
- schema: record schema array
- branch: export2 tag
- expected: 2
- third
- schema: record schema array
- branch: export2 tag description
- expected: 3
- fourth
- schema: record schema array
- branch: export 2 tag description text 1
- expected: 4
sort nesting ascending
Schema -> (Branch -> Branch -> Ordering)
sort by level of nesting, twigs and leaves come first
test cases
-
- schema: record schema array
- initial:
- expected:
sort nesting descending
Schema -> (Branch -> Branch -> Ordering)
sort by level of nesting, trunks come first
test cases
-
- schema: record schema array
- initial:
- expected: