1

上下文:
我有一台带有 Orion Context Broker、Cygnus 和 Ckan 的机器。我有 3 个实体(传感器 1、传感器 2、传感器 3),我使用这三个实体的名称映射来写入名为传感器的单个 Ckan 数据存储。到目前为止一切正常。

我想要的:
这 3 个实体在 fiware-service默认值中,我希望它们写入 fiware-service paris(Ckan 中的巴黎组织)

问题: 如何使名称映射将这 3 个实体的默认fiware-service 更改为paris,而不为所有实体更改它?

我试过的: 我试过了,这段代码的问题是 fiware-service默认的所有实体都移动到了 fiware-service paris,而不仅仅是我的三个实体。

{
   "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": []
                  }
               ]
            }
         ]
      }
   ]
}
4

1 回答 1

0

查看Cygnus 文档中的示例,也许您可​​以尝试使用正则表达式模式:

最后但同样重要的是,原始名称支持基于 Java 的正则表达式。

例如:

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

我不完全确定它对你有用,但它可能会有所帮助......

于 2019-09-10T13:57:45.633 回答