This should tidy up #119 so #89 is good to go - we could change the JSON top level linkset to _linkset or LinkSet to also allow linkset as a link relationship in JSON-LD mapping, but I guess that is a bit silly and too late to change now, so I added it as a caveat in the text instead.
Below is a quick rendering of the new text (via xml2rpc)
Appendix B. JSON-LD Context
A linkset rendered according to the JSON serialization defined in Section 4.2 can be interpreted as RDF triples by adding a JSON-LD context [W3C.REC-json-ld-20140116], which map the JSON keys to corresponding Linked Data terms.
Below is a context that can map JSON linkset representations to Dublin Core Terms, with the link relations interpreted as properties with absolute URIs corresponding to [RFC8288] appendix A.2.
GET https://example.org/contexts/linkset.jsonld HTTP/1.1
Connection: close
HTTP/1.1 200 OK
Content-Type: application/ld+json
Content-Length: 773
Figure 7: JSON-LD Context mapping to schema.org and IANA assignments
HTTP servers can indicate that a JSON Linkset can be interpreted as RDF by providing a link to a JSON-LD context using the link relation http://www.w3.org/ns/json-ld#context according to [W3C.REC-json-ld-20140116] section 6.8 as shown below:
HTTP/1.1 200 OK
Date: Mon, 12 Aug 2019 10:48:22 GMT
Server: Apache-Coyote/1.1
Content-Type: application/linkset+json
Link: <https://example.org/contexts/linkset.jsonld>;
rel="http://www.w3.org/ns/json-ld#context";
type="application/ld+json"
Content-Length: 848
An application consuming Linkset JSON can apply their own context, either through a JSON-LD Processor or by merging the "@context" key into the Linkset JSON root object to transform the application/linkset+json document to a application/ld+json document. Below shows how a content-negotiation HTTP server could dynamically render linksets as RDF formats showing the interpreted triples from the above.
GET https://example.com/links/article/7507 HTTP/1.1
Accept: text/turtle
Connection: close
HTTP/1.1 200 OK
Date: Mon, 12 Aug 2019 10:49:22 GMT
Server: Apache-Coyote/1.1
Content-Type: text/turtle
Content-Length: 1164
Figure 9: Triples returned by applying JSON-LD context
Note that the context in Figure 7 does not handle (meta)link relations of type "linkset" as they are in conflict with the top-level key. A workaround is to rename the top-level key to "_linkset" in the Linkset JSON before JSON-LD Processing.
Link
header for JSON-LD context can be added according to https://www.w3.org/TR/2014/REC-json-ld-20140116/#interpreting-json-as-json-ld@context
changed to avoid accidental"linkset"
triples (with caveat oflinkset
relation not being supported)This should tidy up #119 so #89 is good to go - we could change the JSON top level
linkset
to_linkset
orLinkSet
to also allowlinkset
as a link relationship in JSON-LD mapping, but I guess that is a bit silly and too late to change now, so I added it as a caveat in the text instead.Tagging @hvdsomp @csarven
Considerations
type
to http://purl.org/dc/terms/format is used to a literal instead of a URI resource - a mapping to http://www.iana.org/assignments/media-types/ namespace is possible, but requires JSON-LD 1.1 which is in Candidate Recommendation stage (although not subject to change). I know former me hates this, but short literals fordcterms:format
are listed as examples in https://www.dublincore.org/specifications/dublin-core/dcmi-terms/terms/format/@type: CreativeWork
) and the implication that link relation can there be better represented as an unrolled https://schema.org/LinkRole with the link relation given as a literal to https://schema.org/linkRelationship (this would be tricky to do with the Linkset JSON's current use of a map)Below is a quick rendering of the new text (via xml2rpc)
Appendix B. JSON-LD Context
A linkset rendered according to the JSON serialization defined in Section 4.2 can be interpreted as RDF triples by adding a JSON-LD context [W3C.REC-json-ld-20140116], which map the JSON keys to corresponding Linked Data terms.
Below is a context that can map JSON linkset representations to Dublin Core Terms, with the link relations interpreted as properties with absolute URIs corresponding to [RFC8288] appendix A.2.
Figure 7: JSON-LD Context mapping to schema.org and IANA assignments
HTTP servers can indicate that a JSON Linkset can be interpreted as RDF by providing a link to a JSON-LD context using the link relation
http://www.w3.org/ns/json-ld#context
according to [W3C.REC-json-ld-20140116] section 6.8 as shown below:Figure 8: JSON-LD link relation
An application consuming Linkset JSON can apply their own context, either through a JSON-LD Processor or by merging the
"@context"
key into the Linkset JSON root object to transform theapplication/linkset+json
document to aapplication/ld+json
document. Below shows how a content-negotiation HTTP server could dynamically render linksets as RDF formats showing the interpreted triples from the above.Figure 9: Triples returned by applying JSON-LD context
Note that the context in Figure 7 does not handle (meta)link relations of type
"linkset"
as they are in conflict with the top-level key. A workaround is to rename the top-level key to"_linkset"
in the Linkset JSON before JSON-LD Processing.