Skip to content

Support JSON values that aren't mapped #333

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
lanthaler opened this issue Mar 10, 2014 · 8 comments
Closed

Support JSON values that aren't mapped #333

lanthaler opened this issue Mar 10, 2014 · 8 comments
Labels
api defer Issue deferred to future Working Group spec-design syntax

Comments

@lanthaler
Copy link
Member

This has already been discussed several times usingvarious terms.. the most recent request has come from David Janes on the mailing list. The basic idea is to support JSON values/subtrees that aren't mapped to an IRI in the context. They should survive algorithmic transformations (basically without being touched at all).

@lanthaler lanthaler added this to the JSON-LD.next milestone Mar 10, 2014
@gkellogg gkellogg added the 1.1 label Nov 25, 2014
@gkellogg
Copy link
Member

Perhaps something like @container: @literal to treat it something like the way RDFa treats rdf:XMLLiteral or rdf:HTML. To support RDF transformations, it probably deserves its own datatype IRI.

@dlongley
Copy link
Member

Might need to be more specific about the type of literal to allow for different types of processing/passthrough like: @container: @json.

@gkellogg
Copy link
Member

gkellogg commented Jan 2, 2017

See http://geojson.org/geojson-ld/ for a motivation for use in GeoJSON.

@gkellogg
Copy link
Member

Thinking about this some more, it's important to consider the desired expanded representation. IMO, allowing values of @value to include objects and arrays (framing has some use of this now, so we need to be somewhat careful) is the natural way I would see data to be expanded, along with an appropriate datatype. For example:

[{
  "@id": "http://exaple/foo",
  "http://example/json-value": [{
    "@value": [{"native": "json"}],
    "@type": "http://www.w3.org/ns/jsonld#JSON"
  }]
}]

This allows the JSON {"native": "json"} to be represented as the value of http://example/json-value. When compacted, it might look like the following:

{
  "@context": {
    "@vocab": "http://example/",
    "@base": "http://example/",
    "jsonld": "http://www.w3.org/ns/jsonld#",
    "json-value": {"@type": "jsonld:JSON"}
  },
  "@id": "foo",
  "json-value": {"native": "json"}
}

Using @container: @set could be used to force the compacted version to be in array form.

Transforming to RDF would preserve the jsonld:JSON datatype, and perform a canonical JSON serialization of the content, deserializing when going back from RDF to JSON-LD. There may be implications for RDF L2V.

@niklasl
Copy link
Member

niklasl commented Feb 26, 2018

For the record, as discussed in the call, we might consider supporting all possible JSON values (i.e. strings, booleans, numbers, and null as well as objects and arrays).

@gkellogg
Copy link
Member

Discussed on the call today:

RESOLUTION: adopt solution defined in #333 (comment) as an interum solution, with final selection of the datatype to a future WG.

We may experement with using @type: @json to signal this, and leave the datatype IRI for the RDFa conversion.

@gkellogg gkellogg added the defer Issue deferred to future Working Group label Apr 9, 2018
@gkellogg
Copy link
Member

gkellogg commented Apr 9, 2018

@gkellogg
Copy link
Member

Closed in favor of w3c/json-ld-syntax#4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api defer Issue deferred to future Working Group spec-design syntax
Projects
None yet
Development

No branches or pull requests

4 participants