title: GE Orion Context Broker: when we make an update of the entity, does not allow us to update the attribute of type "coords"
body: <p>Regards,</p>
  
  <p>Our problem is ‘a priori’ related to the GE implementation Orion Context Broker. Our version Orion Context Broker: 0.14.0.</p>
  
  <p>We have a Web Service which we have implemented, sending data collected by a number of dispositives, to a machine that we have deployed in our account Fi-ware Platform. The problem that has been presented to us is that one of the attributes we are setting is a type attribute “coords” and when we are trying to make an update of the entity, does not allow us to update that attribute, and gives the following error (see below, a part of the response). We also want to update this field.</p>
  
  <pre><code>      &lt;/contextAttribute&gt;
        &lt;contextAttribute&gt;
          &lt;name&gt;android_version&lt;/name&gt;
          &lt;type /&gt;
          &lt;contextValue /&gt;
        &lt;/contextAttribute&gt;
        &lt;contextAttribute&gt;
          &lt;name&gt;date&lt;/name&gt;
          &lt;type /&gt;
          &lt;contextValue /&gt;
        &lt;/contextAttribute&gt;
        &lt;contextAttribute&gt;
          &lt;name&gt;position&lt;/name&gt;
          &lt;type&gt;coords&lt;/type&gt;
          &lt;contextValue /&gt;
            &lt;metada&gt;
              &lt;contextMetadata&gt;
              &lt;name&gt;location&lt;/name&gt;
              &lt;type&gt;string&lt;/type&gt;
              &lt;value&gt;WSG84&lt;/value&gt;
            &lt;/contextMetadata&gt;
          &lt;/metada&gt;
        &lt;/contextAttribute&gt;
      &lt;/contextAttributeList&gt;
    &lt;/contextElement&gt;
    &lt;statusCode&gt;
      &lt;code&gt;472&lt;/code&gt;
      &lt;reasonPhrase&gt;request parameter is invalid/not allowed&lt;/reasonPhrase&gt;
      &lt;details&gt;action:UPDATE - entity: (300000000000008, dispositivo) - offending attribute: position - location attribute has to be defined at creation time, with APPEND&lt;/details&gt;
    &lt;/statusCode&gt;
  &lt;/contextElementResponse&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>The REST request that we are setting to the ContextBroker and which is giving us problems is:</p>
  
  <pre><code>public static String payloadUpdateTemplate = 
                      @"&lt;updateContextRequest&gt;
                       &lt;contextElementList&gt;
                         &lt;contextElement&gt;
                           &lt;entityId type='dispositivo' isPattern='false'&gt;
                             &lt;id&gt;{0}&lt;/id&gt;
                           &lt;/entityId&gt;
                           &lt;contextAttributeList&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;temperature&lt;/name&gt;
                               &lt;type&gt;Cº&lt;/type&gt;
                               &lt;contextValue&gt;{1}&lt;/contextValue&gt;
                             &lt;/contextAttribute&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;latitude&lt;/name&gt;
                               &lt;type&gt;φ&lt;/type&gt;
                               &lt;contextValue&gt;{2}&lt;/contextValue&gt;
                             &lt;/contextAttribute&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;longitude&lt;/name&gt;
                               &lt;type&gt;λ&lt;/type&gt;
                               &lt;contextValue&gt;{3}&lt;/contextValue&gt;
                             &lt;/contextAttribute&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;altitude&lt;/name&gt;
                               &lt;type&gt;m&lt;/type&gt;
                               &lt;contextValue&gt;{4}&lt;/contextValue&gt;
                             &lt;/contextAttribute&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;acceleration&lt;/name&gt;
                               &lt;type&gt;m/s²&lt;/type&gt;
                               &lt;contextValue&gt;{5}&lt;/contextValue&gt;
                             &lt;/contextAttribute&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;android_version&lt;/name&gt;
                               &lt;type&gt;&lt;/type&gt;
                               &lt;contextValue&gt;{6}&lt;/contextValue&gt;
                             &lt;/contextAttribute&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;date&lt;/name&gt;
                               &lt;type&gt;&lt;/type&gt;
                               &lt;contextValue&gt;{7}&lt;/contextValue&gt;
                             &lt;/contextAttribute&gt;
                             &lt;contextAttribute&gt;
                               &lt;name&gt;position&lt;/name&gt;
                               &lt;type&gt;coords&lt;/type&gt;
                               &lt;contextValue&gt;{2}, {3}&lt;/contextValue&gt;
                               &lt;metadata&gt;
                                 &lt;contextMetadata&gt;
                                   &lt;name&gt;location&lt;/name&gt;
                                   &lt;type&gt;string&lt;/type&gt;
                                   &lt;value&gt;WSG84&lt;/value&gt;
                                 &lt;/contextMetadata&gt;
                               &lt;/metadata&gt;
                             &lt;/contextAttribute&gt;
                           &lt;/contextAttributeList&gt;
                         &lt;/contextElement&gt;
                       &lt;/contextElementList&gt;
                       &lt;updateAction&gt;UPDATE&lt;/updateAction&gt;
                     &lt;/updateContextRequest&gt;";
  </code></pre>
  
  <p>Yes, we have previously created the entity that we are trying to update, using updateContext operation with APPEND action type. The payload that we are using to do entity creation is:</p>
  
  <pre><code>public static String payloadInsertTemplate = 
                      @"&lt;updateContextRequest&gt;
                          &lt;contextElementList&gt;
                            &lt;contextElement&gt;
                              &lt;entityId type='dispositivo' isPattern='false'&gt;
                                &lt;id&gt;{0}&lt;/id&gt;
                              &lt;/entityId&gt;
                              &lt;contextAttributeList&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;temperature&lt;/name&gt;
                                  &lt;type&gt;Cº&lt;/type&gt;
                                  &lt;contextValue&gt;{1}&lt;/contextValue&gt;
                                &lt;/contextAttribute&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;latitude&lt;/name&gt;
                                  &lt;type&gt;φ&lt;/type&gt;
                                  &lt;contextValue&gt;{2}&lt;/contextValue&gt;
                                &lt;/contextAttribute&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;longitude&lt;/name&gt;
                                  &lt;type&gt;λ&lt;/type&gt;
                                  &lt;contextValue&gt;{3}&lt;/contextValue&gt;
                                &lt;/contextAttribute&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;altitude&lt;/name&gt;
                                  &lt;type&gt;m&lt;/type&gt;
                                  &lt;contextValue&gt;{4}&lt;/contextValue&gt;
                                &lt;/contextAttribute&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;acceleration&lt;/name&gt;
                                  &lt;type&gt;m/s²&lt;/type&gt;
                                  &lt;contextValue&gt;{5}&lt;/contextValue&gt;
                                &lt;/contextAttribute&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;android_version&lt;/name&gt;
                                  &lt;type&gt;&lt;/type&gt;
                                  &lt;contextValue&gt;{6}&lt;/contextValue&gt;
                                &lt;/contextAttribute&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;date&lt;/name&gt;
                                  &lt;type&gt;&lt;/type&gt;
                                  &lt;contextValue&gt;{7}&lt;/contextValue&gt;
                                &lt;/contextAttribute&gt;
                                &lt;contextAttribute&gt;
                                  &lt;name&gt;position&lt;/name&gt;
                                  &lt;type&gt;coords&lt;/type&gt;
                                  &lt;contextValue&gt;{2}, {3}&lt;/contextValue&gt;
                                  &lt;metadata&gt;
                                    &lt;contextMetadata&gt;
                                      &lt;name&gt;location&lt;/name&gt;
                                      &lt;type&gt;string&lt;/type&gt;
                                      &lt;value&gt;WSG84&lt;/value&gt;
                                    &lt;/contextMetadata&gt;
                                  &lt;/metadata&gt;
                                &lt;/contextAttribute&gt;
                              &lt;/contextAttributeList&gt;
                            &lt;/contextElement&gt;
                          &lt;/contextElementList&gt;
                          &lt;updateAction&gt;APPEND&lt;/updateAction&gt;
                        &lt;/updateContextRequest&gt;";
  </code></pre>
  
  <p>We are using a REST Web Service. The literal {0} in the payload identifies each entity of the context. For example, if the ID of a dispositivo is 1111, the literal {0} will be 1111. In the other side, if the code of a sensor is 2222, the literal {0} will be 2222. The literal {0} is an identification key (unique and not null).</p>
  
  <p>More information,</p>
  
  <p>1) First of all, we insert a new entity with the following payload. The literal {0} is the ID of the entity, for example, id(entity) = 30000000000002. The literal {1} is the current value of the temperature of the entity Id, for example, temperature(entity) = 30,0.</p>
  
  <pre><code>  public static String payloadInsertTemplate = 
         @"&lt;updateContextRequest&gt;
             &lt;contextElementList&gt;
               &lt;contextElement&gt;
                 &lt;entityId type='dispositivo' isPattern='false'&gt;
                   &lt;id&gt;{0}&lt;/id&gt;
                 &lt;/entityId&gt;
                 &lt;contextAttributeList&gt;
                   &lt;contextAttribute&gt;
                     &lt;name&gt;temperature&lt;/name&gt;
                     &lt;type&gt;Cº&lt;/type&gt;
                     &lt;contextValue&gt;{1}&lt;/contextValue&gt;
                   &lt;/contextAttribute&gt;
                        .
                        .
                        .
                        .
                   &lt;contextAttribute&gt;
                     &lt;name&gt;position&lt;/name&gt;
                     &lt;type&gt;coords&lt;/type&gt;
                     &lt;contextValue&gt;{2}, {3}&lt;/contextValue&gt;
                     &lt;metadata&gt;
                       &lt;contextMetadata&gt;
                         &lt;name&gt;location&lt;/name&gt;
                         &lt;type&gt;string&lt;/type&gt;
                         &lt;value&gt;WSG84&lt;/value&gt;
                       &lt;/contextMetadata&gt;
                     &lt;/metadata&gt;
                   &lt;/contextAttribute&gt;
                 &lt;/contextAttributeList&gt;
               &lt;/contextElement&gt;
             &lt;/contextElementList&gt;
             &lt;updateAction&gt;APPEND&lt;/updateAction&gt;
           &lt;/updateContextRequest&gt;";
  </code></pre>
  
  <p>2) The result of the insertion operation is as follows.</p>
  
  <pre><code>  &lt;updateContextResponse&gt;
      &lt;contextResponseList&gt;
        &lt;contextElementResponse&gt;
          &lt;contextElement&gt;
            &lt;entityId type="dispositivo" isPattern="false"&gt;
              &lt;id&gt;30000000000002&lt;/id&gt;
            &lt;/entityId&gt;
            &lt;contextAttributeList&gt;
              &lt;contextAttribute&gt;
                &lt;name&gt;temperature&lt;/name&gt;
                &lt;type&gt;Cº&lt;/type&gt;
                &lt;contextValue /&gt;
              &lt;/contextAttribute&gt;
                  .
                  .
                  .
                  .
              &lt;contextAttribute&gt;
                &lt;name&gt;position&lt;/name&gt;
                &lt;type&gt;coords&lt;/type&gt;
                &lt;contextValue /&gt;
                &lt;metadata&gt;
                  &lt;contextMetadata&gt;
                    &lt;name&gt;location&lt;/name&gt;
                    &lt;type&gt;string&lt;/type&gt;
                    &lt;value&gt;WSG84&lt;/value&gt;
                  &lt;/contextMetadata&gt;
                &lt;/metadata&gt;
              &lt;/contextAttribute&gt;
            &lt;/contexAttributeList&gt;
          &lt;/contextElement&gt;
          &lt;statusCode&gt;
            &lt;code&gt;200&lt;/code&gt;
            &lt;reasonPhrase&gt;OK&lt;/reasonPhrase&gt;
          &lt;/statusCode&gt;
        &lt;/contextElementResponse&gt;
      &lt;/contextResponseList&gt;
    &lt;/updateContextResponse&gt;
  </code></pre>
  
  <p>3) We make the query and we can check the new values created with the payload.</p>
  
  <pre><code>  &lt;queryContextRequest&gt;
      &lt;entityIdList&gt;
        &lt;entityId type='dispositivo' isPattern='false'&gt;
          &lt;id&gt;{0}&lt;/id&gt;
        &lt;/entityId&gt;
      &lt;/entityIdList&gt;
      &lt;attributeList/&gt;
    &lt;/queryContextRequest&gt;
  </code></pre>
  
  <p>4) Then we are getting the value that we have introduced.</p>
  
  <pre><code> &lt;queryContextResponse&gt;
     &lt;contextResponseList&gt;
       &lt;contextElementResponse&gt;
         &lt;contextElement&gt;
           &lt;entityId type="dispositivo" isPattern="false"&gt;
             &lt;id&gt;30000000000002&lt;/id&gt;
           &lt;/entityId&gt;
           &lt;contextAttributeList&gt;
             &lt;contextAttribute&gt;
               &lt;name&gt;temperature&lt;/name&gt;
               &lt;type&gt;Cº&lt;/type&gt;
               &lt;contextValue&gt;30,0&lt;/contextValue&gt;
           &lt;/contextAttribute&gt;
               .
               .
               .
               .
           &lt;contextAttribute&gt;
             &lt;name&gt;position&lt;/name&gt;
             &lt;type&gt;coords&lt;/type&gt;
             &lt;contextValue&gt;36.723804, -4.417518&lt;/contextValue&gt;
             &lt;metadata&gt;
               &lt;contextMetadata&gt;
                 &lt;name&gt;location&lt;/name&gt;
                 &lt;type&gt;string&lt;/type&gt;
                 &lt;value&gt;WSG84&lt;/value&gt;
               &lt;/contextMetadata&gt;
             &lt;/metadata&gt;
           &lt;/contextAttribute&gt;
         &lt;/contextAttributeList&gt;
       &lt;/contextElement&gt;
       &lt;statusCode&gt;
         &lt;code&gt;200&lt;/code&gt;
         &lt;reasonPhrase&gt;OK&lt;/reasonPhrase&gt;
       &lt;/statusCode&gt;
     &lt;/contextElementResponse&gt;
   &lt;/contextResponseList&gt;
  </code></pre>
  
  <p></p>
  
  <p>5) Now we try to do the update of this data which we have introduced correctly (how you can check) and it gives the error.</p>