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.
{
"@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> .
@stain
Copy link
Author

stain commented Mar 13, 2019

Yes, @BigBlueHat, that would work, except then you can't use "linkset" as an inner relation type, which is a bit odd given that this RFC would introduce that relationship.. So if we combine your trick with also calling the outer key @linkset instead of linkset we are good to go without needing to use JSON-LD 1.1 (which is still in draft stages)

@stain
Copy link
Author

stain commented Mar 13, 2019

About type I think we can't use @vocab trick here as it should map to some base URI for formats, like https://www.iana.org/assignments/media-types/ making https://www.iana.org/assignments/media-types/text/html etc -- but IANA never managed to decide on such a base URI. In addition that would mean format would not work with parameters like charset.

That means we should not use dct:format - which is defined with range http://purl.org/dc/terms/MediaTypeOrExtent aka an object property to a URI resource - but rather the more simple dc:format which allows plain literals. Then simply remove @type for format. That is how we mapped mediatype in https://researchobject.github.io/specifications/bundle/#json-ld

@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