Re: JSON-LD & nested structure

> On Jul 29, 2016, at 9:04 AM, Dave Longley <dlongley@digitalbazaar.com> wrote:
> 
> On 07/29/2016 11:55 AM, Aymeric Brisse wrote:
>> @Gregg : I cannot assume that the property will only be used by the
>> top-level element.
>> 
>> @Dave : already tried it but it doesn't work
> 
> I modified Gregg's example and it worked for me:
> 
> http://json-ld.org/playground/#/gist/bd569269ce69a8fe7ecebde0713acc73

Dave, I do have the support for supporting value matching on @id, but the reason this doesn’t work for me is that when the frame is expanded, it returns an empty array, rather than one containing on object with the expanded @id. If you take the frame from the playground link and expand it, you’ll get the same thing. Yet, when used for framing, your processor seems to act as if the frame is not empty.

My algorithm works by expanding both input and frame, and using that the frame the output, which is re-compacted using the context from the frame. Yours seems to work differently. The spec algorithm says it uses both expanded input and expanded frame, so yours looks like it doesn’t end up using the expanded frame.

From the expansion algorithm step 12.2: "Otherwise, if result is a JSON object whose only key is @id, set result to null”. This would seem to apply here, and result in a null frame, leading to an empty array result.

If I add “talksAbout”: {} to the frame, my processor works as expected.

> -- 
> Dave Longley
> CTO
> Digital Bazaar, Inc.
> http://digitalbazaar.com

Received on Tuesday, 2 August 2016 20:09:56 UTC