Re: a question about framing test 16

On 03/30/2016 12:09 PM, james anderson wrote:
> good afternoon;
>
>> On 2016-03-30, at 16:50, Dave Longley <dlongley@digitalbazaar.com
>> <mailto:dlongley@digitalbazaar.com>> wrote:
>>
>> On 03/30/2016 10:46 AM, james anderson wrote:
>>> good afternoon;
>>>
>>> […]
>>>
>>> “by default” means, unless the constituent includes its own
>>> frame? (see pls my question about test 14.)
>>
>> "By default" means unless specified otherwise in the frame itself
>> or in the options passed to the framing API. I linked to an issue
>> about this in my response to your question regarding test 14.
>
> i saw that, but understood neither, how the behavior was to be
> “specified otherwise”, nor how a global setting was to interact with
> the possible local specification.

You can specify these options in your frame. For example, framing using
the frame below will not nest/embed any nodes that it encounters in
nodes of type "ex:Library", instead it will list them as subject
references only.

```
{
   "@context": {...},
   "@type": "ex:Library",
   "ex:contains": {
     "@embed": "@never"
   }
}
```

The next example, below, shows the use of a "subframe". Any nodes that
are related to "ex:Library"-typed nodes via the "ex:contains" predicate
will always be embedded, however, any nodes that *they* are related to
via the "ex:contains" predicate will never be embedded.

```
{
   "@context": {...},
   "@type": "ex:Library",
   "ex:contains": {
     "@embed": "@always",
     "ex:contains": {
       "@embed": "@never"
     }
   }
}
```

You can also specify more filters in your subframes. Here the only nodes
that will be included (at all, by reference or embed, but here
specifically it would be by embed due to "@always") inside of an
"ex-Library"-typed node would be those that are themselves "ex:Book"-typed:

```
{
   "@context": {...},
   "@type": "ex:Library",
   "ex:contains": {
     "@embed": "@always",
     "@type": "ex:Book",
     "ex:contains": {
       "@embed": "@never"
     }
   }
}
```

Note that if no "@embed" option is provided, then the default will be
used. The default for the API is "@embed": "@last", however, this
default can be changed by specifying a different one when calling the
API. A local specification of an embed flag will always override the
default -- and once set at some part in the tree, that local
specification will persist for all children in that portion of the tree
until set to something else (locally).

Does this adequately explain how to use these flags?


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

Received on Wednesday, 30 March 2016 18:54:08 UTC