RE: Annotea Features and EARL

Hello,
With a bookmarklet, you can get the current selection in the browser window.
So you can attach the annotation to any string.

You will also need to browse frames in the document to find the frame where
the selection came from and then pick up the URL of this frame.

Here is an example with Internet Explorer (you can adapt this for netscape
also, replacing document.selection by document.getSelection; note that with
Netscape, I do not know DHTML enought to dynamically change the color of the
highlighted text... whereas it's easy with IE):
javascript:rng=null;loc=location.href;if(this.length==0){sel=document.select
ion}else{encore=true;for(i=0;encore&&(i<this.length);i++){sel =
this.frames[i].document.selection;if (sel.createRange().text!="")
{encore=false}}};sel.createRange().execCommand("BackColor","","yellow");txt=
sel.createRange().text;sel.empty();if (txt=="")txt="<whole
document>";comment=prompt("New annotation for\n"+txt,"");alert("Attached
to="+txt+"\nComment="+comment);

You might improve this example by getting some context to the selection or
make sure the string you've selected is unique in the document, or get the
ID of the nearest element in the document, etc.

Talking about XPointers to anchor annotations, I'm not sure that using IDs
is a good idea: users do not expect annotations to remain on the document if
the CONTENT has changed! Imagine you highlight a title in the CNN home page.
The next day, the title will be different, but you will still get your OLD
annotation.
Of course, there might be cases when people want to explicitely attach
annotations to the structure of the document, although I cannot find
compelling examples. But in the general case, people attach annotations to
the CONTENT.

So you may use IDs in the document to help the algorithm locate those
annotations, but you should also use CONTENT (and in my opinion, CONTENT
should remain the main heuristic).
You could also read the paper from Microsoft "Robust Annotation Positioning
in Digital Documents." available at
http://www.research.microsoft.com/coet/
 
Laurent.

Received on Tuesday, 10 April 2001 13:29:30 UTC