Compact terms with expanded values from Fabian Steeg on 2014-03-17 (public-linked-json@w3.org from March 2014) (original) (raw)
Hi!
The JSON-LD API document states: "Expansion has two important goals: removing any contextual information from the document, and ensuring all values are represented in a regular form."
Is there a way to achieve only the second goal, the regular form, but with compact terms? Using compaction with compactArrays=false is pretty close, but there is still at least one thing that is irregular and causing issues for me.
Given this input:
{ "http://example.com/foo": "foo-value", "http://example.com/bar": { "@value": "bar-value", "@language": "en" }, "@context": { "foo": "http://example.com/foo", "bar": "http://example.com/bar" } }
I get this from compaction with compactArrays=false:
{ "@graph": [{ "foo": ["foo-value"], <-- foo: array of strings "bar": [{ <-- bar: array of objects "@language": "en", "@value": "bar-value" }] }], "@context": { "foo": "http://example.com/foo", "bar": "http://example.com/bar" } }
But I'd like to get this (which is what expansion does to the values):
{ "@graph": [{ "foo": [{ <-- both foo and bar: "@value" : "foo-value" array of objects }], "bar": [{ "@language": "en", "@value": "bar-value" }] }], "@context": { "foo": "http://example.com/foo", "bar": "http://example.com/bar" } }
So I guess I'm looking for something like a compactValues=false option.
Is there some way to get this output?
Cheers, Fabian