telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md
GNU Affero General Public License v3.0
211 stars 265 forks source link

JEXL. Add: Calculated attributes #4580

Open mapedraza opened 3 months ago

mapedraza commented 3 months ago

Is your feature request related to a problem / use case? Please describe. Have calculated attributes using JEXL, having as value the expression evaluation result.

Describe the solution you'd like

When an attribute type is Calculated the value returned when queriying (and also, when notifiying) should be the expression result.

Provision

{
  "id": "Room2",
  "type": "Room",
  "temperature": {
    "value": 21,
    "type": "Float"
  },
  "kelvin": {
    "value": "${temperature+273}",
    "type": "Calculated"
  }
}

Describe alternatives you've considered https://github.com/telefonicaid/fiware-orion/issues/4579

Describe why you need this feature

Additional information

fgalan commented 3 months ago

Probably, a new URL param should be included to request entities without rendering calculated values (to check if the expression works or not). Another alternative is to change the type.

E.g.

GET /v2/entities?options=plain
mapedraza commented 3 months ago

Probably related https://github.com/telefonicaid/fiware-orion/issues/3815

mapedraza commented 3 months ago

Noted by @mrutid : Those attributes need to be manually provisioned one by one in each entity (since data provider is not going to create those attributes). No existing clases or patterns that apply to all the entities, like the case of subscriptions, that is a group provision.