W3C home > Mailing lists > Public > public-linked-json@w3.org > March 2016

Re: a question about framing test 14

From: Dave Longley <dlongley@digitalbazaar.com>
Date: Wed, 30 Mar 2016 12:42:08 -0400
To: james anderson <james@dydra.com>, Linked JSON <public-linked-json@w3.org>
Message-ID: <56FC01E0.2030409@digitalbazaar.com>
On 03/30/2016 12:07 PM, james anderson wrote:
> good afternoon;
>> The framing spec is sorely out-of-date and does not include options like
>> those specified in that issue.
> this reads as if one has yet to decide, what the framing algorithm is
> intended to do.

That is correct. The behavior has not yet been formally standardized, 
though most (if not all) implementations currently have the same 
behavior. It is a work in progress.

> is there some way to understand the comments to that issue as an answer
> to the question about how nested embedding is to work other than “by
> default"?
> i see the options, but the intended effect is not clear.

You may specify these embed options within your frame or as defaults in 
the API:

"@embed": "@always" - For a node that matches the frame filter, every 
single one of its related nodes will be embedded (or nested) within that 
node -- and this nesting behavior will recurse through those related 
nodes until no other related nodes are found or until a cycle is 
encountered in the graph. Note that this may cause data duplication in 
the output.

"@embed": "@last" - This behavior will match "@always" except that a 
list of references to previously embedded nodes will be maintained. When 
a embedding/nesting operation occurs, that list will be checked to see 
if the related node has already been embedded/nested. If it has, that 
embedded node is moved to the new location and, at its old location, 
replaced with only a reference to its subject. In this way, no data 
duplication occurs and the "last" position the algorithm touches will be 
where the embed occurs. This is the default embed behavior because it 
does not change the data.

"@embed": "@never" - This behavior will always cause related nodes to be 
referenced by their subject only, never embedded/nested.

"@embed": "@link" - This behavior will do the same thing that "@always" 
does, however, without causing any data duplication. Instead, an 
in-memory reference will be used whenever an embedded/nested node 
appears more than once. This method does not produce an easily 
serializable document, but is useful for some applications to work with.

I'll show some examples for how you specify these options in your frame 
in my response to your other email.

Dave Longley
Digital Bazaar, Inc.
Received on Wednesday, 30 March 2016 16:42:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:47 UTC