Open csarven opened 6 years ago
@csarven -- sure, technically any type of annotation can be POSTed to the server, so the json is fairly arbitrary (whether it's an OpenAnnotation or W3C Web Annotation).
Is the call of action to change the copy? Which in the code-base should change to support your use case?
e.g. renaming OpenAnnotation to WebAnnotation in: https://github.com/ArchiveLabs/pragma.archivelab.org/blob/master/pragma/api/pragmas.py https://github.com/ArchiveLabs/pragma.archivelab.org/blob/master/pragma/views/endpoints.py
In my implementation, I have a payload like this:
{
"url":"http://csarven.ca/",
"annotation":{
"@context":"http://www.w3.org/ns/anno.jsonld",
"@type":"Annotation",
"motivation":"linking",
"target":"http://csarven.ca/",
"rights":"https://creativecommons.org/publicdomain/zero/1.0/",
"creator":{
"@id":"http://csarven.ca/#i",
"http://schema.org/name":"Sarven Capadisli",
"http://schema.org/image":"http://csarven.ca/media/images/sarven-capadisli.jpg",
"http://schema.org/url":"http://csarven.ca/"
}
}
}
and that creates an annotation like https://pragma.archivelab.org/annotations/131 which pretty close to it:
{
"annotation": {
"@context": "http://www.w3.org/ns/anno.jsonld",
"@type": "Annotation",
"annotatedAt": "Thu Jul 27 10:20:00 2017",
"creator": {
"@id": "http://csarven.ca/#i",
"http://schema.org/image": "http://csarven.ca/media/images/sarven-capadisli.jpg",
"http://schema.org/name": "Sarven Capadisli",
"http://schema.org/url": "http://csarven.ca/"
},
"hasTarget": {
"hasSource": {
"@id": "http://web.archive.org/web/20170727101959/http://csarven.ca/",
"originalUrl": "http://csarven.ca/"
}
},
"motivation": "linking",
"rights": "https://creativecommons.org/publicdomain/zero/1.0/",
"target": "http://csarven.ca/"
},
"canvas_id": null,
"id": 132
}
For this to work out of the box for Web Annotation / JSON-LD consumption, the root object should be the contents of annotation
. There is no particular need for annotation
, canvas_id
(pardon me as I don't know what this is for :)).
created
value should be xsd:dateTime
typeid
should be the URL of the annotation, i.e., https://pragma.archivelab.org/annotations/131
. The payload didn't have @id
(leaving it to the server to decide), but it is good practice to include in the generated annotation, otherwise, the annotation object doesn't actually have a global identifier.message
or what to do with it - the term is not part of WA vocab. In the context of archiving, what would that convey? If the message is intended for the archiver, but not the annotation that's to be created, perhaps this value should never appear in the annotation description (the example above didn't include message
).target
should have value http://csarven.ca/
(this is what's being archived, that's the originalUrl
at the moment, and that can be removed).body
to indicate the archived URL ( http://web.archive.org/web/20170727101959/http://csarven.ca/
).I think it should come out as:
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"@id": "https://pragma.archivelab.org/annotations/132",
"@type": "Annotation",
"created": "2017-07-27T10:20:00Z",
"creator": {
"@id": "http://csarven.ca/#i",
"http://schema.org/image": "http://csarven.ca/media/images/sarven-capadisli.jpg",
"http://schema.org/name": "Sarven Capadisli",
"http://schema.org/url": "http://csarven.ca/"
},
"target": "http://csarven.ca/",
"body": "http://web.archive.org/web/20170727101959/http://csarven.ca/",
"motivation": "linking",
"rights": "https://creativecommons.org/publicdomain/zero/1.0/"
}
Web Annotation Protocol requires this header: Content-Type: application/ld+json;profile="http://www.w3.org/ns/anno.jsonld"
but in my implementation, I sent application/json
because that's what the server appears to require. The server should respond with that header for the annotation URL request.
Currently OpenAnnotation is supported but we now have W3C Web Annotation recommendations. Can we bumb this a bit?
I've tested with https://dokie.li/ . See https://github.com/linkeddata/dokieli/commit/725a54882da5e5ea943a41d938ef36b4ed94e389 . Happy to experiment with Web Annotation.