Skip to content
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

Context-based optimization #4

Open
vcharpenay opened this issue Jan 17, 2020 · 3 comments
Open

Context-based optimization #4

vcharpenay opened this issue Jan 17, 2020 · 3 comments

Comments

@vcharpenay
Copy link
Collaborator

Some recurrent patterns within a JSON-LD documents could be summarized as a context entry and serialized in a more compact way using a local context.

E.g.

{
  "@graph": [
    { "p": { "@value": "2", "@type": "xsd:unsignedInt" } },
    { "p": { "@value": "4", "@type": "xsd:unsignedInt" } }
  ]
}

is equivalent to:

{
  "@context": {
    "p": { "@type": "xsd:unsignedInt" }
  },
  "@graph": [
    { "p": 2 },
    { "p": 4 }
  ]
}
@davidlehn
Copy link

Perhaps transformations like this are out of scope for basic CBOR serialization? They produce the same semantic data, but a JSON to "optimized" CBOR to JSON round trip would not result in equivalent JSON structures. I'm not sure where these algorithms should be developed. Maybe something to add to the best practices doc. Some transformations may be serialization specific too. In any case, I imagine using these should be optional.

@pchampin
Copy link
Contributor

I think this note can cover two kinds of thing:

  • how can we best encode a JSON-LD in CBOR, and
  • how can we refactor a JSON-LD document to make it even more compact in CBOR.

Those are indeed two different problems, which should be presented separately, but I think both are in scope. Note that #1 also relates to the second category.

@msporny
Copy link
Member

msporny commented Mar 31, 2020

I wrote some stuff down about context-based optimization experiments we've done over the past couple of years at Digital Bazaar: #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Non TR Work
Development

No branches or pull requests

4 participants