Skip to content

Instantly share code, notes, and snippets.

@stain
Last active March 13, 2019 19:56
Show Gist options
  • Save stain/4ae12d225b094246227740d7a93f0bde to your computer and use it in GitHub Desktop.
Save stain/4ae12d225b094246227740d7a93f0bde to your computer and use it in GitHub Desktop.
Linkset JSON as JSON-LD https://github.com/dret/I-D/issues/119
{
"@context": [
{
"@vocab": "https://www.iana.org/assignments/link-relations/",
"anchor": "@id",
"href": "@id",
"dct": "http://purl.org/dc/terms/",
"link": "https://www.iana.org/assignments/link-relations#",
"title": {
"@id": "http://purl.org/dc/terms/title"
},
"title*": {
"@id": "http://purl.org/dc/terms/title"
},
"type": {
"@id": "dct:format",
"@type": "@vocab"
}
},
{
"language": "@language",
"value": "@value",
"hreflang": {
"@id": "https://www.w3.org/ns/activitystreams#hreflang",
"@container": "@set"
}
}
],
"linkset": [
{
"anchor": "https://example.org/article/view/7507",
"author": [
{
"href": "https://orcid.org/0000-0002-4311-0897",
"type": "rdf/xml"
}
],
"item": [
{
"href": "https://example.org/article/7507/item/1",
"type": "application/pdf"
},
{
"href": "https://example.org/article/7507/item/2",
"type": "text/csv"
}
],
"cite-as": [
{
"href": "https://doi.org/10.841/zk2557"
}
]
},
{
"anchor": "https://example.com/links",
"alternate": [
{
"href": "https://mirror.example.com/links"
}
]
}
]
}
<https://example.com/links> <https://www.iana.org/assignments/link-relations/alternate> <https://mirror.example.com/links> .
<https://example.org/article/7507/item/1> <http://purl.org/dc/terms/format> <https://www.iana.org/assignments/link-relations/application/pdf> .
<https://example.org/article/7507/item/2> <http://purl.org/dc/terms/format> <https://www.iana.org/assignments/link-relations/text/csv> .
<https://example.org/article/view/7507> <https://www.iana.org/assignments/link-relations/author> <https://orcid.org/0000-0002-4311-0897> .
<https://example.org/article/view/7507> <https://www.iana.org/assignments/link-relations/cite-as> <https://doi.org/10.841/zk2557> .
<https://example.org/article/view/7507> <https://www.iana.org/assignments/link-relations/item> <https://example.org/article/7507/item/1> .
<https://example.org/article/view/7507> <https://www.iana.org/assignments/link-relations/item> <https://example.org/article/7507/item/2> .
<https://orcid.org/0000-0002-4311-0897> <http://purl.org/dc/terms/format> <https://www.iana.org/assignments/link-relations/rdf/xml> .
_:b0 <https://www.iana.org/assignments/link-relations/linkset> <https://example.com/links> .
_:b0 <https://www.iana.org/assignments/link-relations/linkset> <https://example.org/article/view/7507> .
@BigBlueHat
Copy link

Yeah...don't introduce any new @ prefixed terms... That'll run into issues in the future for sure.

In digging a bit more, I think "linkset": {"@container": "@list"} gets a more correct result. It preserves the "linkset" relationship between multiple blank nodes: one for the linkset and one for each of the contained links (in this example).

@BigBlueHat
Copy link

Also, excellent points about format. We used dc:format (for likely very similar reasons) in the Web Annotation Data Model spec's context file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment