You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -261,6 +263,107 @@ A context may be serialized to Ruby to speed this process using `Context#to_rb`.
261
263
262
264
As JSON-LD may come from many different sources, included as an embedded script tag within an HTML document, the RDF Reader will strip input before the leading `{` or `[` and after the trailing `}` or `]`.
263
265
266
+
## Extensions from JSON-LD 1.0
267
+
This implementation is being used as a test-bed for features planned for an upcoming JSON-LD 1.1 Community release.
268
+
269
+
### Scoped Contexts
270
+
A term definition can include `@context`, which is applied to values of that object. This is also used when compacting. Taken together, this allows framing to effectively include context definitions more deeply within the framed structure.
271
+
272
+
{
273
+
"@context": {
274
+
"ex": "http://example.com/",
275
+
"foo": {
276
+
"@id": "ex:foo",
277
+
"@type": "@vocab"
278
+
"@context": {
279
+
"Bar": "ex:Bar",
280
+
"Baz": "ex:Baz"
281
+
}
282
+
}
283
+
},
284
+
"foo": "Bar"
285
+
}
286
+
287
+
### @id and @type maps
288
+
The value of `@container` in a term definition can include `@id` or `@type`, in addition to `@set`, `@list`, `@language`, and `@index`. This allows value indexing based on either the `@id` or `@type` of associated objects.
289
+
290
+
{
291
+
"@context": {
292
+
"@vocab": "http://example/",
293
+
"idmap": {"@container": "@id"}
294
+
},
295
+
"idmap": {
296
+
"http://example.org/foo": {"label": "Object with @id <foo>"},
297
+
"_:bar": {"label": "Object with @id _:bar"}
298
+
}
299
+
}
300
+
301
+
### Transparent Nesting
302
+
Many JSON APIs separate properties from their entities using an intermediate object. For example, a set of possible labels may be grouped under a common property:
"main_label": "This is the main label for my resource",
316
+
"other_label": "This is the other label"
317
+
}
318
+
}
319
+
320
+
In this case, the `labels` property is semantically meaningless. Defining it as equivalent to `@nest` causes it to be ignored when expanding, making it equivalent to the following:
"main_label": "This is the main label for my resource",
333
+
"other_label": "This is the other label"
334
+
}
335
+
336
+
Similarly, properties may be marked with "@nest": "nest-term", to cause them to be nested. Note that the `@nest` keyword can also be aliased in the context.
"main_label": "This is the main label for my resource",
350
+
"other_label": "This is the other label"
351
+
}
352
+
}
353
+
354
+
In this way, nesting survives round-tripping through expansion, and framed output can include nested properties.
355
+
356
+
### Framing Updates
357
+
The [JSON-LD Framing 1.1 Specification]() improves on previous un-released versions.
358
+
359
+
*[More Specific Frame matching](https://github.com/json-ld/json-ld.org/issues/110) – Allows framing to extend to elements of value objects, and objects are matched through recursive frame matching. `{}` is used as a wildcard, and `[]` as matching nothing.
360
+
*[Graph framing](https://github.com/json-ld/json-ld.org/issues/118) – previously, only the merged graph can be framed, this update allows arbitrary graphs to be framed.
361
+
* Use `@graph` in frame, matches the default graph, not the merged graph.
362
+
* Use `@graph` in property value, causes the apropriatly named graph to be used for filling in values.
363
+
*[Reverse properties](https://github.com/json-ld/json-ld.org/issues/311) – `@reverse` (or a property defined with `@reverse`) can cause matching values to be included, allowing a matched object to include reverse references to any objects referencing it.
364
+
*[@omitDefault behavior](https://github.com/json-ld/json-ld.org/issues/389) – In addition to `true` and `false`, `@omitDefault` can take `@last`, `@always`, `@never`, and `@link`.
365
+
*[multiple `@id` matching](https://github.com/json-ld/json-ld.org/issues/424) – A frame can match based on one or more specific object `@id` values.
366
+
264
367
## Documentation
265
368
Full documentation available on [RubyDoc](http://rubydoc.info/gems/json-ld/file/README.md)
266
369
@@ -286,7 +389,7 @@ Note, the API method signatures differed in versions before 1.0, in that they al
0 commit comments