Skip to content

Option to compact terms but not values #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lanthaler opened this issue Mar 19, 2014 · 1 comment
Closed

Option to compact terms but not values #338

lanthaler opened this issue Mar 19, 2014 · 1 comment
Labels
api defer Issue deferred to future Working Group

Comments

@lanthaler
Copy link
Member

_This was raised by Fabian Steeg:_

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?

@gkellogg gkellogg added this to the JSON-LD.next milestone Mar 17, 2015
@gkellogg gkellogg modified the milestone: JSON-LD.next Sep 22, 2016
@gkellogg gkellogg removed the 1.1 label Sep 22, 2016
@gkellogg gkellogg added defer Issue deferred to future Working Group and removed on-hold labels Apr 4, 2018
@gkellogg
Copy link
Member

gkellogg commented Jul 8, 2018

Transfered to WG: w3c/json-ld-api#3.

@gkellogg gkellogg closed this as completed Jul 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api defer Issue deferred to future Working Group
Projects
None yet
Development

No branches or pull requests

2 participants