(no subject)

Hi Julia,

I just fiddled with the playground and also couldn't make this work with
today's framing algorithm.

I believe it relates back to an issue I filed here
<https://github.com/json-ld/json-ld.org/issues/119> (still open, and
explicitly mentioned from the draft framing spec
<http://json-ld.org/spec/latest/json-ld-framing/#remove-embed>).

  -Josh


On Fri, Aug 8, 2014 at 3:05 AM, Julian Everett <julianjeverett@yahoo.com>
wrote:

>  Hi there,
>
> I have a message format graph which contains multiple object references to
> the same resource. Minimally extending the jsonld playground framed/library
> example, a similar graph might look something like this (where a bookmark
> predicate has been added which also points to the introduction chapter):
>
> {
>   "@context": {
>     "dc": "http://purl.org/dc/elements/1.1/",
>     "ex": "http://example.org/vocab#",
>     "xsd": "http://www.w3.org/2001/XMLSchema#",
>     "ex:contains": {
>       "@type": "@id"
>     },
>     "ex:bookmark": {
>       "@type": "@id"
>     }
>   },
>   "@graph": [
>     {
>       "@id": "http://example.org/library",
>       "@type": "ex:Library",
>       "ex:contains": "http://example.org/library/the-republic"
>     },
>     {
>       "@id": "http://example.org/library/the-republic",
>       "@type": "ex:Book",
>       "dc:creator": "Plato",
>       "dc:title": "The Republic",
>       "ex:contains": "http://example.org/library/the-republic#introduction
> ",
>       "ex:bookmark": "http://example.org/library/the-republic#introduction
> "
>     },
>     {
>       "@id": "http://example.org/library/the-republic#introduction",
>       "@type": "ex:Chapter",
>       "dc:description": "An introductory chapter on The Republic.",
>       "dc:title": "The Introduction"
>     }
>   ]
> }
>
> Modifying the frame to support this:
>
> {
>   "@context": {
>     "dc": "http://purl.org/dc/elements/1.1/",
>     "ex": "http://example.org/vocab#"
>   },
>   "@type": "ex:Library",
>   "ex:contains": {
>     "@type": "ex:Book",
>     "ex:contains": {
>       "@type": "ex:Chapter"
>     },
>     "ex:bookmark": {
>       "@type": "ex:Chapter"
>     }
>   }
> }
>
> results in the following output, where there is one instance of the
> Chapter (i.e. ex:contains) and one reference to the instance of the Chapter
> (i.e. ex:bookmark) :
>
> {
>   "@context": {
>     "dc": "http://purl.org/dc/elements/1.1/",
>     "ex": "http://example.org/vocab#"
>   },
>   "@graph": [
>     {
>       "@id": "http://example.org/library",
>       "@type": "ex:Library",
>       "ex:contains": {
>         "@id": "http://example.org/library/the-republic",
>         "@type": "ex:Book",
>         "ex:bookmark": {
>           "@id": "http://example.org/library/the-republic#introduction"
>         },
>         "ex:contains": {
>           "@id": "http://example.org/library/the-republic#introduction",
>           "@type": "ex:Chapter",
>           "dc:description": "An introductory chapter on The Republic.",
>           "dc:title": "The Introduction"
>         },
>         "dc:creator": "Plato",
>         "dc:title": "The Republic"
>       }
>     }
>   ]
> }
>
> I understand the logic of this behaviour, that there is one input instance
> of the entity and hence one instance in the output. However for the
> purposes of API consumer friendliness (particularly as my frame nesting is
> multi-level, and would hence otherwise result in the need for client-side
> tree traversals) what I really need is "frame by value" semantics that
> would generate:
>
> {
>   "@context": {
>     "dc": "http://purl.org/dc/elements/1.1/",
>     "ex": "http://example.org/vocab#"
>   },
>   "@graph": [
>     {
>       "@id": "http://example.org/library",
>       "@type": "ex:Library",
>       "ex:contains": {
>         "@id": "http://example.org/library/the-republic",
>         "@type": "ex:Book",
>         "ex:bookmark": {
>           "@id": "http://example.org/library/the-republic#introduction",
>           "@type": "ex:Chapter",
>           "dc:description": "An introductory chapter on The Republic.",
>           "dc:title": "The Introduction"
>         },
>         "ex:contains": {
>           "@id": "http://example.org/library/the-republic#introduction",
>           "@type": "ex:Chapter",
>           "dc:description": "An introductory chapter on The Republic.",
>           "dc:title": "The Introduction"
>         },
>         "dc:creator": "Plato",
>         "dc:title": "The Republic"
>       }
>     }
>   ]
> }
>
> Is such output achievable via framing please, or do I need to add some
> kind of post-framing graph denormalisation step?
>
> thanks a lot
>
> Julian
>
>
>

Received on Friday, 8 August 2014 16:03:06 UTC