-
Notifications
You must be signed in to change notification settings - Fork 159
Closed
Labels
Milestone
Description
Currently, for JSON data we have, I have to put @context
s all around the JSON to scope properties:
{
"@context": {
"@base": "http://127.0.0.1:8000/api/v2/node/",
"@vocab": "http://127.0.0.1:8000/api/v2/node/?format=vocab#"
},
"@type": "Node",
"@id": "000c3d9d-5d7c-492a-8d3b-bb8b922ae35f",
"config": {
"core.location": {
"@context": {
"@base": "_:config/core.location/",
"@vocab": "http://127.0.0.1:8000/api/v2/node/?format=vocab#config/core.location/"
},
"@id": "123",
"@type": "Location",
"timezone": "Europe/Ljubljana",
"address": "San Juan, Puerto Rico",
"city": "Ljubljana",
"country": "SI",
"geolocation": {
"@context": "http://geojson.org/geojson-ld/geojson-context.jsonld",
"type": "Point",
"coordinates": [
-66.073756,
18.378287
]
},
"altitude": 0.0
},
"core.project": {
"@context": {
"@base": "_:config/core.project/",
"@vocab": "http://127.0.0.1:8000/api/v2/node/?format=vocab#config/core.project/"
},
"@id": "444",
"@type": "Project",
"project": "http://127.0.0.1:8000/api/v2/project/2"
}
}
}
It would be great if I could somehow @vocab
(or @context
) itself would be scoped based on the value of @type
, similarly to what I have to do currently manually. Ideally, JSON-LD would then be something like:
{
"@context": {
"@base": "http://127.0.0.1:8000/api/v2/node/",
"@vocab": "http://127.0.0.1:8000/api/v2/node/?format=vocab#"
},
"@type": "Node",
"@id": "000c3d9d-5d7c-492a-8d3b-bb8b922ae35f",
"config": {
"core.location": {
"@id": "_:config/core.location/123",
"@type": "config/core.location/Location",
"timezone": "Europe/Ljubljana",
"address": "San Juan, Puerto Rico",
"city": "Ljubljana",
"country": "SI",
"geolocation": {
"@context": "http://geojson.org/geojson-ld/geojson-context.jsonld",
"type": "Point",
"coordinates": [
-66.073756,
18.378287
]
},
"altitude": 0.0
},
"core.project": {
"@id": "_:config/core.project/444",
"@type": "config/core.project/Project",
"project": "http://127.0.0.1:8000/api/v2/project/2"
}
}
}
And all definitions of properties would stay exactly the same as in the initial JSON at the top.
kostko, niklasl, ddxgz and azaroth42