noctarius / borabora

borabora is a CBOR (cbor.io) parser supporting graph queries and lazy decoding of stream elements
Apache License 2.0
13 stars 5 forks source link

Adding CBOR tables data type #18

Open noctarius opened 8 years ago

noctarius commented 8 years ago

CBOR tables are an extension data type defined using a Semantic Tag (has to be defined) and a structure that consists of multiple Sequences (arrays). The outer Sequence can be indefinite, so that the number of rows is not need to be known upfront or numberOfRows + 1. The first inner Sequence is the header sequence and contains the table header names. All elements inside the header sequence must be of type textual representable types (ByteString, TextString, UnsignedInteger, NegativeInteger, Float, UBigNum, Fraction). Further sequences contain a single row each. If the number of elements is lower than the number of headers, missing fields, at the end, will be considered null.

The semantic tag id has yet to be defined.

As an general abstraction it looks like that:

SemTag(id) Sequence (*) [ // indefinite or 3
  Sequence (3) [ ByteString { Head 1 }, ByteString { Head 2}, ByteString { Head 3 } ],
  Sequence (3) [ ByteString { Va 11}, TextString { Val 12 }, TextString { Val 13 } ],
  Sequence (1) [ ByteString {Val 21 } ] // inherently field 2 and 3 are null
]

Specification available here: https://github.com/noctarius/cbor-specs/blob/final-table-data/tables-specification.md