Skip to content

[BUG] expanding traceability did document with pyld #613

@PatStLouis

Description

@PatStLouis

I'm using the pyld library in my solution. Given the following json-ld document:

{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/traceability/v1"
  ],
  "service": [
    {
      "id": "did:web:example.com#traceability-api",
      "type": ["TraceabilityAPI"],
      "serviceEndpoint": "https://example.com"
    }
  ]
}

when I try to expand it

jsonld.expand(document)

I get the following error:

pyld.jsonld.JsonLdError: ('Tried to nullify a context with protected terms outside of a term definition.',)
Type: jsonld.SyntaxError
Code: invalid context nullification

Removing one of the contexts bypasses this error, however, both should be present according to the spec. Commenting out the service.type also bypasses this error.

Could someone with more knowledge around json-ld shed some light on this issue?

I noticed the TraceabilityAPI term has an empty context:
"TraceabilityAPI":{"@id":"https://w3id.org/traceability#TraceabilityAPI","@context":{}}

Metadata

Metadata

Assignees

Labels

v1.0Issues that are ready for the v1.0 cut of the spec

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions