digitalbazaar / rdf-canonize

An implementation of the RDF Dataset Normalization Algorithm in JavaScript.
Other
21 stars 13 forks source link

Add option to return mapped before and after n-quad indices #68

Open dlongley opened 1 year ago

dlongley commented 1 year ago

When processing the input quads (in order) at the end of the URDNA2015 algorithm -- where N-Quads are created with the canonized blank node labels, add a property to each N-Quad string that keeps track of the original quad index. Then, after sorting the N-Quads produce a mapping of the old input quad indexes to the new sorted N-Quad indexes. Return this mapping from the algorithm as an additional output.

The output is expected to be useful in selective disclosure algorithms.

dlongley commented 1 year ago

We can have the user pass in a Map to be populated as a new option to the public API and then pass that through the constructor and store it in the state information. If it's present when the main() function is called, we can populate it as mentioned above.