W3C home > Mailing lists > Public > public-annotation@w3.org > January 2016

Re: [web-annotation] Multiple Selectors

From: Ivan Herman via GitHub <sysbot+gh@w3.org>
Date: Sun, 24 Jan 2016 12:31:41 +0000
To: public-annotation@w3.org
Message-ID: <issue_comment.created-174291171-1453638699-sysbot+gh@w3.org>
@jjett

Thanks for this. Yes, it is very much of an edge case, but it is, 
nevertheless, useful (imho) to see it to make a better decision.

Forgive me, however, but I had real difficulties to grasp the 
structure of the extracts; I am a visual type, so I need an formatted 
code. So I did re-format the codes, and I reproduce the "direct" (let 
us call this way) and the "inverse" examples; please check whether I 
made a mistake. Actually, I think there were some issues in formatting
 with the "inverse", as far as I remember not there was an extra 
bracket somewhere...

Here how I summarize for myself the pro-s and cons.

* (At least in this example) the "inverse" structure is definitely 
more DRY and also more compact (there goes my spaghetti!:-). Which is,
 in general, considered to be a good thing.
* Maybe it is a price to pay for DRY-ness, but I can imagine that, in 
practice, defining an "inverse" structure for a given task is less 
intuitive. Indeed, in the case of a "direct" approach everything that 
is related to selection is part of a (possibly giant) selector, 
meaning that there is a strict separation between *what* is being 
selected and *how* it is selected. The "inverse" seems to spread the 
various selections either to an explicit "selector" and or the 
"source", which may require more thinking (more work...) for the human
 as well as the programmatic user to get it right. 
  * I must admit that, at first, I tried to reproduce the "direct" 
example in "inverse" myself, without looking at your code, and I 
failed/gave up
  * (I did not try to go all possible variations to be sure that the 
"inverse" part does the same as the "direct" one, I just trust you on 
that.)
* (As we said before) the "inverse" require less (if any) change on 
the current model. The "direct" approach requires a new predicate (or 
some sort of an OWL-like trick on the vocabulary to be able to reuse 
"selector").
* The "inverse" approach "feels" more elegant in some sense...:-)

Did I forget any pros and/or cons?

As we all said before, both work and, actually, I have the impression 
that everyone of us could live either way. Personally, at this moment,
 my (mild) preference still goes to the "direct" approach that I 
continue to find more intuitive.

Ivan

P.S. Here are the formatted examples:


The "direct" structure:

```json
{
    "type": "SpecificResource",
    "source": "http://example.org",
    "selector": [{
        "type": "foo:QuerySelectorAlt",
        "value": "knownItem",
        "subSelector": [{
            "type": "foo:PageSelector",
            "value": "desiredPage",
            "subSelector": [{
                "type": "FragmentSelector",
                "value": "namedSection",
                "subSelector": [{
                    "type": "TextPositionSelector",
                    "start": 5, 
                    "end": 28
                },{
                    "type": "TextPositionSelectorAlt",
                    "start": 45, 
                    "end": 68
                }]
            },{
                "type": "TextQuoteSelector",
                "exact": "quote in namedSelection"
            }]
        },{       
            "type": "foo:PageSelectorAlt",
            "value": "desiredPage",
            "subSelector": {
                "type": "FragmentSelector",
                "value": "namedSection",
                "subSelector": {
                    "type": "TextPositionSelector",
                    "start": 5, 
                    "end": 28
                }
            }
        }]
    },{
        "type": "foo:QuerySelector",
        "value": "knownItemAlt",
        "subSelector": {
            "type": "foo:PageSelector",
            "value": "desiredPage",
            "subSelector": {
                "type": "FragmentSelector",
                "value": "namedSection",
                "subSelector": {
                    "type": "TextPositionSelector",
                    "start": 5,
                    "end": 28
                }  
            }
        }
    }]
}
```

The "inverse" structure:

```json
{
        "type": "SpecificResource",
        "selector" : [{
                "type": "SpecificResource",
                "selector" :[{
                        "type": "TextPositionSelector",
                        "start": 5,
                        "end": 28
                },{
                        "type": "TextPositionSelectorAlt",
                        "start": 45,
                        "end": 68
                }],
                "source": {
                        "selector": {
                                "type": "FragmentSelector",
                                "value": "namedSection"
                        }
                }
        },{
                "type": "TextQuoteSelector",
                "exact": "quote in namedSelection"
        }],
        "source": {
                "selector": [{
                        "type": "foo:PageSelector",
                        "value": "desiredPage"
                },{
                        "type": "foo:PageSelectorAlt",
                        "value": "desiredPage"
                }],
                "source" : {
                        "selector": [{
                                "type": "foo:QuerySelector",
                                "value": "knownItem"
                        },{
                                "type": "foo:QuerySelectorAlt",
                                "value": "knownItem"
                        }],
                        "source": "http://example.org"
                }
        }
}
```

-- 
GitHub Notification of comment by iherman
Please view or discuss this issue at 
https://github.com/w3c/web-annotation/issues/93#issuecomment-174291171
 using your GitHub account
Received on Sunday, 24 January 2016 12:31:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:54:43 UTC