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

Ability to use multiple layers of annotation. #21

Closed
bjonnh opened this issue Nov 30, 2017 · 4 comments
Closed

Ability to use multiple layers of annotation. #21

bjonnh opened this issue Nov 30, 2017 · 4 comments
Labels
🎭 Duplicate This issue or pull request already exists proposal

Comments

@bjonnh
Copy link

bjonnh commented Nov 30, 2017

This kind of thing cannot be represented in a DOM easily, unless we have a tree and a way for each tree to just represent the index of the annotations in it.

Working in a DOM:
The cat is on the roof

Not working in a DOM:
...............

I was envisionning something similar to (not following any W3C recommendation here, just an idea)

Something is here

<annotation_layer>is</annotation_layer>
<annotation_layer>Something is here</annotation_layer>
<annotation_layer>Something is</annotation_layer>
<annotation_layer>is here</annotation_layer>

But copying the text over and over is probably not a good idea…

@BigBlueHat
Copy link
Member

The way this has been done in the past (afaik) is to keep references to the groups of DOM nodes that represent a single annotation--and juggle all the interleaved DOM nodes if/when anything changes. It's beyond inefficient, but it's what happens when you cram to trees together...

So, from your example, you'd end up with something like this (pseudo code here also):

<p><mark data-anno-id="3">Something </mark><mark data-anno-id="1"><mark data-anno-id="3"><mark data-anno-id="2">is</mark></mark><mark data-anno-id="3"> here</mark></mark></p>

<p><mark data-anno-id="345">And there's more text</mark> down here</p>

Lovely, right? 😉 The text in each selection would be:

  1. "is"
  2. "is here"
  3. "Something is here And there's more text"

Presented as a tree this looks like:

<p>
  <mark data-anno-id="3">Something </mark>
  <mark data-anno-id="1">
    <mark data-anno-id="3">
      <mark data-anno-id="2">is</mark>
    </mark>
    <mark data-anno-id="3"> here</mark>
  </mark>
</p>

<p>
  <mark data-anno-id="345">And there's more text</mark>
  down here
</p>

The DOM will think of (and treat) several of these <mark> tags as parents or children of other <mark> tags. The annotation software, however, would treat them as unrelated and remove/add/change their occurrences wherever they're found. Finding them is one thing (document.querySelectorAll('[data-anno-id=3]) creating them interleaved inside other stuff is entirely another...

@tilgovi
Copy link
Contributor

tilgovi commented Nov 30, 2017

This is helpful context for whomever wants to implement a highlighter, but we haven't got one yet. The demo adds mark do documents as an example of what could be done with the result of selection, but there's no exposed highlighter API yet.

Where does that leave us with this issue? Is there more to discuss here right now? Would it be helpful for me to leave it open?

@BigBlueHat
Copy link
Member

I think let's leave it open and begin planning/coding a highlighter. It's a super hard piece of this puzzle, and having that done will mean more annotation tools (built on Apache Annotator ta boot!). 😉

@Treora
Copy link
Contributor

Treora commented Jul 24, 2020

We do have a simple highlighter now, using the <mark>-based approach, which could be used for overlapping annotations as described above.

Unless I overlook a relevant nuance, this issue and #47 (“Interleaving selections within the DOM”) seem pretty much the same topic; closing this one.

@Treora Treora closed this as completed Jul 24, 2020
@Treora Treora added 🎭 Duplicate This issue or pull request already exists and removed help wanted labels Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎭 Duplicate This issue or pull request already exists proposal
Projects
None yet
Development

No branches or pull requests

4 participants