Re: Issue-14: as:Link complexity

On 04/21/2015 01:24 AM, James M Snell wrote:
> Consider this thought experiment: Take the following, process it down
> to N-QUADS, then convert it back to JSON-LD:
> 
> {
>   "items": [
>     {
>       "@context": {"@language": "en"},
>       "@type": "Note",
>       "displayName": "A Simple Note",
>       "content": "This is a simple note",
>       "image": {
>         "@id": "http://example.org/img1.png",
>         "displayName": "A Simple Caption"
>       }
>     },
>     {
>       "@context": {"@language": "sp"},
>       "@type": "Note",
>       "displayName": "Una nota simple",
>       "content": "Esta es una simple nota",
>       "image": {
>         "@id": "http://example.org/img1.png",
>         "displayName": "Un subtítulo sencilla"
>       }
>     }
>   ]
> }
> 
> _:b0 as:items _:b1 .
> _:b0 as:items _:b2 .
> _:b1 a as:Note .
> _:b1 as:displayName "A Simple Note"@en .
> _:b1 as:content "This is a simple note"@en .
> _:b1 as:image <http://example.org/img1.png> .
> _:b2 a as:Note .
> _:b2 as:displayName "Una nota simple"@sp .
> _:b2 as:content "Esta es una simple nota"@sp .
> _:b2 as:image <http://example.org/img1.png> .
> <http://example.org/img1.png> displayName "A Simple Caption"@en .
> <http://example.org/img1.png> displayName "Un subtítulo sencilla" .
> 
> Serializing back into JSON-LD yields...
> 
> {
>   "items": [
>     {
>       "@context": {"@language": "en"},
>       "@type": "Note",
>       "displayName": "A Simple Note",
>       "content": "This is a simple note",
>       "image": {
>         "@id": "http://example.org/img1.png",
>         "displayNameMap": {
>           "en": "A Simple Caption",
>           "sp": "Un subtítulo sencilla"
>         }
>       }
>     },
>     {
>       "@context": {"@language": "sp"},
>       "@type": "Note",
>       "displayName": "Una nota simple",
>       "content": "Esta es una simple nota",
>       "image": {
>         "@id": "http://example.org/img1.png",
>         "displayNameMap": {
>           "en": "A Simple Caption",
>           "sp": "Un subtítulo sencilla"
>         }
>       }
>     }
>   ]
> }
> 

Thanks for this example James!


> Which is clearly not what was intended. It's a simple and somewhat
> contrived example but it illustrates the point that when a single
> Activity Streams document includes aggregated content, relying solely
> on JSON-LD embedding can lead to unexpected and often incorrect
> results.
What do you see 'incorrect' in this example? I understand that one might
expect displayName with just default language, still I don't understand
how do we get from 'possibly unexpected' to 'incorrect'?

I would also like to point out that we discuss scenario where someone
applies JSON-LD processing to the data. We could add simple note that
one should expect such behavior somewhere in ' Natural Language Values'
section. We might also create a detailed issue for that and ask help on
public-linked-json, maybe JSON-LD Framing could provide way to address
it. Still since we talk about case when someone chooses to use JSON-LD
algorithms, we can expect little more understanding of how for example
@language, dislayName and displayNameMap work together.



> Use of as:Link resolves these kinds of issues. Is it perfect?
> No. Is it useful. Yes.  Can the examples in the spec be improved?
> Absolutely. But as I've said before, I'm absolutely -1 on removing
> as:Link.

I don't see anywhere in 'Link' section of a spec, explanation that it
helps with addressing possibly little unexpected behavior of displayName
/ displayNameMap in case of applying JSON-LD processing. I wonder if you
can provide some more examples of 'these kinds of issues'? Especially
ones which don't occur after processing with JSON-LD algorithms.

Cheers!

Received on Tuesday, 21 April 2015 07:01:14 UTC