Attempting to re-contextualize Hypothes.is JSON

I'm in the process of wrangling Hypothes.is (and Annotator) JSON data into
Web Annotation Data Model compliant JSON-LD.

One such attempt I've started, is to craft a custom @context which takes
the JSON output from the Hypothesis API and maps those keys and values into
a valid Web Annotation.

My core objective at the moment is to see how far I can get with "merely"
providing a custom context definition and *without* editing any of the JSON
itself.


Here's what I have so far:
..on the JSON-LD playground...
http://json-ld.org/playground/#/gist/5b3a8a89bea268ee7343

...and as a GitHub Gist--where you can fork, comment, etc....
https://gist.github.com/BigBlueHat/cd7cfcddecd1dce5f32f

There's a good bit of ambiguity, selector type's don't "upgrade", there's
not a "RangeSelector" type (so the partial XPath's used by Annotator get
lost), and obviously there's a bunch of blank nodes to care about. :-/

These are the variations I've made to the WD's context definition:
Added:
 - "@base": "http://hypothes.is/api/annotations/"
 - "id": "@id"
 - "tags": "oa:Tag"
Changed:
 - annotatedAt to created
 - serializedAt to updated
 - body to text
 - annotatedBy to user

(I think that's all of them)

I'm actually quite happy with how far it got. :) However, it's obviously
incomplete, looses data, and other not so great things...

I'd be curious to know if there are ways to do this correctly (using just a
custom context with *no* data modifications) or if this is a fool's errand.

If it's possible, then I can "upgrade" all the Hypothesis annotations to
Web Annotation Data Model JSON-LD with the addition of one file and one URL
to the payload--which would be a great developer story for folks wanting to
implement the data model.

If it's impossible (or will require data modification), than...there's more
work to be done.

My personal interest is to measure the distance from this "JSON in the
wild" (though obviously informed by the data model as it is...) and fully
compliant Web Annotation Data Model format.

If I can build the bridge...I figure I can teach others to too. ^_^

Cheers!
Benjamin
--
Developer Advocate
http://hypothes.is/

Received on Wednesday, 22 July 2015 21:22:15 UTC