1

The documentation of JSON-LD mentions that clients can provide a profile parameter to the Accept header can be used to control the representation. It defines the three defaults for requesting compacted, expanded or flattened JSON-LD documents. It does also say that

If the profile parameter is given, a server should return a document that honors the profiles in the list which are recognized by the server.

It does not, however, explain whether there are any specific rules the server should follow. Is it completely up to the server to decide what the behavior is for custom profile URIs? Are there any discussions on that subject?

Would the examples below be correct?

Example 1

The client requests with

Accept: application/ld+json; 
        profile="http://www.w3.org/ns/json-ld#compacted http://schema.org"

And the server returns compacted document with http://schema.org as @context?

Example 2

The client requests with

Accept: application/ld+json; profile="http://schema.org"

And the server returns compacted document with http://schema.org as @context?

Tomasz Pluskiewicz
  • 3,622
  • 1
  • 19
  • 42

1 Answers1

0

The JSON-LD 1.0 Spec defines profile in IANA Condierations. This defines the profile identifiers such as compacted you identified above. It doesn't provide a way to specify a specific context to use, and the semantics of profile would make it difficult to know what is meant by a different profile URI, as there is no way (AFAIK) to register this meaning elsewhere.

That said, I think it would be useful to be able to specify a context to use for compacted or expanded, and if/when we support framing, a frame to use. I think this might take the form of a type-specific Accept parameter context and/or frame, which would be used to specify the requested context or frame to be used when serializing the document. However, as with other profiles, these are SHOULD, not MUST; a client needs to be able to cope with getting a document back not so serialized, perhaps using a local jsonld.js instance to re-encoding the returned document. It might also be useful to recommend that the same parameters be used in the response with Content-Type for the server to communicate the profile/context/frame used as part of the response.

Please consider raising an issue at https://github.com/json-ld/json-ld.org/issues, as we're starting to look at new Community Group (i.e., not W3C Recommendations) drafts of the specs to address long outstanding community feature requests.

Gregg Kellogg
  • 1,831
  • 12
  • 8
  • There's a registry for profile URIs: https://www.iana.org/assignments/profile-uris/profile-uris.xhtml The definition of the profile should specify the behavior. The server may or may not honor it. Talking about example 1 above, I would rather create a new profile for compacted schema.org instead of trying to specify how combinations of profiles should work – Markus Lanthaler Sep 19 '16 at 19:05