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
Copy file name to clipboardExpand all lines: README.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -284,6 +284,20 @@ A term definition can include `@context`, which is applied to values of that obj
284
284
"foo": "Bar"
285
285
}
286
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
+
287
301
### Framing Updates
288
302
The [JSON-LD Framing 1.1 Specification]() improves on previous un-released versions.
# If value contains an @container member, set the container mapping of definition to its value; if its value is neither @set, nor @index, nor null, an invalid reverse property error has been detected (reverse properties only support set- and index-containers) and processing is aborted.
573
-
if(container=value.fetch('@container',false))
572
+
# If value contains an @container member, set the container mapping of definition to its value; if its value is neither @set, @index, @type, @id, an absolute IRI nor null, an invalid reverse property error has been detected (reverse properties only support set- and index-containers) and processing is aborted.
573
+
ifvalue.has_key?('@container')
574
+
container=value['@container']
575
+
# FIXME: Are URIS, @id, and @type reasonable for reverse mappings?
574
576
raiseJsonLdError::InvalidReverseProperty,
575
-
"unknown mapping for '@container' to #{container.inspect} on term #{term.inspect}"unless
576
-
['@set','@index',nil].include?(container)
577
-
definition.container_mapping=container
577
+
"unknown mapping for '@container' to #{container.inspect} on term #{term.inspect}"if
raiseJsonLdError::InvalidContainerMapping,"unknown mapping for '@container' to #{container.inspect} on term #{term.inspect}"unless%w(@list@set@language@index).include?(container)
# Otherwise, if key's container mapping in active context is @language and value is a JSON object then value is expanded from a language map as follows:
# Otherwise, if key's container mapping in active context is @index, @id, @type, an IRI or Blank Node and value is a JSON object then value is expanded from an index map as follows:
277
278
278
279
# Set ary to an empty array.
279
-
ary=[]
280
+
container,ary=container.to_s,[]
280
281
281
282
# For each key-value in the object:
282
283
keys=ordered ? value.keys.sort : value.keys
283
284
keys.eachdo |k|
284
285
# Initialize index value to the result of using this algorithm recursively, passing active context, key as active property, and index value as element.
0 commit comments