Skip to content

Order of blank node identifiers during normalization #249

Description

@kochhar

Hi, I am working on a project to sign LD documents for which normalisation is an important step. My goal is to use a standard normalisation algorithm across language implementations so that signature verification works.

At present, I am working on Python<>Java compatibility. I have observed some differences between the normalised output of PyLD and jsonld-java, specifically in the order and naming of blank nodes. I'm trying to understand if jsonld-java follows the URDNA2015 normalisation algorithm which is implemented by PyLD

I'm including how I invoke the normalisation using both libraries. If needed, I can share the normalised outputs also.

PyLD Invocation

# normalize a document using the RDF Dataset Normalization Algorithm
# (URDNA2015), see: http://json-ld.github.io/normalization/spec/
normalized = jsonld.normalize(document, options={
    'algorithm': 'URDNA2015',
    'format': 'application/n-quads'
})

# - doc is a dict containing a JSON-LD document.
# - normalized is a string that is a canonical representation of the document
#    that can be used for hashing, comparison, etc.

jsonld-java Invocation

final JsonLdOptions options = new JsonLdOptions();
options.format = JsonLdConsts.APPLICATION_NQUADS;
String normalized = (String)JsonLdProcessor.normalize(document, options);
 
// - document is Map<String, Object> containing a JSON-LD document.
// - normalized is a string that is intended to be used for hashing

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions