带有 georel 表达式的 Fiware orion 订阅
Fiware orion subscription with georel expression in condition
我的 Orion 数据库中有一个实体:
{
"id"=>"User-121",
"type"=>"User",
"location"=>{
"type"=>"geo:point",
"value"=>"59.851484, 30.199463"
},
"time"=>{"type"=>"none", "value"=>222909, "metadata"=>{}}
}
此外,我有 3 个订阅此实体,它们在条件表达式中具有相同的坐标:
- Should trigger when the entity is located, at least 100 meters far away from the reference point.
{
"id"=>"...",
"expires"=>"...",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"User-121", "idPattern"=>"", "type"=>"User"}],
"condition"=>{
"attributes"=>["location", "time"],
"expression"=>{
"q"=>"",
"geometry"=>"point",
"coords"=>"59.851484, 30.199463",
"georel"=>"near;minDistance:100"}
}
},
"notification"=>{
"callback"=>"http://callback",
"attributes"=>["time"]
}
}
- Should trigger when the entity is located, at a maximum, 100 meters far away from the reference point
{
"id"=>"...",
"expires"=>"...",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"User-121", "idPattern"=>"", "type"=>"User"}],
"condition"=>{
"attributes"=>["location", "time"],
"expression"=>{
"q"=>"",
"geometry"=>"point",
"coords"=>"59.851484, 30.199463",
"georel"=>"near;maxDistance:100"}
}
},
"notification"=>{
"callback"=>"http://callback",
"attributes"=>["time"]
}
},
- Should trigger when the entity is located at the reference point (has the same coordinates)
{
"id"=>"...",
"expires"=>"...",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"User-121", "idPattern"=>"", "type"=>"User"}],
"condition"=>{
"attributes"=>["location", "time"],
"expression"=>{
"q"=>"",
"geometry"=>"point",
"coords"=>"59.851484, 30.199463",
"georel"=>"equals"}
}
},
"notification"=>{
"callback"=>"http://callback",
"attributes"=>["time"]
}
}
问题是每次我更新实体时,所有订阅都会发送通知。它甚至不依赖于实体的坐标值。无论坐标是什么,我总是收到 3 个更新通知。
我做错了什么?
Orion Context Broker 版本为 0.28.0(git 版本:5c1afdb3dd748580f10e1809f82462d83d2a17d4)
NGSIv2 订阅中的地理位置功能尚未实现(Orion 0.28.0)。请注意,NGSIv2 仍处于测试状态,有时 the specification(其中 geometry
、georel
和 coords
被定义为 expression
的一部分)是向前迈出的一步实施。
有关于此的 a github issue,您可以订阅以了解此功能何时实施。
编辑:NGSIv2 订阅中的地理位置功能将在 Orion 1.3.0 中可用(将于 8 月底或 9 月初发布)。如果您不想等待,请注意该功能在开发分支中也可用(以及关联的 Docker)。
我的 Orion 数据库中有一个实体:
{
"id"=>"User-121",
"type"=>"User",
"location"=>{
"type"=>"geo:point",
"value"=>"59.851484, 30.199463"
},
"time"=>{"type"=>"none", "value"=>222909, "metadata"=>{}}
}
此外,我有 3 个订阅此实体,它们在条件表达式中具有相同的坐标:
- Should trigger when the entity is located, at least 100 meters far away from the reference point.
{
"id"=>"...",
"expires"=>"...",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"User-121", "idPattern"=>"", "type"=>"User"}],
"condition"=>{
"attributes"=>["location", "time"],
"expression"=>{
"q"=>"",
"geometry"=>"point",
"coords"=>"59.851484, 30.199463",
"georel"=>"near;minDistance:100"}
}
},
"notification"=>{
"callback"=>"http://callback",
"attributes"=>["time"]
}
}
- Should trigger when the entity is located, at a maximum, 100 meters far away from the reference point
{
"id"=>"...",
"expires"=>"...",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"User-121", "idPattern"=>"", "type"=>"User"}],
"condition"=>{
"attributes"=>["location", "time"],
"expression"=>{
"q"=>"",
"geometry"=>"point",
"coords"=>"59.851484, 30.199463",
"georel"=>"near;maxDistance:100"}
}
},
"notification"=>{
"callback"=>"http://callback",
"attributes"=>["time"]
}
},
- Should trigger when the entity is located at the reference point (has the same coordinates)
{
"id"=>"...",
"expires"=>"...",
"status"=>"active",
"subject"=>{
"entities"=>[{"id"=>"User-121", "idPattern"=>"", "type"=>"User"}],
"condition"=>{
"attributes"=>["location", "time"],
"expression"=>{
"q"=>"",
"geometry"=>"point",
"coords"=>"59.851484, 30.199463",
"georel"=>"equals"}
}
},
"notification"=>{
"callback"=>"http://callback",
"attributes"=>["time"]
}
}
问题是每次我更新实体时,所有订阅都会发送通知。它甚至不依赖于实体的坐标值。无论坐标是什么,我总是收到 3 个更新通知。
我做错了什么?
Orion Context Broker 版本为 0.28.0(git 版本:5c1afdb3dd748580f10e1809f82462d83d2a17d4)
NGSIv2 订阅中的地理位置功能尚未实现(Orion 0.28.0)。请注意,NGSIv2 仍处于测试状态,有时 the specification(其中 geometry
、georel
和 coords
被定义为 expression
的一部分)是向前迈出的一步实施。
有关于此的 a github issue,您可以订阅以了解此功能何时实施。
编辑:NGSIv2 订阅中的地理位置功能将在 Orion 1.3.0 中可用(将于 8 月底或 9 月初发布)。如果您不想等待,请注意该功能在开发分支中也可用(以及关联的 Docker)。