Implementing the algorithm for Create Term Definition

Hi everyone!

I'm new to JSON-LD and try to implement a JSON-LD parser according to the JSON-LD-API.

When I come to implement the algorithm for Create Term Definition then I get a bit confused.
https://www.w3.org/TR/json-ld11-api/#create-term-definition

In 4.2.2, point 10) it says:
"Create a new term definition, definition, initializing prefix flag to false, protected to protected,
and reverse property to false."

I jump to term definition to understand how to create that.
https://www.w3.org/TR/json-ld11/#dfn-term-definition

I see that the term definition must be an expanded term definition.
https://www.w3.org/TR/json-ld11/#dfn-expanded-term-definition

It says something about container mapping that may be of interest but I don't quite understand
that so I follow the link to the normative description.
https://www.w3.org/TR/json-ld11/#expanded-term-definition

In the normative description it says:
"An expanded term definition MUST be a map composed of zero or more keys from @id,
@reverse, @type, @language, @container, @context, @prefix, @propagate, or @protected."
And then it says something that confuses me:
"An expanded term definition SHOULD NOT contain any other keys."

Now, jumping back to 4.2.2, point 10), how shall I create the term definition? At first I thought I
should set @reverse to false but reading the expanded term definition it says:
"If an expanded term definition has an @reverse entry, [...], its value MUST be an IRI, a blank
node identifier, a compact IRI, or a term."

What makes it a little more confusing is that the Context Processing Algorithm has a slightly
different definition of what a term definition should contain, at least according to the
reverse property flag.
https://www.w3.org/TR/json-ld11-api/#context-processing-algorithm

I looked at the Python implementation and saw that it does something that I'm not able to
match in the W3C pseudo code.
https://github.com/digitalbazaar/pyld/blob/316fbc2c9e25b3cf718b4ee189012a64b91f17e7/lib/pyld/jsonld.py#L5084


How shall I implement a term definition?
Any help is highly appreciated.

Best regards,


Daniel Markus
[cid:ad94088b-0c8d-4850-a4b8-87c6c15b198f] Software Engineer


[cid:bbd78b6b-0e30-431c-aeb3-ee62deaef333]


Office: +46 8 739 02 70
E-mail: daniel.markus@msab.com<mailto:daniel.markus@msab.com> | Web: www.msab.com<http://www.msab.com/>


[cid:14108abc-de6f-452d-b005-9a43da30d6d6]

Received on Wednesday, 1 December 2021 19:32:48 UTC