json-ld / json-ld.org

JSON for Linked Data's documentation and playground site
https://json-ld.org/
Other
859 stars 152 forks source link

json-ld 1.1: @vocab gets ignored in nested @context with @id-typed values #689

Closed lukasheinrich closed 5 years ago

lukasheinrich commented 5 years ago

on the dev playground, specifying a nested context for the expansion of a object of type "@id" correctly expands a namespace defined in the nested context

{
  "@context": {
    "@vocab": "http://myvobab/",
    "@version": 1.1,
    "pred": {
      "@id": "http://a/predicate",
      "@type": "@id",
      "@context": {
        "mv": "http://myvobab/"
      }
    }
  },
  "pred": "mv:identifier",
  "name": "identifier"
}

expands to

[
  {
    "http://myvobab/name": [
      {
        "@value": "identifier"
      }
    ],
    "http://a/predicate": [
      {
        "@id": "http://myvobab/identifier"
      }
    ]
  }
]

but when using @vocab it does not work:

{
  "@context": {
    "@vocab": "http://myvobab/",
    "@version": 1.1,
    "pred": {
      "@id": "http://a/predicate",
      "@type": "@id",
      "@context": {
        "@vocab": "http://myvobab/"
      }
    }
  },
  "pred": "identifier",
  "name": "identifier"
}

expands to

[
  {
    "http://myvobab/name": [
      {
        "@value": "identifier"
      }
    ],
    "http://a/predicate": [
      {
        "@id": "https://json-ld.org/playground-dev/identifier"
      }
    ]
  }
]

is this expected behavior? I would have expected both documents to expand in the same manner

lukasheinrich commented 5 years ago

sorry , should probably be in json-ld syntax