Skip to content

Use of null in JSON-LD #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gkellogg opened this issue Feb 21, 2012 · 7 comments
Closed

Use of null in JSON-LD #76

gkellogg opened this issue Feb 21, 2012 · 7 comments

Comments

@gkellogg
Copy link
Member

Proposal: unless otherwise specified, the use of null as a value MUST be treated as if the value was never specified; i.e., it has no effect.

Proposal: unless otherwise specified, the use of null as a key is treated as if the key/value was never specified, and values of that key MUST NOT be processed.

Such uses MUST be removed when compacting.

@gkellogg
Copy link
Member Author

Note that null can't be used as a key in JSON.

@gkellogg
Copy link
Member Author

Uses within @context:

"@context": {
  "@language": null,
  "term": null,
  "prefix:term": null,
  "term": {"@id": null},
  "http://foo/bar": null
}

@niklasl
Copy link
Member

niklasl commented Feb 21, 2012

Of potential value (e.g. for "probing", representing "inverse relations" etc.):

"isReferencedBy": {"@id": null, "@container": "@set"},

.. this is now described in depth in #84.

@msporny
Copy link
Member

msporny commented Mar 13, 2012

There are two ways null can be used in JSON-LD... in the @context and in the body of the document. I think we found consensus last time by stating that if 'null' is used in the value position in the body of the document, then a processor must ignore the key-value pair. If null is used in the @context, it has a number of different effects:

Clear the active context: "@context": null and "@context:" [null, ...]
Clear a term/prefix declaration: "term": null,
Clear the datatype associated with a term: "term": {"@id": "http://example.org/term", "@type": null}
Clear the language associated with a term: "term": {"@id": "http://example.org/term", "@language": null}
Clear the container type associated with a term: "term": {"@id": "http://example.org/term", "@container": null}

Any other places that null could be used?

@lanthaler
Copy link
Member

"@id": null: clear the whole term declaration. What if that it's in the body? (see also #84)

Perhaps we should also define what happens if something like { "@value": null, "@language": "de" } is in the document.. I assume we just discard the whole typed/language-tagged literal.

The same for lists? Or should "@list": null" result in an empty list? (this is probably related to #79)

@lanthaler
Copy link
Member

RESOLVED: Unless otherwise specified, when 'null' is used in the @context, it removes any definition associated with the key.

RESOLVED: If @context is set to 'null', then the active context is cleared or set to the initial context (depending on the resolution to ISSUE #80)

RESOLVED: Unless otherwise specified, if null is associated with a key in the body of a JSON-LD document, then the JSON-LD processor MUST act as if the key-value pair was never declared. If @value or @list is set to null in expanded form, then the entire JSON object is ignored.

@gkellogg
Copy link
Member Author

In updating the algorithms, because the value must act as if it's not there, it results in data being removed when expanded, rather than compacted.

gkellogg added a commit that referenced this issue Mar 21, 2012
…bject values having a @value or @list which is null. Also, remove null values from arrays when expanding.

This is a consequence of #76.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants