Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Web Annotation #3

Open
csarven opened this issue Jul 26, 2017 · 2 comments
Open

Support Web Annotation #3

csarven opened this issue Jul 26, 2017 · 2 comments

Comments

@csarven
Copy link

csarven commented Jul 26, 2017

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 dokieli/dokieli@725a548 . Happy to experiment with Web Annotation.

@mekarpeles
Copy link
Member

@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

@csarven
Copy link
Author

csarven commented Jul 27, 2017

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 :)).

  • s/annotatedAt/created and created value should be xsd:dateTime type
  • id 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.
  • I'm not sure about the role of 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).
  • s/hasTarget/target and 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).
  • Use 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants