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

Option to compact terms but not values #338

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

Comments

Projects
None yet
2 participants
@lanthaler
Member

lanthaler commented Mar 19, 2014

_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?

@lanthaler lanthaler added the framing label Mar 19, 2014

@fsteeg fsteeg referenced this issue Jul 22, 2014

Closed

lobid API 2.0 #1

@gkellogg gkellogg added this to the JSON-LD.next milestone Mar 17, 2015

@gkellogg gkellogg added on-hold api 1.1 and removed framing labels Sep 21, 2016

@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 and removed on-hold labels Apr 4, 2018

@gkellogg

This comment has been minimized.

Show comment
Hide comment
@gkellogg

gkellogg Jul 8, 2018

Member

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

Member

gkellogg commented Jul 8, 2018

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

@gkellogg gkellogg closed this Jul 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment