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

Add examples. Define value only.

parent b8e0eec7
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -472,14 +472,14 @@ Figure: Set Attribute Value use case
- Replace the existing Attribute value instance with the Value Fragment
  provided.

  - If a user _`@context`_ has been supplied, the Value Fragment shall undergo
    expansion prior to replacement (see clause 8.2.4)
  - If the Attribute value to be replaced is represented in a simplified
  - 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 the Attribute whose value is to be set previously contained an
    _`observedAt`_ sub-Attribute and no _`observedAt`_ element can be found
    within the Value fragment then:
    _`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.
@@ -2317,7 +2317,7 @@ 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.
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
+84 −16
Original line number Diff line number Diff line
@@ -5826,16 +5826,38 @@ _LanguageProperty_ from the Entity:
## 5.5 NGSI-LD Value fragments
When updating the value of an individual NGSI-LD Attribute, it is necessary to
have a means of describing the value to be updated.
When updating or retrieving the value of an individual NGSI-LD Attribute, it is
necessary to have a means of describing the value to be updated. The value
_`null`_ or an NGSI-LD Null are prohibited within NGSI-LD Value fragments.
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},
["object"]{.HTML-Code}, ["languageMap"]{.HTML-Code}, ["vocab"]{.HTML-Code},
["valueList"]{.HTML-Code}, ["objectList"]{.HTML-Code} or ["json"]{.HTML-Code}.
Further members where present, shall follow the data types described in clause
5.2.6.4.8 and an optional. ["@context"]{.HTML-Code} may also be present.
Further members (such as ["datasetId"]{.HTML-Code}, ["observedAt"]{.HTML-Code})
where present, shall follow the data types described in clause
5.2.6.4.8. An optional ["@context"]{.HTML-Code} may also be present.
<!-- prettier-ignore-start -->
>>> [!tip] EXAMPLE 1:
Representation of an NGSI-LD Value Fragment of a _Property_ in the
**normalised format**:
```json
{
  "value": "Berlin",
  "type": "Property",
  "observedAt": "2022-03-14T12:51:02.000Z",
  "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.9.jsonld"
}
```
>>>
<!-- prettier-ignore-end -->
A Value Fragment in the concise format, shall be a JSON Object compacted
according to the Normalized-to-Concise Compaction algorithm found in clause
@@ -5843,25 +5865,71 @@ according to the Normalized-to-Concise Compaction algorithm found in clause
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
A Value Fragment in the simplified format, shall consist of a JSON
representation of Attribute value alone. the value _`null`_ or an NGSI-LD Null
are prohibited.
<!-- prettier-ignore-start -->
>>> [!tip] EXAMPLE 2:
Representation of an NGSI-LD Value Fragment of a _Property_ in the
**concise format**:
```json
{
  "value": "Berlin",
  "observedAt": "2022-03-14T12:51:02.000Z",
  "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.9.jsonld"
}
```
>>>
<!-- prettier-ignore-end -->
A Value 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 ["datasetId"]{.HTML-Code}
may also be present.
<!-- prettier-ignore-start -->
>>> [!note] NOTE:
>>> [!tip] EXAMPLE 3:
When an optional user _`@context`_ is supplied using a mechanism appropriate
to the binding used, Value Fragments represented in the normalised and concise
formats are valid JSON-LD documents.
Value Fragments represented in the simplified format are valid JSON documents.
Use of a supplied user _`@context`_  is implied.
Representation of an NGSI-LD Value Fragment of a _Property_ in the
**simplified format**:
```json
{
  "value": "Berlin",
  "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.9.jsonld"
}
```
>>>
<!-- prettier-ignore-end -->
When updating the value of an individual NGSI-LD Attribute, it shall be assumed
that Entity [id"]{.HTML-Code}, Entity ["type"]{.HTML-Code} and Attribute name
can all be determined from the operation signature.
When updating or retrieving the value of an individual NGSI-LD Attribute, it shall
be assumed that Entity [id"]{.HTML-Code}, Entity ["type"]{.HTML-Code} and Attribute
name can all be determined from the operation signature.
Where the binding explicitly defines a request or response to be **value only**,
the NGSI-LD Value Fragment shall be represented purely as a value (e.g. a JSON Primitive)
rather than as a JSON Object.
<!-- prettier-ignore-start -->
>>> [!tip] EXAMPLE 4:
Value only Representation of an NGSI-LD Value Fragment
```json
"Berlin"
```
>>>
<!-- prettier-ignore-end -->