Open jmcanterafonseca opened 7 years ago
@McMutton would you like to work on this issue? at least start analysing it?
I understand this @context
field may be useful/needed for the ETSI-CIM version of the API but, given the work is yet in progress (until end of 2017?). Thus I don't recommend to work on it now.
@fgalan I have updated the issue after a double check. I think it is a feature we need to pave the way towards ETSI CIM and at least it would deserve analysis at this stage
Not sure if I'm getting the point...
It [the
@context
] would be an optional "property" of an entity, provided at creation time or modified later.
Actually, current Orion allows you to create such property as a regular attribute:
curl localhost:1026/v2/entities -s -S --header 'Content-Type: application/json' -d @- <<EOF
{
"id": "Room1",
"type": "Room",
"@context": {
"type": "Text",
"value": "My marvellous context"
},
"temperature": {
"value": 23,
"type": "Float"
}
}
EOF
and retrieve/modify using regular NGSIv2:
curl -s -S localhost:1026/v2/entities/Room1 | python -mjson.tool
{
"@context": {
"metadata": {},
"type": "Text",
"value": "My marvellous context"
},
"id": "Room1",
"temperature": {
"metadata": {},
"type": "Float",
"value": 23
},
"type": "Room"
}
So in some way (and at least the way we need "to pave the way") it is already implemented and I confirm my recommendation on not working more on this line at the present moment. Once ETSI-CIM gets release, we'll see.
yes, but the problem is that we do not want to be caught in the trap of { type, value, metadata } of a regular NGSIv2 attribute. We want this attribute to be a special one and to allow it to be just an array or an object as the JSON-LD states.
2017-10-04 13:56 GMT+02:00 Fermín Galán Márquez notifications@github.com:
Not sure if I'm getting the point...
It [the @context] would be an optional "property" of an entity, provided at creation time or modified later.
Actually, current Orion allows you to create such property as a regular attribute:
curl localhost:1026/v2/entities -s -S --header 'Content-Type: application/json' -d @- <<EOF { "id": "Room1", "type": "Room", "@context": { "type": "Text", "value": "My marvellous context" }, "temperature": { "value": 23, "type": "Float" } } EOF
and retrieve/modify using regular NGSIv2:
curl -s -S localhost:1026/v2/entities/Room1 | python -mjson.tool { "@context": { "metadata": {}, "type": "Text", "value": "My marvellous context" }, "id": "Room1", "temperature": { "metadata": {}, "type": "Float", "value": 23 }, "type": "Room" }
So in some way (and at least the way we need "to pave the way") it is already implemented and I confirm my recommendation on not working more on this line at the present moment. Once ETSI-CIM gets release, we'll see.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/telefonicaid/fiware-orion/issues/2993#issuecomment-334132196, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqZ_vVoO3MpHNrgdhudKHrsqJtKLQ6Hks5so3KDgaJpZM4PtSsM .
EDITED: In order to smooth the path towards JSON-LD support and ETSI ISG CIM, it would be good to support "@context" as one of the special attributes of an entity, together with "type" and "id". It would be an optional "property" of an entity, provided at creation time or modified later.
Attaching a "@context", even if it remains hidden, will allow in the future to help the conversion process between NGSIv2 representation and the ETSI CIM representation.
From an NGSIv2 query perspective, "@context", will remain as an internal attribute and will not be rendered when rendering NGSIv2 data, at least in normalised format. (Taking Fermin's point that this is ETSI CIM specific).
See "@context" specification at https://www.w3.org/TR/2014/REC-json-ld-20140116/#the-context