Commit 1d489187 authored by Jason Fox's avatar Jason Fox
Browse files

Added in error

parent be36feb7
Loading
Loading
Loading
Loading
Loading
+0 −87
Original line number Diff line number Diff line
@@ -422,101 +422,14 @@ None.

#### 10.2.6.1 Description

This operation allows the modification of the value of an **already existing**
Attribute of an **existing** NGSI-LD Entity.

#### 10.2.6.2 Use case diagram

A [Context Producer]{.HTML-Keyboard} can set the value of an existing Attribute
within an NGSI-LD system as shown in Figure+++below.

<!-- prettier-ignore-start -->

::: FL
<img src="media/set-attribute-value-use-case.svg"/>
:::

::: TF
Figure: Set Attribute Value use case
:::

<!-- prettier-ignore-end -->

#### 10.2.6.3 Input data

- Entity ID (URI) of the concerned Entity, the target Entity.
- A selector of Entity types as specified by clause 7.2.2 (optional).
- Target Attribute to be modified, identified by a name.
- A JSON or JSON-LD document representing an NGSI-LD Attribute Fragment (see
  clause 5.4.2)
- An optional parameter indicating an _`observedAt`_ timestamp to use when
  setting the Attribute value.
- An optional parameter indicating a _`datasetId`_ to use when setting the
  Attribute value.

#### 10.2.6.4 Behaviour

- If the target Entity ID is not a valid URI or it is not present, then an error
  of type [BadRequestData]{.HTML-Error} shall be raised.
- If the target Attribute name is not valid or it is not present, then an error
  of type [BadRequestData]{.HTML-Error} shall be raised.
- If the target Attribute is _`scope`_, then an error of type
  [BadRequestData]{.HTML-Error} shall be raised.
- If the request payload body is not a valid JSON document or the payload body
  contains [null]{.HTML-Code} or ["urn:ngsi-ld:null"]{.HTML-Code}, then an error
  of type [InvalidRequest]{.HTML-Error} shall be raised.
- If the NGSI-LD endpoint does not know about the target Entity, because there
  is no existing Entity whose id (URI), and where specified type, is equivalent
  held locally, and no matching registrations apply (see clause 9.4), then an
  error of type [ResourceNotFound ]{.HTML-Error} shall be raised.
- If an **exclusive** or **redirect** [Context Source
  Registration]{.HTML-Keyboard} matches against the input data, the payload body
  is forwarded for remote processing. For each matching registration:

  - If the Set Attribute Value operation is supported by the registration (see
    clause 9), matching input data is forwarded to the Registration endpoint.
  - If the Aet Attribute Value operation is not supported by the registration,
    this shall result in an error of type [Conflict]{.HTML-Error} in case the
    complete set Attribute value failed, or in a partial success if some parts
    of the set Attribute value succeeded.

    No further processing is required.

- For any **inclusive** [Context Source Registrations]{.HTML-Keyboard} that
  match against the input data, that input data is also forwarded for remote
  processing to matching endpoints in case the set Attribute value operation is
  supported.
- Apply term expansion as mandated by clause 8.2.4, so that the fully qualified
  name (URI) associated to the target Attribute is properly obtained.
- If the target Entity does not contain the target Attribute:

  - as a default instance in case no _`datasetId`_ is present;
  - as an instance with the specified _`datasetId`_ if present;

  then an error of type [ResourceNotFound]{.HTML-Error}

- Replace the existing Attribute value instance with the value from the
  Attribute Fragment provided.

  - If the Attribute value to be replaced is represented in the **value only**
    representation, the _`type`_ of any pre-existing Attribute in the target
    entity shall be preserved.
  - If a user _`@context`_ has been supplied, the Attribute Fragment shall
    undergo expansion prior to replacement (see clause 8.2.4)
  - If the Attribute whose value is to be set previously contained an
    _`observedAt`_ sub-Attribute and the value to be replaced is represented in
    the **value only** representation:

    - if an _`observedAt`_ timestamp is defined, then the _`observedAt`_
      sub-Attribute is updated using the timestamp supplied.
    - if no _`observedAt`_ timestamp is defined, then the _`observedAt`_
      sub-Attribute is updated using the timestamp of the [Context
      Broker]{.HTML-Keyboard}

#### 10.2.6.5 Output data

None.

### 10.2.7 Delete Attribute

#### 10.2.7.1 Description