user10088263
user10088263

Reputation:

Fiware Cygnus - Change service for only some entities with name mappings?

Context :
I have a machine with Orion Context Broker, Cygnus and Ckan. I have 3 entities (sensor1, sensor2, sensor3) and I use name mappings for these three entities to write in a single Ckan datastore named sensors. So far everything works.

What I want :
These 3 entities are in the fiware-service default and I want them to write in the fiware-service paris (the paris organization in Ckan)

Question : How to make the name mapping change the default fiware-service of these 3 entities into paris, without changing it for all entities?

What I tried : I tried this, the problem with this code is that all entities of the fiware-service default are moved to the fiware-service paris, not just my trhee entities.

{
   "serviceMappings": [
      {
         "originalService": "default",
         "newService": "paris",
         "servicePathMappings": [
            {
               "originalServicePath": "/",
               "entityMappings": [
                  {
                     "originalEntityId": "sensor1",
                     "originalEntityType": "device",
                     "newEntityId": "sensors",
                     "attributeMappings": []
                  },
                  {
                     "originalEntityId": "sensor2",
                     "originalEntityType": "device",
                     "newEntityId": "sensors",
                     "attributeMappings": []
                  },
                  {
                     "originalEntityId": "sensor3",
                     "originalEntityType": "device",
                     "newEntityId": "sensors",
                     "attributeMappings": []
                  }
               ]
            }
         ]
      }
   ]
}

Upvotes: 1

Views: 110

Answers (1)

fgalan
fgalan

Reputation: 12322

Looking to the examples in the Cygnus documentation maybe you could try with a regular expression pattern:

Last but not least, the original names support Java-based regular expressions.

For instance:

{
   "serviceMappings": [
      {
         "originalService": "default",
         "newService": "paris",
         "servicePathMappings": [
            {
               "originalServicePath": "/",
               "entityMappings": [
                  {
                     "originalEntityId": "sensor[1-3]",
                     "originalEntityType": "device",
                     "newEntityId": "sensors",
                     "attributeMappings": []
                  }
               ]
            }
         ]
      }
   ]
}

I'm not fully sure it works for you but it may help...

Upvotes: 0

Related Questions