Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-8790

[fiware-stackoverflow] NGSI update attributes from complex entities in Wirecloud

    Details

      Description

      Created question in FIWARE Q/A platform on 25-01-2017 at 02:01
      Please, ANSWER this question AT https://stackoverflow.com/questions/41841914/ngsi-update-attributes-from-complex-entities-in-wirecloud

      Question:
      NGSI update attributes from complex entities in Wirecloud

      Description:
      Is it possible to update a child attribute through the updateAttributes() function from Wirecloud NGSI API?

      For example, a coordinate (entity.location.coords.coordinates[0]=-2.000000) in this piece of entity.

      "attrNames": [ "A1", "A2", "position" ],
      "creDate": 1389376081,
      "modDate": 1389376244,
      "location": {
      "attrName": "position",
      "coords":

      { "type": "Point", "coordinates": [ -3.691944, 40.418889 ] }

      EDITED

      My own answer: It is possible by passing an object as value of the attribute.

      ngsi.updateAttributes([
      {
      'entity':

      {'id': "entity-id"}

      ,
      'attributes':[{
      "name":"location","contextValue": {
      "attrName": "position",
      "coords":

      { "type": "Point", "coordinates": [ -2.000000, 40.418889 ] }

      }
      }]
      }
      ],

      { onSuccess: onUpdateAttributesSuccess, onFailure: onUpdateAttributesFail }

      );

      However, Wirecloud is using NGSI API v1, therefore all attributes are treated as strings when they are sent/received to/from Orion.

      More info: http://fiware-orion.readthedocs.io/en/master/user/structured_attribute_valued/

        Activity

        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        jicg José Ignacio Carretero Guarde made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        fla Fernando Lopez made changes -
        HD-Enabler Wirecloud [ 10857 ]
        Description
        Created question in FIWARE Q/A platform on 25-01-2017 at 02:01
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/41841914/ngsi-update-attributes-from-complex-entities-in-wirecloud


        +Question:+
        NGSI update attributes from complex entities in Wirecloud

        +Description:+
        Is it possible to update a child attribute through the updateAttributes() function from Wirecloud NGSI API?

        For example, a coordinate (entity.location.coords.coordinates[0]=-2.000000) in this piece of entity.

           "attrNames": [ "A1", "A2", "position" ],
           "creDate": 1389376081,
           "modDate": 1389376244,
           "location": {
               "attrName": "position",
               "coords": {
                   "type": "Point",
                   "coordinates": [ -3.691944, 40.418889 ]
               }




        EDITED

        My own answer: It is possible by passing an object as value of the attribute.

        ngsi.updateAttributes([
                            {
                                'entity': {'id': "entity-id"},
                                'attributes':[{
                                  "name":"location","contextValue": {
                                       "attrName": "position",
                                       "coords": {
                                             "type": "Point",
                                             "coordinates": [ -2.000000, 40.418889 ]
                                       }
                                  }
                                }]
                            }
                        ], {
                            onSuccess: onUpdateAttributesSuccess,
                            onFailure: onUpdateAttributesFail
                        }
                    );


        However, Wirecloud is using NGSI API v1, therefore all attributes are treated as strings when they are sent/received to/from Orion.

        More info: http://fiware-orion.readthedocs.io/en/master/user/structured_attribute_valued/
        Created question in FIWARE Q/A platform on 25-01-2017 at 02:01
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/41841914/ngsi-update-attributes-from-complex-entities-in-wirecloud


        +Question:+
        NGSI update attributes from complex entities in Wirecloud

        +Description:+
        Is it possible to update a child attribute through the updateAttributes() function from Wirecloud NGSI API?

        For example, a coordinate (entity.location.coords.coordinates[0]=-2.000000) in this piece of entity.

           "attrNames": [ "A1", "A2", "position" ],
           "creDate": 1389376081,
           "modDate": 1389376244,
           "location": {
               "attrName": "position",
               "coords": {
                   "type": "Point",
                   "coordinates": [ -3.691944, 40.418889 ]
               }




        EDITED

        My own answer: It is possible by passing an object as value of the attribute.

        ngsi.updateAttributes([
                            {
                                'entity': {'id': "entity-id"},
                                'attributes':[{
                                  "name":"location","contextValue": {
                                       "attrName": "position",
                                       "coords": {
                                             "type": "Point",
                                             "coordinates": [ -2.000000, 40.418889 ]
                                       }
                                  }
                                }]
                            }
                        ], {
                            onSuccess: onUpdateAttributesSuccess,
                            onFailure: onUpdateAttributesFail
                        }
                    );


        However, Wirecloud is using NGSI API v1, therefore all attributes are treated as strings when they are sent/received to/from Orion.

        More info: http://fiware-orion.readthedocs.io/en/master/user/structured_attribute_valued/
        HD-Chapter Apps [ 10836 ]
        fla Fernando Lopez made changes -
        Assignee Álvaro Arranz [ aarranz ]
        backlogmanager Backlog Manager made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            aarranz Álvaro Arranz
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: