Re: Bodies resource from Benjamin

Hi, Rob–

Thanks for putting this together.

I'm afraid I don't understand all of it, such as what precisely a 
"Composite" or "Choice" is, or when you'd want to use one of them.

But I can imagine a situation where someone might have multiple bodies 
and multiple targets (maybe this is the "multiplicity constructions" 
that you mention), and might want a specific body to refer to a specific 
target (or maybe even a body to a body, or something even more 
elaborate… dunno).

Forgive my naivete, but in that case, rather than rely on implicit 
ordering, couldn't you give each target or body an "id", and point to it 
from the other target or body?

For example (which I'm sure is wrong in many ways, but which I hope gets 
the point across):

   {
     "@context": [
       "http://www.w3.org/ns/anno.jsonld",
       "http://example.org/ns/edit.jsonld"
     ],
     "id": "http://example.org/anno1",
     "type": "Annotation",
     "target": {
       "links": [
         {
           "id": "target-1",
           "resource": "http://example.com/doc1",
           "selectors": [ (some selectors…) ]
         },
         {
           "id": "target-2",
           "resource": "http://example.com/doc1",
           "selectors": [ (some other selectors…) ]
         }
       ]
     },
     "body": {
       "type": "Composite",
       "tags": [ {"text": "correction"}, {"text": "typo"} ],
       "comments": {
         "text": "I spelled this right the first time, but not the second",
         "targeting": "#target-1"
       },
       "replacements": {
         "text": "itinerary",
         "targeting": "#target-2"
       }
     }
   }


In any case, while it's encouraging to see this explored more 
completely, we've already made some significant progress with your 
existing proposal, so it's probably best to resolve that, publish an 
updated Data Model spec to TR, and then explore this further if the WG 
feels like it's an interesting and fruitful direction.

Regards–
–Doug

On 9/1/15 11:20 PM, Robert Sanderson wrote:
>
> Okay, as this has not been discussed previously, we should give it a
> fair shot...
>
> Riffing on the strawperson from Benjamin and the mention of Composites
> from Jacob, today I have been trying to model the requirements we have
> in the following way:
>
> The body or target of an annotation is a Composite, where that resource
> has relationships to the included resources.  Those relationships would
> replace the use of motivations, and the base set would be enumerated in
> the model.  Additional relationships could be created to cover further
> use cases, such as the copy-edit replacement or the canvas-painting
> motivation in IIIF.
>
> This would NOT suffer from the main objection to using subProperties of
> hasBody/hasTarget, which is that it would be impossible to determine
> which resources were bodies, which were targets and which neither, as
> hasBody/hasTarget would point to the Composite.  As the Composite is a
> construction within the Annotation, there would be no need to have
> properties other than motivation replacing relationships, thus a pure
> JSON/javascript client could iterate through all of the properties
> (excluding id and type) and know that they were bodies (or targets) even
> if they do not understand the semantics.  For annotations with a known
> structure, the direct method of accessing the information would work
> (anno.body.replacement) meeting the performance requirements expressed.
>
> For example:
>
> {
>    "@context": [
> "http://www.w3.org/ns/anno.jsonld",
> "http://example.org/ns/edit.jsonld"
>    ],
>    "id": "http://example.org/anno1",
>    "type": "Annotation",
>    "target": {
> "resource": "http://example.com/doc1"  // should really be a
> SpecificResource with Selector
>    },
>    "body": {
>       "type": "Composite",
> "tags": [ {"text": "correction"}, {"text": "typo"} ],
>       "comments": {"text": "wow...I should learn to type..."},
>       "replacements": {"text": "itinerary"}
>    }
> }
>
> Here resource is oa:item (which we could rename), and tags, comments,
> replacements are all subProperties of it.  Replacements is defined in
> the second context.
>
>
> However, don't get too excited ... this does NOT work with the other
> multiplicity constructions where the order of the members is important.
> Although in JSON, the value of "tags" is an array, that is actually the
> following turtle:
>
> _:body a oa:Composite ;
>    oa:hasTag [ oa:text "correction"], [ oa:text "typo"]
>
> And not an rdf:List:
>
> _:body a oa:Composite ;
>    oa:hasTag ( [oa:text "correction"] [oa:text "typo"])
>
> (Apologies to those who do not speak turtle as a native language -- the
> first is not ordered, the second is)
>
> Thus, a Choice of comments could NOT be modeled as:
>
> "body": {
>    "type": "Choice",
>    "comments": ["http://eg.org/comment-en", "http://eg.org/comment-fr" ]
> }
>
> Because this would require comments / oa:hasComment to be both ordered
> in some instances and not ordered in others, which is not possible.
>
> Two separate keys and predicates that reflect the same motivation could
> be created (commentsList / oa:hasCommentList, comments / oa:hasComment)
> but that seems pretty terrible, especially as the values for the two
> would be identical.
>
> The current proposal does allow for this use case, as the Composite or
> Choice would simply have SpecificResources with motivations as
> items/members.
>
> Unless someone else can see how this could work (in RDF and JSON
> please), while fulfilling all of the requirements?
>
> Rob
>
>
>
> On Tue, Sep 1, 2015 at 10:06 AM, Doug Schepers <schepers@w3.org
> <mailto:schepers@w3.org>> wrote:
>
>     Hi, Benjamin–
>
>     I realize that you were probably just putting out a strawman for
>     discussion, and that you were probably making a different point, but
>     since you are talking in code, I thought it would be useful to make
>     a specific point about your code.
>
>     Just a high-level response, inline…
>
>     On 9/1/15 11:40 AM, Benjamin Young wrote:
>
>         On Tue, Sep 1, 2015 at 11:21 AM, Robert Sandersonwrote:
>
>
>                  Where this is trending now in my head is that we *keep*
>                  motivation on the annotation, but create classes for
>         bodies.
>                  What this *might* look like in JSON-LD is something like:
>
>                  ```
>                  {
>                     "type": "Annotation"
>                     "motivation": "editing",
>                     "bodies": {
>                       "tags": ["correction", "typo"],
>                       "comment": "wow...I should learn to type...",
>                       "edit": {
>                         "original": "itinirary",
>                         "replacement": "itinerary"
>                       },
>
>
>     This should not be necessary, under any of the proposals we'd been
>     considering thus far.
>
>     My immediate reaction was (I think) similar to Rob's:
>
>              * A pattern for extension that doesn't involve
>         subProperties is what
>              we have now.
>
>
>     If I'm reading Rob correctly, this means that none of the bodies (or
>     targets) should have special sub-properties (or sub-structures) of
>     the same type (e.g. motives/motivations/roles) that require special
>     parsing or processing.
>
>     (Note that Target does have Selectors each with idiosyncratic
>     properties, but in this case, I think it's unavoidable and they are
>     clearly defined.)
>
>
>     Without making any judgment for or against other aspects of your
>     strawman, and keeping everything else the same to isolate this
>     single point for discussion, here's how I'd reformulate your strawman:
>
>       ```
>       {
>          "type": "Annotation"
>          "motivation": "editing",
>          "bodies": {
>            "tags": ["correction", "typo"],
>            "comment": "wow...I should learn to type...",
>            "edit": "itinerary",
>            "related": ["http://dictionary.reference.com/browse/itinerary"]
>          },
>          "target": "http://example.com/doc1"
>          "target": {
>            "source": "http://example.com/doc1",
>            "selector": {
>              "type": "oa:TextQuoteSelector",
>              "exact": "itinirary"
>            }
>          }
>       }
>       ```
>
>     Yes, it's slightly longer. But has the same functionality, and it
>     avoids two crucial problems:
>
>     1) the needless duplication of information;
>     1a) you'd need a TextQuoteSelector in the target anyway to correctly
>     anchor the selection;
>     1b) mechanisms that duplicate information in multiple places are
>     prone to getting out of sync and causing problems;
>
>     2) the need for idiosyncratic and potentially unpredictable
>     additional structures or properties within a known type of property
>     2a) this makes processing more difficult even for known structures
>     of this type
>     2b) introducing such a structure into an extension point sets a
>     pattern that makes graceful degradation very difficult
>
>
>     And, again, it's not necessary. I think it's useful for use to talk
>     about these edge cases (and central use cases) because it helps us
>     validate that our design is practical and versatile. In this case,
>     you wrote some strawman code that might well have been done by a
>     developer unfamiliar with the data model's design principles, and we
>     were easily able to reformulate it into something that easily avoids
>     the problems.
>
>     This tells me 2 things:
>
>     1) the data model is strong and flexible;
>
>     2) we need to be really clear about how the model works, in terms
>     the average developer can understand, and show explicitly how to add
>     extensions (where they can be added, and how they should be
>     structured); we can provide examples to make it clearer (like Rob's
>     “antecedent” and “subsequent” motives).
>
>
>
>
>     On a related topic (which I'm putting here just to capture it)…
>     Note that this my formulation has a somewhat interesting side
>     effect. Since the TextQuoteSelector doesn't have a "prefix" or
>     "suffix", it's ambiguous which instance of the "exact" quote value
>     "itinirary" it's referring to, if there was more than one
>     misspelling in the same document. Is it the first instance? The last
>     instance? All instances? Is this a hack for spellcheck, or an abuse
>     of the data model? Should this be expressed as multiple targets? Or
>     should we define some "all instances" property? Or should we require
>     a "prefix" and/or "suffix"? Is the Data Model the right place to
>     define UA behavior for resolving selectors? Or should there be
>     another spec, perhaps something that defines UA behavior for
>     selectors in terms of RangeFinder and other APIs?
>
>     Food for thought.
>
>     Regards–
>     –Doug
>
>
>
>
> --
> Rob Sanderson
> Information Standards Advocate
> Digital Library Systems and Services
> Stanford, CA 94305

Received on Wednesday, 2 September 2015 03:59:47 UTC