【发布时间】:2017-01-25 01:25:46
【问题描述】:
是否可以通过 Wirecloud NGSI API 的 updateAttributes() 函数更新子属性?
例如,这块实体中的坐标 (entity.location.coords.coordinates[0]=-2.000000)。
"attrNames": [ "A1", "A2", "position" ],
"creDate": 1389376081,
"modDate": 1389376244,
"location": {
"attrName": "position",
"coords": {
"type": "Point",
"coordinates": [ -3.691944, 40.418889 ]
}
已编辑
我自己的回答:可以通过将对象作为属性值传递。
ngsi.updateAttributes([
{
'entity': {'id': "entity-id"},
'attributes':[{
"name":"location","contextValue": {
"attrName": "position",
"coords": {
"type": "Point",
"coordinates": [ -2.000000, 40.418889 ]
}
}
}]
}
], {
onSuccess: onUpdateAttributesSuccess,
onFailure: onUpdateAttributesFail
}
);
但是,Wirecloud 使用的是 NGSI API v1,因此所有属性在向 Orion 发送/接收时都被视为字符串。
更多信息:http://fiware-orion.readthedocs.io/en/master/user/structured_attribute_valued/
【问题讨论】:
标签: fiware fiware-orion fiware-wirecloud