digitalbazaar / cborld

A Javascript CBOR-LD processor for web browsers and Node.js apps.
https://json-ld.github.io/cbor-ld-spec/
BSD 3-Clause "New" or "Revised" License
16 stars 12 forks source link

Term to Code dictionary includes only applied scoped contexts #64

Open filip26 opened 1 year ago

filip26 commented 1 year ago

Hi, the current term to code dictionary implementation includes only applied scoped contexts indexed in the application order?! This solution prevents generating static dictionaries for well-known context (sets) - the dictionary is tightly coupled with a document. Is very hard to implement.

The goal is to create a dictionary mapping strings to codes.

Easy solution to implement is to collect a set of all property names (and perhaps string values as well) found in all included contexts, no matter on (contexts) order, occurrence, nor usage, then sort it alphabetically, and that's it.

filip26 commented 1 year ago

It seems that to create the dictionary a property value must be "expanded" in order to determine if scoped context must be included. This step is unnecessary. if the dictionary creation process is decoupled from document processing.