简体   繁体   中英

Fiware orion subscription with georel expression in condition

I have an entity in my orion DB:

{
  "id"=>"User-121",
  "type"=>"User",
  "location"=>{
    "type"=>"geo:point", 
    "value"=>"59.851484, 30.199463"
  }, 
  "time"=>{"type"=>"none", "value"=>222909, "metadata"=>{}}
}

Also, I have 3 subscriptions to this entity, which have the same coordinates in condition's expression:

  1. 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"]
  }
}
  1. 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"]
  }
},
  1. 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"]
  }
}

The problem is that all of the subscriptions send notifications each time I update the entity. It doesn't even depend on the entity's coordinates values. Whatever the coordinates are, I always receive 3 notifications of any update.

What am I doing wrong ?

The Orion Context Broker version is 0.28.0 (git version: 5c1afdb3dd748580f10e1809f82462d83d2a17d4)

Geo-location features in NGSIv2 subscriptions have not been yet implemented (at Orion 0.28.0). Note that NGSIv2 is yet in beta status and sometimes the specification (where the geometry , georel and coords are defined as part of expression ) is a step forward the implementation.

There is a github issue about this, to which you can subscribe in order to know when this feature gets implemented.

EDIT : geo-location features in NGSIv2 subscriptions will be available in Orion 1.3.0 (to be released by the end of August or begining of September). If you don't want to wait, note the functionality is also available in the develop branch (and associated Docker).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM