天道酬勤,学无止境

FIWARE Orion: change entity type

In Orion, is it possible to change the type of an entity? Related question, it is possible to change the type of an attribute?

Edit: Changing the type of an entity doesn't seem to be possible. So creating a new entity seems to be a solution. But how to preserve dateCreated and dateModified?

标签

评论

In Orion, is it possible to change the type of an entity

Not directly. Entity id and entity type are immutable. However, you can create a copy of the entity with the new type, then delete the old entity. That will have effectively the same effect.

Related question, it is possible to change the type of an attribute?

Yes, it is. When you update an attribute, not only the value but also the type (and metadata) can be changed.

EDIT: dateModified and dateCreation attributes and metadata are designed to be managed by Context Broker automatically. Clients cannot modify them, they are "read-only". The idea is that a given context consumer client (which, in principle, is independent of the context producer client creating/updating the entity) has a trustable timestamp that nobody could alter.

So, you have basically two alternatives:

  1. Use your custom timestamp attributes and metadata. They can be "moved" to the new entity when you create it. However, CB will not maintain them automatically so your application would have to do it.

  2. Use an out-of-API process, moving the entity at DB level. However, this can be complicated, as you need direct access to DB.

EDIT2: for the second case (DB based process) take into account the Orion DB model. In particular:

  • _id.type is for the entity type
  • creDate is for the entity creation date
  • modDate is for the entity modification date
  • attrs.A.creDate is for the attribute A creation date
  • attrs.A.modDate is for the attribute A modification date

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • 我如何在 Orion 中指定 Fiware-Service 和 Fiware-ServicePath 字段以在 Cygnus 中设置 MySQL 数据库和表的名称?(How I specify the Fiware-Service and Fiware-ServicePath fields at Orion that set the name of MySQL database and table in Cygnus?)
    问题 到目前为止,我已经将 ContextBroker 配置为将数据发送到 Cygnus,后者又以默认名称将数据保存在数据库中。 但是如果我想使用特定表定位特定数据库怎么办? 我知道我必须设置: dbName=<fiware-service> tableName=<fiware-servicePath>_<entityId>_<entityType> 我不知道该文件在哪里,我知道它不在 /etc/sysconfig/contextBroker 中,因为该文件夹不存在。 EDIT1:这是我的更新上下文: (curl localhost:1026/NGSI10/updateContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Fiware-Service: FiwareDatabase' --header 'Fiware-ServicePath: /AllSensors' -d @- ) <<EOF { "contextElements": [ { "type": "Television", "isPattern": "false", "id": "TV2", "attributes": [ { "name": "channel",
  • Fiware Orion context broker subscriptions condition does not work
    I am using Orion Context Broker version 1.1.0 I had the only entity in my DB: { "id"=>"Room1", "type"=>"Room", "temperature"=>{"type"=>"none", "value"=>10, "metadata"=>{}} } I did not have any subscription. Then I created 3 subscriptions: [ { "subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}], "condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature>10"}}} }, { "subject"=>{"entities"=>[{"id"=>"Room1", "idPattern"=>"", "type"=>""}], "condition"=>{"attrs"=>["temperature"], "expression"=>{"q"=>"temperature<10"}}} }, { "subject"=>{"entities"=>[{"id"=>"Room1",
  • Subscription to CB working but not visible
    I have an entity represented on the Context Broker with severall attributes (such as temperature, humidity etc...). I have a MySql database that persists the values from that entity by row. So in order to persist that info i have to make a subscription from cygnus. The problem here is that the information is being presisted but when i run the command (curl http://localhost:1026/v2/subscription) i get the output: [] as if any subscription was being made. If i do the command echo 'db.csubs.count()' | mongo orion --quiet it even shows the output 0. Running OS: Centos 6 My Orion Context Broker
  • 发布后订阅状态更改(Subscription status change after post)
    问题 成功安装 Cygnus 连接器并测试订阅的创建后。 使用波纹管文件: agent_1.conf cygnus-ngsi.sources = http-source cygnus-ngsi.sinks = hdfs-sink cygnus-ngsi.channels = hdfs-channel cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource cygnus-ngsi.sources.http-source.channels = hdfs-channel cygnus-ngsi.sources.http-source.port = 5050 cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler cygnus-ngsi.sources.http-source.handler.notification_target = /notify cygnus-ngsi.sources.http-source.handler.default_service = [ PERSONALIZED SERVICE NAME ] cygnus-ngsi.sources
  • Orion CB 不会更新 IoT 代理上的惰性属性(Orion CB doesn't update lazy attributes on IoT Agent)
    问题 我正在尝试使用 Orion CB 作为 IoT 代理的 Contex 提供程序,其中我仅注册了具有惰性属性的设备。 在 IoT 代理上,我需要处理 updateContext 请求,因此我为这些请求做了一个处理程序,如下所示: iotAgentLib.setDataUpdateHandler(updateContextHandler); 在 updateContextHandler 函数中,我只有一条指令: console.log(attributes); 为了查看我要更新的所有值是否已正确接收。 现在,如果我对设备表示的实体的属性之一进行更新: curl -i -X POST \ -H "fiware-service:service1" \ -H "fiware-servicepath:/subservice1" \ -H "X-Auth-Token:wNRwDwqYlLoLD8U9sFkTAEE6PfYMbQ" \ -H "Content-Type:application/json" \ -d \ '{ "contextElements": [ { "id": "ncc_estimate", "attributes": [ { "name": "arrival", "type": "string", "value": "some_value" } ] } ],
  • Subscription status change after post
    After successfully installed Cygnus connector and testing the creation of subscriptions. With bellow files: agent_1.conf cygnus-ngsi.sources = http-source cygnus-ngsi.sinks = hdfs-sink cygnus-ngsi.channels = hdfs-channel cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource cygnus-ngsi.sources.http-source.channels = hdfs-channel cygnus-ngsi.sources.http-source.port = 5050 cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler cygnus-ngsi.sources.http-source.handler.notification_target = /notify cygnus-ngsi.sources.http-source
  • Orion Context Broker Fiware 中的订阅(Subscription in Orion Context Broker Fiware)
    问题 我尝试向我的 Orion Context Broker 实例发送订阅。 我正在发送这个 JSON: { "duration": "P1M", "reference": "http://130.206.127.23:1026/ngsi10/notifyContext", "notifyConditions": [ { "condValues": [ "PT10s" ], "type": "ONTIMEINTERVAL" } ], "entities": [ { "id": "1.0", "type": "Capsule", "isPattern": "false" } ], "attributes": [ "temperature" ] } 我收到下一条消息: <subscribeContextResponse> <subscribeError> <errorCode> <code>400</code> <reasonPhrase>Bad Request</reasonPhrase> <details>JSON Parse Error: <unspecified file>(1): invalid escape sequence</details> </errorCode> </subscribeError> </subscribeContextResponse>
  • FIWARE Orion:如何检索实体的 servicePath?(FIWARE Orion: How to retrieve the servicePath of an entity?)
    问题 如何检索给定 ID 的实体的 servicePath? 我也有一些关于服务路径的设计问题: 为什么它被实现为 HTTP 标头? 如果它是一个属性会更简单。 用法似乎被破坏了:例如,我可以使用默认服务路径获取实体,但是我无法删除它,因为它可能属于不同的服务路径。 API 不可探索:我可以发现一个实体,但随后我无法对其进行任何操作,因为我不知道它的服务路径。 总而言之,建议完全使用服务路径? 谢谢 回答1 我认为这是不可能的,正如您在本演示文稿的Multitenancy部分中看到的那样。 此外,您可以为不同的Fiware-Services和Fiware-ServicePaths使用相同的Entity ID 。 Attributes灵活。 当您需要分离事物(如 OpenStack 的Projects和Domains )时, Fiware-Service和Fiware-ServicePath是必需的。 如果您使用Fiware-Service和Fiware-ServicePath创建实体, Fiware-Service需要在执行GET和DELETE操作时指定这些标头。 如果您得到与此不同的东西,我想您可能正在做一些奇怪的事情或遗漏了什么。 假设当您使用Fiware-Service和Fiware-ServicePath您的应用程序已经知道这些信息。 因此,您不必发现它。
  • Fiware Orion Context Broker 支持的原始类型?(Primitive types supported by Fiware Orion Context Broker?)
    问题 我一直在尝试在 FIWARE 的官方文档中找到 Orion 支持的上下文实体属性的原始类型。 这是我在 NGSI 文档中找到的唯一一条信息: 属性类型表示属性值的NGSI 值类型。 请注意,FIWARE NGSI 有自己的属性值类型系统,因此 NGSI 值类型与 JSON 类型不同。 我尝试使用“整数”、“浮点数”、“文本”等类型创建上下文实体,一切正常。 但我不知道 Orion 是否关心属性类型? 我会很感激 FIWARE Cepheus CEP 文档中的一些这样的列表。 非常感谢您提前 回答1 属性类型(连同元数据类型)总是使用 JSON 字符串作为原始类型。 Orion 以不透明的方式解释它们(即不注意类型字符串),除了 NGSIv2 规范中“特殊属性类型”中描述的情况,目前是: DateTime geo:point geo:line geo:box geo:polygon geo:json 请查看参考文档以了解它们的含义。 回答2 正如本主题中所述,该类型具有丰富的信息。 您可以使用任何 JSON 数据类型:数字、字符串、布尔值、数组或对象来表示您的值。
  • 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: 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"=>{
  • Primitive types supported by Fiware Orion Context Broker?
    I have been trying for some time to find in the official documentation of FIWARE which are the primitive types supported by Orion for the attributes of a context entity. This is the only piece of information that I found about that in NGSI docs: The attribute type represents the NGSI value type of the attribute value. Note that FIWARE NGSI has its own type system for attribute values, so NGSI value types are not the same as JSON types. I tried to create context entities using types like "integer", "float", "text" and everything works apparently fine. But I dont know if Orion take care about
  • 条件下具有 georel 表达式的固件 orion 订阅(Fiware orion subscription with georel expression in condition)
    问题 我的猎户座数据库中有一个实体: { "id"=>"User-121", "type"=>"User", "location"=>{ "type"=>"geo:point", "value"=>"59.851484, 30.199463" }, "time"=>{"type"=>"none", "value"=>222909, "metadata"=>{}} } 此外,我对该实体有 3 个订阅,它们在条件表达式中具有相同的坐标: 应在实体定位时触发,距离参考点至少 100 米。 { "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",
  • ECONNRESET 在短时间内打开大量连接时(ECONNRESET when opening a large number of connection in small time period)
    问题 我有一种情况,我想在 orion 上创建大量实体。 我正在使用这个 docker-compose 的 docker 版本的 Orion 和 mongo。 version: "3" services: mongo: image: mongo:3.4 volumes: - /data/docker-mongo/db:/data/db - /data/docker-mongo/log/mongodb.log:/var/log/mongodb/mongod.log command: --nojournal orion: image: fiware/orion volumes: - /data/docker-mongo/log/contextBroker.log:/tmp/contextBroker.log links: - mongo ports: - "1026:1026" command: -dbhost mongo 现在,当我想上传 2000 个实体时会出现问题(为每个实体打开新连接,我知道可以做不同的事情,但现在这是请求),我成功创建了不超过 600 个(或更少,永远不准确的数量)其余失败创建错误: "error": { "errno": "ECONNRESET", "code": "ECONNRESET", "syscall": "read" }, 所以我认为这个问题与
  • Orion CB doesn't update lazy attributes on IoT Agent
    I'm trying to use Orion CB as Contex Provider for an IoT Agent in which I have registred a device with lazy attributes only. On the IoT Agent I need to handle updateContext requests so I did a handler for these requests like this: iotAgentLib.setDataUpdateHandler(updateContextHandler); And in the updateContextHandler function I have only one instruction: console.log(attributes); In order to see if all the values I want to update have been received correctly. Now if I do an update on one of the attributes of the entity represented by the device: curl -i -X POST \ -H "fiware-service:service1" \
  • ECONNRESET when opening a large number of connection in small time period
    I have situation where I want to create large number of entities on orion. I am using docker version of Orion and mongo with this docker-compose. version: "3" services: mongo: image: mongo:3.4 volumes: - /data/docker-mongo/db:/data/db - /data/docker-mongo/log/mongodb.log:/var/log/mongodb/mongod.log command: --nojournal orion: image: fiware/orion volumes: - /data/docker-mongo/log/contextBroker.log:/tmp/contextBroker.log links: - mongo ports: - "1026:1026" command: -dbhost mongo Now problems happens when I want to upload 2000 entities (opening new connection for each, I know it can be done
  • 固件错误:Access-Control-Allow-Origin(Fiware error: Access-Control-Allow-Origin)
    问题 我正在调用 contextBroker,它给了我这个错误。 Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 405. 从邮递员或干舷我没有得到任何这些。 getContextBroker(){ console.log("Consumimos el servicio getContextBroker"); let headers = new Headers ({'Accept': 'application/json', 'Fiware-Service': 'x', 'Fiware-ServicePath': '/x', 'Access-Control-Allow-Origin': '*'}); let options = new RequestOptions ({headers : headers}); return this._http.get
  • Subscription in Orion Context Broker Fiware
    I try to send a subscription to my Orion Context Broker instance. I'm sending this JSON: { "duration": "P1M", "reference": "http://130.206.127.23:1026/ngsi10/notifyContext", "notifyConditions": [ { "condValues": [ "PT10s" ], "type": "ONTIMEINTERVAL" } ], "entities": [ { "id": "1.0", "type": "Capsule", "isPattern": "false" } ], "attributes": [ "temperature" ] } And I receive the next message: <subscribeContextResponse> <subscribeError> <errorCode> <code>400</code> <reasonPhrase>Bad Request</reasonPhrase> <details>JSON Parse Error: <unspecified file>(1): invalid escape sequence</details> <
  • Fiware - 如何将 PEP 代理连接到 Orion 并使用 HTTPS 进行配置?(Fiware - how to connect PEP proxy to Orion and configure both with HTTPS?)
    问题 我正在与 Orion 合作,我尝试使用 PEP 代理和 Keyrock 来保护未来的应用程序,但我找不到将这 3 个 GE 结合起来的方法。 我所有的基本文件都在这个存储库中,虽然我运行了 Orion、Keyrock 和 Cygnus,但我无法使用 PEP 代理发送请求。 这是我的 docker-compose.yml 文件: version: "2" networks: fiware: driver: bridge services: # Base de datos Orion mongodb: image: mongo:3.4.7 hostname: mongodb container_name: mongodb expose: - "27017" ports: - "27018:27017" command: --smallfiles networks: - fiware # GE encargado de la publicación y suscripción orion: image: fiware/orion:latest hostname: orion container_name: orion links: - mongodb expose: - "1026" ports: - "1026:1026" volumes: - "./data/db/mongo
  • Fiware Cygnus:CKAN 中没有持久化数据(Fiware Cygnus: no data have been persisted in CKAN)
    问题 我正在尝试将 cygnus 与 CKAN 一起使用,但是当属性为 JSON 类型时,CKAN 中没有保留任何数据。 首先,我向 Orion 发送信息: Accept: application/json X-AUTH-TOKEN: <mytoken> Fiware-Service: PapelClubDemo Fiware-ServicePath: /events/leonliterario { "contextElements": [ { "type": "Events", "isPattern": "false", "id": "thisweek", "attributes": [ { "name": "schedule", "type": "json", "value": [{"title": "Presentación Viva Mi Gente","date": "2015-11-30","location": "Salón de actos del ICAL","url": "http://www.papel.club"}] } ] } ], "updateAction": "APPEND" } 我在 Cygnus 中有此实体的订阅,这是我在 Cygnus 日志中收到的信息: 01 Dec 2015 19:05:13,701 INFO [891993589@qtp
  • Fiware - 如何集成 Keyrock IdM、Wilma PEP 代理和 Orion Context Broker?(Fiware - How to integrate Keyrock IdM, Wilma PEP Proxy and Orion Context Broker?)
    问题 我阅读了 Keyrock 和 Wilma 的所有文档,并观看了 FIWARE Academy 中的所有视频,但我仍然没有在这种集成中取得成功。 几天前我一直在寻找这个,但没有成功。 我认为 FIWARE 文档可以有教程,动手... 我有一个带有 Orion Context Broker 的虚拟机和一个带有 Keyrock IdM 和 Wilma PEP 代理的容器。 我正在尝试生成访问令牌以授予应用程序访问权限,但我仍然没有得到它。 此外,我想知道如何在 Orion Context Broker 和一些 IoT 设备之间安全地交换消息。 事实上,考虑到物联网设备必须访问屏幕并像 Keyrock IdM 示例所示那样将其凭据进行身份验证和授权,这很复杂。 你有什么建议? 回答1 在这里看到@albertinisg 的回答,我找到了一个用于令牌请求的 bash 脚本。 我将它更改为与我的本地实例一起使用并且它起作用了。 在 FIWARE Portal 注册我的应用程序后(更多信息在这里),我必须向 http://idm:8000/oauth2/token(idm 是我本地的 Keyrock 实例)发出 POST 请求。 使用此有效令牌,我可以访问 Orion 中的内容。 import requests, json, getpass TOKEN_URL = "http://idm