Commit ea4be6c2 authored by Jason Fox's avatar Jason Fox
Browse files

Explicitly name Fragment types.

parent 1d374c20
Loading
Loading
Loading
Loading
Loading
+51 −50
Original line number Diff line number Diff line
@@ -65,12 +65,13 @@ Implementations shall exhibit the following behaviour:
    the complete Create Entity operation failed or in a partial success if some
    parts of it succeeded.

    The matching Attributes are then removed from the Fragment and not processed
    further.
    The matching Attributes are then removed from the Entity Fragment and not
    processed further.

- If any **redirect** [Context Source Registrations]{.HTML-Keyboard} exist that
  match against the input data, that input data is forwarded for remote
  processing by one or more matching endpoints:

  - For matching Registrations where the Create Entity operation is supported,
    matching input data is forwarded. If any such endpoint then raises an error,
    this shall result in an error in case the complete create has failed or in a
@@ -80,8 +81,8 @@ Implementations shall exhibit the following behaviour:
    if the complete Create Entity operation failed or in a partial success if
    some parts of it succeeded.

- The matching Attributes are then removed from the Fragment and not processed
  further.
- The matching Attributes are then removed from the Entity Fragment and not
  processed further.

- For any **inclusive** [Context Source Registrations]{.HTML-Keyboard} that
  match against the remaining input data, that input data is also forwarded for
@@ -150,8 +151,8 @@ Figure: Update Attributes use case
    complete update failed or in a partial success if some parts of the update
    succeeded.

- The matching Attributes are then removed from the Fragment and not processed
  further.
- The matching Attributes are then removed from the Entity Fragment and not
  processed further.
- If there are remaining Attributes, for any **inclusive** [Context Source
  Registrations]{.HTML-Keyboard} that match against the remaining input data,
  that input data is also forwarded for remote processing to matching endpoints
@@ -186,12 +187,12 @@ Figure: Update Attributes use case
      - Otherwise the default Attribute instance shall be appended to the target
        Entity.

- If _`type`_ is included in the Fragment and it includes Entity Type names that
  are not yet in the target Entity, add them to the list of Entity Type names of
  the target Entity.
- If _`scope`_ is included in the Fragment and the target entity includes
  _`scope`_, replace the scope by the one included in the Fragment, otherwise
  ignore it.
- If _`type`_ is included in the Entity Fragment and it includes Entity Type
  names that are not yet in the target Entity, add them to the list of Entity
  Type names of the target Entity.
- If _`scope`_ is included in the Entity Fragment and the target entity includes
  _`scope`_, replace the scope by the one included in the Entity Fragment,
  otherwise ignore it.

#### 10.2.3.5 Output data

@@ -255,8 +256,8 @@ The following behaviour shall be exhibited by compliant implementations:
    complete append failed or in a partial success if some parts of the append
    succeeded.

- The matching Attributes are then removed from the Fragment and not processed
  further.
- The matching Attributes are then removed from the Entity Fragment and not
  processed further.
- For any **inclusive** [Context Source Registrations]{.HTML-Keyboard} that
  match against the remaining input data, that input data is also forwarded for
  remote processing to matching endpoints in case the Append Attributes
@@ -287,15 +288,15 @@ The following behaviour shall be exhibited by compliant implementations:
      - If overwrite is not allowed the existing default Attribute in the target
        Entity shall be left untouched.

  - If _`type`_ is included in the Fragment and it includes Entity Type names
    that are not yet in the target Entity, add them to the list of Entity Type
    names of the target Entity.
  - If _`scope`_ is included in the Fragment and overwrite is allowed, the scope
    of the target Entity will become the one included in the Fragment.
    Otherwise, the Scopes in the Fragment that are not part of the value of
    scope of the target Entity will be appended to the value of the _`scope`_ of
    the target Entity. If there is more than one Scope, the value of _`scope`_
    is represented as a JSON array containing all Scopes.
  - If _`type`_ is included in the Entity Fragment and it includes Entity Type
    names that are not yet in the target Entity, add them to the list of Entity
    Type names of the target Entity.
  - If _`scope`_ is included in the Entity Fragment and overwrite is allowed,
    the scope of the target Entity will become the one included in the Entity
    Fragment. Otherwise, the Scopes in the Entity Fragment that are not part of
    the value of scope of the target Entity will be appended to the value of the
    _`scope`_ of the target Entity. If there is more than one Scope, the value
    of _`scope`_ is represented as a JSON array containing all Scopes.

#### 10.2.4.5 Output data

@@ -382,9 +383,9 @@ Figure: Partial Attribute update use case
- then an error of type [ResourceNotFound]{.HTML-Error}

- Perform a partial update patch operation on the target Attribute following the
  algorithm mandated by clause 8.4.2 If present in the provided NGSI-LD Entity
  Fragment, the type of the Attribute has to be the same as the type of the
  targeted Attribute fragment, i.e. it is not allowed to change the type of an
  algorithm mandated by clause 8.4.2 If present in the provided NGSI-LD
  Attribute Fragment, the type of the Attribute has to be the same as the type
  of the Attribute fragment, i.e. it is not allowed to change the type of an
  Attribute.

#### 10.2.5.5 Output data
@@ -421,8 +422,8 @@ Figure: Set Attribute Value use case
- A selector of Entity types as specified by clause 7.2.2 (optional).
- Target Attribute (Property or Relationship) to be modified, identified by a
  name.
- A JSON or JSON-LD document representing an NGSI-LD Value Fragment (see clause
  5.5)
- A JSON or JSON-LD document representing an NGSI-LD Attribute Fragment (see
  clause 5.5)
- 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
@@ -469,14 +470,14 @@ Figure: Set Attribute Value use case

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

- Replace the existing Attribute value instance with the Value Fragment
  provided.
- 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 Value Fragment shall undergo
    expansion prior to replacement (see clause 8.2.4)
  - 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:
@@ -688,8 +689,8 @@ The following behaviour shall be exhibited by compliant implementations:
    complete Merge Entity operation failed, or in a partial success if some
    parts of it succeeded.

- The matching Attributes are then removed from the Fragment and not processed
  further.
- The matching Attributes are then removed from the Entity Fragment and not
  processed further.

- For any **inclusive** [Context Source Registrations]{.HTML-Keyboard} that
  match against the remaining input data, that input data is also forwarded in
@@ -752,15 +753,15 @@ The following behaviour shall be exhibited by compliant implementations:
      - Otherwise if value is not NGSI-LD Null, the default Attribute instance
        shall be appended to the target Entity.

- If _`type`_ is included in the Fragment and it includes Entity Type names that
  are not yet in the target Entity, add them to the list of Entity Type names of
  the target Entity.
- If _`scope`_ is included in the Fragment and overwrite is allowed, the scope
  of the target Entity will become the one included in the Fragment. Otherwise,
  the Scopes in the Fragment that are not part of the value of _`scope`_ of the
  target Entity will be appended to the value of the _`scope`_ of the target
  Entity. If there is more than one Scope, the value of _`scope`_ is represented
  as a JSON array containing all Scopes.
- If _`type`_ is included in the Entity Fragment and it includes Entity Type
  names that are not yet in the target Entity, add them to the list of Entity
  Type names of the target Entity.
- If _`scope`_ is included in the Entity Fragment and overwrite is allowed, the
  scope of the target Entity will become the one included in the Entity
  Fragment. Otherwise, the Scopes in the Entity Fragment that are not part of
  the value of _`scope`_ of the target Entity will be appended to the value of
  the _`scope`_ of the target Entity. If there is more than one Scope, the value
  of _`scope`_ is represented as a JSON array containing all Scopes.

#### 10.2.9.5 Output data

@@ -818,8 +819,8 @@ Figure: Replace Entity use case
    complete Replace Entity operation failed, or in a partial success if some
    parts of it succeeded.

- The matching Attributes are then removed from the Fragment and not processed
  further.
- The matching Attributes are then removed from the Entity Fragment and not
  processed further.
- For any **inclusive** [Context Source Registrations]{.HTML-Keyboard} that
  match against the remaining input data, that input data is also forwarded in
  the case the Replace Entity operation is supported for remote processing to
@@ -2208,8 +2209,8 @@ Figure: Retrieve Attribute Value use case

- Entity ID (URI) of the concerned Entity, the target Entity.
- A selector of Entity types as specified by clause 7.2.2 (optional).
- A flag indicating representation of the Attribute value to be
  returned (optional).
- A flag indicating representation of the Attribute value to be returned
  (optional).
- Target Attribute (Property or Relationship) whose value is to be retrieved,
  identified by a name.
- A specified language filter as per clause 7.2.7 (optional).
@@ -2316,8 +2317,8 @@ Figure: Retrieve Attribute Value use case

#### 10.4.4.5 Output data

A JSON or JSON-LD document representing an NGSI-LD Value Fragment as mandated by
clause 5.5, formatted according to the defined representation.
A JSON or JSON-LD document representing an NGSI-LD Attribute Fragment as
mandated by clause 5.5, formatted according to the defined representation.

if an _`@context`_ is supplied and the returned Attribute corresponds to a
[VocabProperty]{.HTML-Keyboard}, the returned value shall be compacted according
@@ -2544,7 +2545,7 @@ Figure: Update subscription use case
  type [ResourceNotFound]{.HTML-Error} shall be raised.
- Execute the behaviour defined in clause 8.2.3 on JSON-LD validation.
- If the data types and restrictions expressed by clause 5.2.6.5.2 are not met
  by the _Subscription Fragment_, then an error of type
  by the Subscription Fragment, then an error of type
  [BadRequestData]{.HTML-Error} shall be raised.
- Term to URI expansion of Attribute names shall be observed as mandated by
  clause 8.2.4.
+9 −9
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ Implementations shall exhibit the following behaviour:
    Entity" operation failed or in a partial success if some parts of it
    succeeded.

  The matching Attributes are then removed from the Fragment and not processed
  further.
  The matching Attributes are then removed from the EntityTemporal Fragment and
  not processed further.

- If any **redirect** [Context Source Registrations]{.HTML-Keyboard} exist that
  match against the input data, that input data is forwarded for remote
@@ -84,8 +84,8 @@ Implementations shall exhibit the following behaviour:
    "Create or Update (Upsert) Temporal Evolution of an Entity" operation failed
    or in a partial success if some parts of it succeeded.

  The matching Attributes are then removed from the Fragment and not processed
  further.
  The matching Attributes are then removed from the EntityTemporal Fragment and
  not processed further.

- For any **inclusive** [Context Source Registrations]{.HTML-Keyboard} that
  match against the remaining input data, that input data is also forwarded for
@@ -164,8 +164,8 @@ The following behaviour shall be exhibited by compliant implementations:
    Evolution of an Entity"operation failed or in a partial success if some
    parts of it succeeded.

  The matching Attributes are then removed from the Fragment and not processed
  further.
  The matching Attributes are then removed from the EntityTemporal Fragment and
  not processed further.

- For any **inclusive** [Context Source Registrations]{.HTML-Keyboard} that
  match against the remaining input data, that input data is also forwarded for
@@ -173,8 +173,8 @@ The following behaviour shall be exhibited by compliant implementations:
- If the target [Temporal Evolution of an Entity]{.HTML-Keyboard} exists locally
  and matches against the remaining input data, implementations shall do the
  following:
  - For each Attribute instance included by the _EntityTemporal_ Fragment at
    root level:
  - For each Attribute instance included by the EntityTemporal Fragment at root
    level:
  - The Attribute (considering term expansion rules as mandated by
    Clause+++clause-8+++root.2.4) instance(s) shall be added to the target
    [Temporal Evolution of an Entity]{.HTML-Keyboard}.
@@ -351,7 +351,7 @@ Figure: Modify Attribute Instance in Temporal Evolution of an Entity use case
  - If for the target Attribute no instance with the specified _`instanceId`_
    exists, an error of type [ResourceNotFound]{.HTML-Error} shall be raised.
  - Replace the target Attribute instance identified by the _`instanceId`_ with
    the Attribute instance in the _EntityTemporal_ Fragment. The _`createdAt`_
    the Attribute instance in the EntityTemporal Fragment. The _`createdAt`_
    property of the concerned instance shall remain unchanged, but the
    _`modifiedAt`_ property shall be set to the timestamp corresponding to this
    modification.
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ Figure: Update context source registration use case
- Execute the behaviour defined in Clause+++clause-8+++8.2.3 on JSON-LD
  validation.
- If the data types and restrictions expressed by Clause+++clause-5+++5.2.6.5.3
  are not met by the [Context Source Registration]{.HTML-Keyboard} _Fragment_,
  are not met by the [Context Source Registration]{.HTML-Keyboard} Fragment,
  then an error of type _BadRequestData_ shall be raised.
- Term to URI expansion of Attribute names shall be observed as mandated by
  Clause+++clause-8+++8.2.4.
+1 −1
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ Figure: Update Snapshot Status use case
- Execute the behaviour defined in Clause+++clause-8+++root.2.3 on JSON-LD
  validation.
- If the data types and restrictions expressed by
  Clause+++clause-5+++root.2.6.5.4 are not met by the _Snapshot Fragment_ - in
  Clause+++clause-5+++root.2.6.5.4 are not met by the Snapshot Fragment - in
  particular whether elements can be updated - then an error of type
  [BadRequestData]{.HTML-Error} shall be raised.
- Term to URI expansion of Attribute names shall be observed as mandated by
+31 −31
Original line number Diff line number Diff line
@@ -5600,22 +5600,22 @@ within IETF RFC 7946 [n.4].
An example can be found in Annex C, Clause+++annex-c+++C.2.3.
## 5.4 NGSI-LD fragments
## 5.4 NGSI-LD Element fragments
When updating NGSI-LD elements (Entities, Attributes, [Context Source
Registrations]{.HTML-Keyboard} or Subscriptions) it is necessary to have a means
of describing a set of modifications to their content.
When updating NGSI-LD Elements (Entities, TemporalEntities, [Context Source
Registrations]{.HTML-Keyboard} Snapshots or Subscriptions) it is necessary to
have a means of describing a set of modifications to their content.
An NGSI-LD Fragment is a JSON Merge Patch document [n.17] and [i.18] which
describes changes to be made to a target JSON-LD document using a syntax that
closely mimics the document being modified.
An NGSI-LD Element Fragment is a JSON Merge Patch document [n.17] and [i.18]
which describes changes to be made to a target JSON-LD document using a syntax
that closely mimics the document being modified.
An NGSI-LD Fragment is a JSON-LD Object which shall include the following
An NGSI-LD Element Fragment is a JSON-LD Object which shall include the following
members:
- [id"]{.HTML-Code}: (optional for certain bindings where it can be determined
  from the operation signature). It shall be equal to the _`id`_ of the target
  (mutated) NGSI-LD element. Attribute Fragments do not contain explicit ids.
  (mutated) NGSI-LD element.
- ["type"]{.HTML-Code}: (optional for certain bindings where it can be
  determined from the operation signature). It shall contain the Type name(s) of
  the target NGSI-LD element.
@@ -5646,9 +5646,9 @@ changing its endpoint's URI:
<!-- prettier-ignore-end -->
When an NGSI-LD Fragment of an Entity by is received in the **concise format**
(see Clause+++root.3.2.3), it is first expanded into a normalized fragment
before being applied.
When an Entity Fragment is received in the **concise format** (see
Clause+++root.3.2.3), it is first expanded into a normalized fragment before
being applied.
<!-- prettier-ignore-start -->
@@ -5705,7 +5705,7 @@ _`address`_ Property. i.e a modification of a Property of a Property.
>>> [!tip] EXAMPLE 4:
The following NGSI-LD Fragment of an Entity in the **normalized format** allows the
The following Entity Fragment in the **normalized format** allows the
modification the Entity by:
- updating its _`locatedAt`_ _Relationship_ _`object`_
@@ -5743,7 +5743,7 @@ modification the Entity by:
>>> [!tip] EXAMPLE 4:
The following NGSI-LD Fragment in the **concise format** allows the modification
The following Entity Fragment in the **concise format** allows the modification
of an Entity by:
- updating its _`locatedAt`_ _Relationship_ _`object`_
@@ -5781,7 +5781,7 @@ Clause+++clause-8+++8.4.3) shall be encoded as the JSON object [{"&#64;none":
>>> [!tip] EXAMPLE 4:
The following NGSI-LD Fragment in the **normalized format** removes the
The following Entity Fragment in the **normalized format** removes the
_`exonym`_ _LanguageProperty_ from the Entity:
```json
@@ -5809,7 +5809,7 @@ format**.
>>> [!tip] EXAMPLE 5:
The following NGSI-LD Fragment in the **concise format** removes the _`exonym`_
The following Entity Fragment in the **concise format** removes the _`exonym`_
_LanguageProperty_ from the Entity:
```json
@@ -5824,7 +5824,7 @@ _LanguageProperty_ from the Entity:
<!-- prettier-ignore-end -->
## 5.5 NGSI-LD Value fragments
## 5.5 NGSI-LD Attribute fragments
It is necessary to have a means of describing the value held within an
individual NGSI-LD Attribute. This is used when updating or retrieving the value
@@ -5832,9 +5832,9 @@ directly. In these cases, it shall be assumed that Entity ["id"]{.HTML-Code},
Entity ["type"]{.HTML-Code} and Attribute name can all be determined from the
operation signature.
A Value Fragment in the normalised format, shall at a minimum be a JSON Object
holding the mandatory elements of an Attribute as described in clause 5.3.2.2 -
i.e. ["type"]{.HTML-Code} and one of ["value"]{.HTML-Code},
An Attribute Fragment in the normalised format, shall at a minimum be a JSON
Object holding the mandatory elements of an Attribute as described in clause
5.3.2.2 - i.e. ["type"]{.HTML-Code} and one of ["value"]{.HTML-Code},
["object"]{.HTML-Code}, ["languageMap"]{.HTML-Code}, ["vocab"]{.HTML-Code},
["valueList"]{.HTML-Code}, ["objectList"]{.HTML-Code} or ["json"]{.HTML-Code}.
Further members (such as ["datasetId"]{.HTML-Code}, ["observedAt"]{.HTML-Code})
@@ -5845,7 +5845,7 @@ optional ["@context"]{.HTML-Code} may also be present.
>>> [!tip] EXAMPLE 1:
Representation of an NGSI-LD Value Fragment of a _Property_ in the
Representation of an NGSI-LD Attribute Fragment of a _Property_ in the
**normalised format**:
```json
@@ -5861,18 +5861,18 @@ Representation of an NGSI-LD Value Fragment of a _Property_ in the
<!-- prettier-ignore-end -->
A Value Fragment in the concise format, shall be a JSON Object compacted
An Attribute Fragment in the concise format, shall be a JSON Object compacted
according to the Normalized-to-Concise Compaction algorithm found in clause
5.3.2.2. However where present, the ["value"]{.HTML-Code} element shall not
undergo full compaction if the property value is a JSON primitive or GeoJSON
object, so that the ["value"]{.HTML-Code} element shall remain within the
Fragment
Attribute Fragment
<!-- prettier-ignore-start -->
>>> [!tip] EXAMPLE 2:
Representation of an NGSI-LD Value Fragment of a _Property_ in the
Representation of an NGSI-LD Attribute Fragment of a _Property_ in the
**concise format**:
```json
@@ -5887,7 +5887,7 @@ Representation of an NGSI-LD Value Fragment of a _Property_ in the
<!-- prettier-ignore-end -->
A Value Fragment in the simplified format, shall consist of a JSON Object
An Attribute Fragment in the simplified format, shall consist of a JSON Object
holding a representation of the Attribute value alone, and following the
compaction rules of the concise representation described above. An
["@context"]{.HTML-Code}, and in the Multi-attribute case
@@ -5898,7 +5898,7 @@ compaction rules of the concise representation described above. An
>>> [!tip] EXAMPLE 3:
Representation of an NGSI-LD Value Fragment of a _Property_ in the
Representation of an NGSI-LD Attribute Fragment of a _Property_ in the
**simplified format**:
```json
@@ -5913,7 +5913,7 @@ Representation of an NGSI-LD Value Fragment of a _Property_ in the
<!-- prettier-ignore-end -->
Where a binding explicitly defines a request or response to be **value only**,
the representation of an NGSI-LD Value Fragment changes, and shall be
the representation of an NGSI-LD Attribute Fragment changes, and shall be
represented purely as the Attribute value itself (e.g. directly as a JSON
Primitive, a JSON Object or JSON Array as necessary) rather than as a JSON
object holding a series of key-value pairs as described above.
@@ -5922,7 +5922,7 @@ object holding a series of key-value pairs as described above.
>>> [!tip] EXAMPLE 4:
Value only Representation of an NGSI-LD Value Fragment
Value only Representation of an NGSI-LD Attribute Fragment
```json
"Berlin"
@@ -5932,10 +5932,10 @@ Value only Representation of an NGSI-LD Value Fragment
<!-- prettier-ignore-end -->
An _`@context`_ cannot be embedded within the NGSI-LD Value fragment when using
the **value only** representation, therefore in this case, whenever an
An _`@context`_ cannot be embedded within the NGSI-LD Attribute fragment when
using the **value only** representation, therefore in this case, whenever an
_`@context`_ is required, it shall be supplied through the use of a Link header
(see Clause+++clause-6+++6.2.4).
The value _`null`_ or any representation of NGSI-LD Null are prohibited within
NGSI-LD Value fragments.
NGSI-LD Attribute fragments.