- From: Vagif Abilov <vagif.abilov@gmail.com>
- Date: Thu, 10 Apr 2014 10:59:34 +0200
- To: public-hydra@w3.org
- Message-ID: <CA+xi7+3v7+GLqghNhC-0_7MM4nrTeZLeUnVxyWFjvtHEhQCJjA@mail.gmail.com>
Hello,
I have an example of JSON document with a context, and I don't fully
understand how its compacted JSON-LD is generated.
Here it is. Note that the "versions" property has both @id and @type.
{
"@context": {
"bridge": "https://confluence.nrk.no/display/RED/Ordbok#",
"schema": "http://schema.org/",
"versions": {
"@id": "bridge:versions",
"@type": "bridge:dictionary"
},
"items": {
"@id": "bridge:versions",
"@container": "@index"
},
"name": "schema:name",
"version": "http://semver.org/spec/v2.0.0.html#semver",
"description": "schema:description"
},
"@id": "http://localhost/api",
"versions": {
"@id": "http://localhost/api/versions",
"@type": "bridge:dictionary",
"items": {
"v1": {
"@id": "http://localhost/api/v1",
"@type": "api",
"name": "v1",
"version": "1.0.0",
"description": "Initial release"
},
"v2": {
"@id": "http://localhost/api/v2",
"@type": "api",
"name": "v2",
"version": "2.0.0",
"description": "Includes pizza-ordering service"
}
}
}
}
If I extract the context from the document and paster into a JSON-LD
Playground Context field, then the Compacted JSON-LD version is generated
like this:
{
"@context": {
"bridge": "https://confluence.nrk.no/display/RED/Ordbok#",
"schema": "http://schema.org/",
"versions": {
"@id": "bridge:versions",
"@type": "bridge:dictionary"
},
"items": {
"@id": "bridge:versions",
"@container": "@index"
},
"name": "schema:name",
"version": "http://semver.org/spec/v2.0.0.html#semver",
"description": "schema:description"
},
"@id": "http://localhost/api",
"bridge:versions": {
"@id": "http://localhost/api/versions",
"@type": "bridge:dictionary",
"items": {
"v1": {
"@id": "http://localhost/api/v1",
"@type": "http://json-ld.org/playground/api",
"description": "Initial release",
"name": "v1",
"version": "1.0.0"
},
"v2": {
"@id": "http://localhost/api/v2",
"@type": "http://json-ld.org/playground/api",
"description": "Includes pizza-ordering service",
"name": "v2",
"version": "2.0.0"
}
}
}
}
Note that the "versions" property is written like "bridge:versions". Why's
that? Because if I simply remove from the Context field "versions" type
(remove the line "@type": "bridge:dictionary"), then the Compacted document
is generated as expected, with "versions" property and without "bridge"
prefix.
I wonder what kind of logic is behind this.
Thanks in advance
Vagif Abilov
Received on Thursday, 10 April 2014 15:06:10 UTC