[annotator-dev] Annotations without

Riccardo Tasso riccardo.tasso at gmail.com
Tue Nov 12 22:16:05 UTC 2013


Hi all,
   I really appreciate annotator, and I'm evaluating it for my use case.
I'd like to talk about it with you.

I have a very large text stored in my backend and many annotations on it in
the form of: <begin, end, tag>. As you may argue I already have a backend
which handles both annotations and contents, so I'm interested only in the
annotator javascript library.

The frontend receives a list of chapters and, clicking on each one, the
user can request to the backend the text contained in each chapter and the
annotations covering that part of it.

Imagine something an document body like this:
<div class="title" data-begin=0 data-end=1000>First Chapter</div>
<div class="content" data-begin=0 data-end=1000></div>

<div class="title" data-begin=1000 data-end=2000>Second Chapter</div>
<div class="content" data-begin=1000 data-end=2000></div>

...

And after a click on the second chapter:
<div class="title" data-begin=0 data-end=1000>First Chapter</div>
<div class="content" data-begin=0 data-end=1000></div>

<div class="title" data-begin=1000 data-end=2000>Second Chapter</div>
<div class="content" data-begin=1000 data-end=2000>Lorem ipsum dolor sit
amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum</div>

...

The data-begin and data-end attributes for each div represent the "real"
offsets of each chapter of my text.

My first question is about inserting a new annotation: how can I use
annotator to send to my backend the annotation with the "real" offsets? For
example, for the word "Lorem" the real offset is { begin: 1000, end: 1005>.
Please note that my backend doesn't care the HTML structure, and the "real"
offset is calculated by the offset of "Lorem" in his div summed with the
data-begin attribute of its div.

The second question is about reading existing annotations: how can I use
annotator to highlight the right spans of text without using only the
data-begin and data-end attributes and the <begin, end> of each annotation?

Thank you in advance, I hope to have been clear.
Cheers,
   Riccardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20131112/04e903ce/attachment-0002.html>


More information about the annotator-dev mailing list