W3C home > Mailing lists > Public > public-openannotation@w3.org > March 2013

[PROPOSAL] DomRangeSelector

From: Randall Leeds <randall.leeds@gmail.com>
Date: Wed, 20 Mar 2013 18:15:21 -0700
Message-ID: <CAAL6JQhE+wNzSpUEsO-25ZvuUAk_bLJNRHDcLPx954Pd=JCj9w@mail.gmail.com>
To: public-openannotation <public-openannotation@w3.org>
In Annotator [0], the historical format for a selected range of a
document is a serialization of the properties of a DOM Range [1]
object (modulo a renaming of startContainer -> start, endContainer ->
end).

In porting Annotator to use the OA spec, I've found it useful to still
store this selector, even as we store now an oa:TextQuoteSelector and
oa:TextPositionSelector. The reason is that it is cheapest to locate a
range by using XPath (when the XPath still properly identifies the
same text), since it can be done by direct traversal.

It strikes me as a sensible addition to our spec to have a
DomRangeSelector. Since this is a standard that has been implemented
in browsers for quite some time it is familiar to developers and well
established.

I would propose something like the following:

oa:DomRangeSelector   Class        A resource which describes the
segment of interest as specified by the DOM Level 2 Traversal Range
specification.
oa:startContainer           Property   A string identifying the
element at the start of the range.
oa:startOffset               Property    A string identifying the
character offset within the start container.
oa:endContainer
oa:endOffset

The only part I'm not sure how to specify well is the spelling of the
container values. We use XPath, but this could be xpointer or some
other thing. Probably to keep things simple, an XPath is adequate.

For an example of an annotation with this format, see this URL for a
(JSON) representation, see [2].

I submit this proposal for discussion and comments from the group,
either for inclusion in Core or Extension.

-R

[0] http://okfn.org/labs/annotator
[1] http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
[2] https://dev.hypothes.is/api/v1/annotations/ODwQlmoYSX2JdzZF5zX_Uw
Received on Thursday, 21 March 2013 01:15:48 GMT

This archive was generated by hypermail 2.3.1 : Thursday, 21 March 2013 01:15:49 GMT