Re: [web-annotation] XPath Range Selector

As can often be the case with selections and anchoring, it's hard to 
know what the most "semantic" selection description is. Should it be 
character offsets within the text of two elements and all those 
between them? Or should you measure offsets from (either after or 
before) the end elements?

Your first one gets closest to what I would use for describing DOM 
Ranges. I would change both TextPositionSelectors to be zero-width 
points. The selection is the range of text between (left inclusive) in
 document order.

That's just my pick for the most faithful representation of the DOM 
object, not the most semantic description of the user intent, we may 
be to select from the start of one phrase to the end of another.

And if we really wanted a faithful representation of DOM Range we 
would select the container node for each boundary point any way we 
please (fragment, css, xpath) and then describe the offset _either_ in
 terms of a text position _or_ an n-th child sort of construction in 
css or xpath.

Your second example is reasonable, but describes things differently. 
It would also not be precluded by the start and end being their own 
selectors.The start and end being selectors and sub-selecting from the
 range are two different needs.

A DOM Range, boundary points in the text.

```json
{
  "selector": {
    "type": "Range",
    "startSelector": {
      "type": "XPathSelector",
      "path": "//article/p[1]/text()",
      "subSelector": {
        "type": "TextPositionSelector",
        "start": 10,
        "end": 10
      }
    },
   "endSelector": {
      "type": "XPathSelector",
      "path": "//article/p[3]/text()",
      "subSelector": {
        "type": "TextPositionSelector",
        "start": 8,
        "end": 8
      }
    }
  }
}
```

A more "human" quote range, just as an example:

```json
{
  "selector": {
    "type": "Range",
    "startSelector": {
      "type": "CssSelector",
      "cssSelector": "article",
      "subSelector": {
        "type": "TextQuoteSelector",
        "exact": "And so it is with"
      }
    },
   "endSelector": {
      "type": "CssSelector",
      "cssSelector": "article",
      "subSelector": {
        "type": "TextQuoteSelector",
        "exact": "the cuteness of kittens."
      }
    }
  }
}
```

A generic Range is really the flexible thing. It allows some new 
constructions that could turn out to be quite useful.

-- 
GitHub Notif of comment by tilgovi
See 
https://github.com/w3c/web-annotation/issues/95#issuecomment-154522544

Received on Friday, 6 November 2015 20:25:29 UTC