json-ld icon indicating copy to clipboard operation
json-ld copied to clipboard

Decide what to do with value entries in node objects.

Open timothee-haudebourg opened this issue 4 years ago • 1 comments

For now in src/expansion/node.rs, is the expanded node only contains value entries (i.e. @language or @direction entries), then it is ignored (None is returned and the node is dropped).

It is not clear if this is the correct behavior or not.

  • Should we throw an error?
  • Should we keep ignoring it?

The JSON-LD API expansion algorithm only covers the case where the node only contains a @language entry, in which case it is ignored:

If result is a map that contains only the entry @language, return null.

More complex cases are not covered. In the playground, only the d map is dropped.

{
  "http://a": {
    "@id": "http://a",
    "@language": "fr"
  },
  "http://b": {
    "@id": "http://b",
    "@language": "en",
    "@direction": "ltr"
  },
  "http://c": {
    "@id": "http://c",
    "@direction": "ltr"
  },
  "http://d": {
    "@language": "fr"
  },
  "http://e": {
    "@language": "en",
    "@direction": "ltr"
  },
  "http://f": {
    "@direction": "ltr"
  }
}

timothee-haudebourg avatar Oct 26 '21 21:10 timothee-haudebourg

See https://github.com/w3c/json-ld-api/issues/535

timothee-haudebourg avatar Oct 26 '21 22:10 timothee-haudebourg