-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update algorithms to use new processing model. #30
base: main
Are you sure you want to change the base?
Conversation
In this section we specify the algorithms required to convert JSON-LD to CBOR-LD | ||
and vice versa. We first provide the context processing algorithms, which are required | ||
for both decompression and compression, then provide the mode-specific algorithms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this section we specify the algorithms required to convert JSON-LD to CBOR-LD | |
and vice versa. We first provide the context processing algorithms, which are required | |
for both decompression and compression, then provide the mode-specific algorithms. | |
In this section, we specify the algorithms required to convert JSON-LD to CBOR-LD | |
and vice versa. We provide first the context processing algorithms, which are required | |
for both decompression and compression; we then provide the mode-specific algorithms. |
that is needed to compress or decompress to/from CBOR-LD. During compression and decompression, the | ||
<a href="top-level-term-codec-map-generation-algorithm"></a> is run once during setup, and the | ||
<a href="update-term-codec-map-with-type-scoped-context-algorithm"></a> and | ||
<a href="update-term-codec-map-with-property-scoped-context-algorithm"></a> are run on an as-needed basis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is needed to compress or decompress to/from CBOR-LD. During compression and decompression, the | |
<a href="top-level-term-codec-map-generation-algorithm"></a> is run once during setup, and the | |
<a href="update-term-codec-map-with-type-scoped-context-algorithm"></a> and | |
<a href="update-term-codec-map-with-property-scoped-context-algorithm"></a> are run on an as-needed basis. | |
that is needed to compress to or decompress from CBOR-LD. For compression and decompression, the | |
<a href="top-level-term-codec-map-generation-algorithm"></a> is run once during setup, and the | |
<a href="update-term-codec-map-with-type-scoped-context-algorithm"></a> and | |
<a href="update-term-codec-map-with-property-scoped-context-algorithm"></a> are run on an as-needed basis. |
<section> | ||
<h2>Top-level Term Codec Map Generation Algorithm</h2> | ||
<p> | ||
This algorithm takes a map `typeTable` and an array of JSON-LD contexts `contexts` and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be like the other algorithms, with ({datatype} {name})
or similar for each input and output?
This algorithm takes a map `typeTable` and an array of JSON-LD contexts `contexts` and | |
This algorithm takes a map `typeTable` and an array of JSON-LD contexts `contexts` as inputs, and |
<li>Let `termToEncodedValue` be an ordered map.</li> | ||
<li> | ||
For each value in `contextUrls`, dereference the JSON-LD contexts and process | ||
every entry at the top level (i.e. ignoring type and property-scoped contexts). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the parenthetical meant to be read as ignoring type-scoped and property-scoped contexts
? or ignoring (type) and (property-scoped contexts)
? or something else? I'm guessing it's the first, which calls for the addition of this hyphen —
every entry at the top level (i.e. ignoring type and property-scoped contexts). | |
every entry at the top level (i.e., ignoring type- and property-scoped contexts). |
</ol> | ||
</li> | ||
<li> | ||
Sort the keys in `termToEncodedValue` by value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sort order should be more explicit. I'm guessing it should be by codepoint value, which sometimes means we need to force a codepage or call for it to be declared (e.g., UTF-8, UTF-16, UTF-32, etc.)....
<li> | ||
For each entry in the typeTables array in the CBOR-LD Varint Registry Entry associated with | ||
`registryEntryId`, dereference the URL if necessary and add ${type}: ${table} from the resulting | ||
document to `typeTable`. If "callerProvidedTable" appears in contextTables, populate `typeTables` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document to `typeTable`. If "callerProvidedTable" appears in contextTables, populate `typeTables` | |
document to `typeTable`. If "callerProvidedTable" appears in `contextTables`, populate `typeTables` |
<section> | ||
<h2>Get CBOR-LD Registry Entry ID Algorithm</h2> | ||
<p> | ||
This algorithm takes a CBOR-LD payload `cborldBytes` as input and returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This algorithm takes a CBOR-LD payload `cborldBytes` as input and returns | |
This algorithm takes a CBOR-LD payload `cborldBytes` as input, and returns |
If the CBOR tag on `cborldBytes` is not in the range `0x0600-0x06FF`, throw an | ||
ERR_NON_CBOR_LD_TAG error. | ||
</li> | ||
<li> | ||
Otherwise if the CBOR tag on `cborldBytes` is in the range `0x0600-0x067F`, set `registryEntryId` to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the CBOR tag on `cborldBytes` is not in the range `0x0600-0x06FF`, throw an | |
ERR_NON_CBOR_LD_TAG error. | |
</li> | |
<li> | |
Otherwise if the CBOR tag on `cborldBytes` is in the range `0x0600-0x067F`, set `registryEntryId` to | |
If the CBOR tag on `cborldBytes` is not in the range `0x0600`–`0x06FF`, throw an | |
`ERR_NON_CBOR_LD_TAG` error. | |
</li> | |
<li> | |
Otherwise if the CBOR tag on `cborldBytes` is in the range `0x0600`–`0x067F`, set `registryEntryId` to |
<ol> | ||
<li> | ||
If the last byte of the CBOR tag does not form the first byte of a valid varint, throw an | ||
ERR_INVALID_VARINT_VALUE error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERR_INVALID_VARINT_VALUE error. | |
`ERR_INVALID_VARINT_VALUE` error. |
Generate Decompressed JSON-LD Algorithm | ||
</h2> | ||
<p> | ||
This algorithm takes as input CBOR-LD payload `cborldBytes` and a map `typeTable` and returns a JSON-LD document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This algorithm takes as input CBOR-LD payload `cborldBytes` and a map `typeTable` and returns a JSON-LD document. | |
This algorithm takes a CBOR-LD payload `cborldBytes` and a map `typeTable` as inputs, and returns a JSON-LD document. |
Preview | Diff