Skip to content

Add @container: @id #134

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 Jun 8, 2012 · 3 comments
Closed

Add @container: @id #134

lanthaler opened this issue Jun 8, 2012 · 3 comments

Comments

@lanthaler
Copy link
Member

This is a proposal @niklasl made in response to the proposal to support "@container": "@language" (#133):

@container is already a mechanism for letting the two currently defined container keywords, @set and @list, interpret a given array in their own specific way. We can extend the behaviour of @container to let all of @language, @id, @type and regular terms treat an object as a map, in their own, specific ways.

To keep the discussion focused, let's concentrate on "@container": "@id" in this issue (and call it a subject map) and create separate ones for @type and regular terms if required.

Here's an example of using @container with @id (one without aliasing @graph as Niklas did):

{
  "@context": {
    "ex": "http://example.com/",
    "name": "http://xmlns.com/foaf/0.1/name",
    "homepage": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id" },
    "knows": { "@id": "http://xmlns.com/foaf/0.1/knows", "@container": "@id" }
  },
  "@id": "ex:Markus",
  "name": "Markus",
  "homepage": "http://www.markus-lanthaler.com/",
  "knows": {
    "ex:Niklas": {
     ****** what would happen if a different @id would be defined here? *****
      "name": "Niklas",
      "homepage": "http://neverspace.net/"
    }
  }
}

This would be expanded to:

[
  {
    "@id": "http://example.com/Markus",
    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus" } ],
    "http://xmlns.com/foaf/0.1/homepage": [ { "@id": "http://www.markus-lanthaler.com/" } ],
    "http://xmlns.com/foaf/0.1/knows": [ {
      "@id": "http://example.com/Niklas",
      "http://xmlns.com/foaf/0.1/name": [ { "@value": "Niklas" } ],
      "http://xmlns.com/foaf/0.1/homepage": [ { "@id": "http://neverspace.net/" } ]
    } ]
  }
]

A couple of questions:

  • what should happen if a different IRI is assigned to an object in a subject map
  • should properties of subject maps be interpreted as relative IRIs as fallback, i.e., the same way as values of @id

Gregg originally proposed to use something he called "folding" for this and #133:

{
  "@context": {
    "en": {"@id": null", "@language": "en", "@fold": true},
    "de": {"@id": null", "@language": "de", "@fold": true},
    "queenie": {"@id": null", "@fold": true}
  },
  "queenie": {
    "@id": "http://buckingham.uk/queenie",
    "label": {
      "en": { "@value": "The Queen" },
      "de": { "@value": "Die Königin"}
    }
  }
}
@gkellogg
Copy link
Member

gkellogg commented Jun 9, 2012

So, I think this works. I would say that @id in the object trumps the property. I think this might be simpler to work in with the current expansion algorithm too.

@gkellogg
Copy link
Member

RESOLVED: Attempt to add other @container options, such as "@container": "@language" to support Wikidata's language-map use case.

@lanthaler
Copy link
Member Author

RESOLVED: Do not support "@container": "@id" in JSON-LD 1.0.

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

No branches or pull requests

2 participants