Closed davidlehn closed 4 years ago
Language maps might make a more consistent output. We also allow @type: @none
, which has that affect.
"@type": "@none"
in a term definition to prevent value compaction.This seems to be a duplicate of https://github.com/w3c/json-ld-api/issues/33, which was merged in https://github.com/w3c/json-ld-api/pull/63.
So many exciting new 1.1 features I'm losing track! Original question was to do this without language maps. It does look like that "@type": "@none"
feature works (in the distiller). Not yet supported in jsonld.js though.
Compaction context:
{
"@context": {
"@version": 1.1,
"p": {
"@id": "ex:p",
"@type": "@none"
}
}
}
Output:
{
"@context": {
"@version": 1.1,
"p": {
"@id": "ex:p",
"@type": "@none"
}
},
"p": [
{
"@value": "p-aa",
"@language": "aa"
},
{
"@value": "p-bb"
}
]
}
@andygreenegrass Does that look like what you were asking for?
I think this issue can be closed.
I'm not sure where best to track post-1.1 features. Please move or label this as appropriate. This comes from IRC and gitter. https://gitter.im/json-ld/json-ld.org?at=5d852a8c2438b53a64e95467
The use case is wanting to perform compaction and have a uniform output data shape for easier processing. When using
@language
on some values, but not others, you can end up with a non-uniform output shape. Is there some trick with current features that would make a uniform compacted shape possible? Or is pre or post processing the preferred solution in such cases?One solution would be to add
@expand
as a value for@container
(potentially with other flags as well). When compacting, those values would always be expanded. (Would need to consider interaction with other features like language maps.)Current input:
Current compacted output (using input context) can be difficult to easily process:
Possible container feature input:
Possible compacted output (using input context):