The purpose of identifiers is to allow uniquely identifying NGSI-LD elements (Entities, Context Subscriptions or [Context Source Registrations]{.HTML_Keyboard}) within an NGSI-LD system. This annex is intended to clarify the different issues around the design of identifiers in NGSI-LD.
The purpose of identifiers is to allow uniquely identifying NGSI-LD elements (Entities, Context Subscriptions or [Context Source Registrations]{.HTML-Keyboard}) within an NGSI-LD system. This annex is intended to clarify the different issues around the design of identifiers in NGSI-LD.
## A.2 Entity identifiers
In order to enable the participation of NGSI-LD in linked data scenarios, all Entities are identified by **URIs**. If those URIs are expected to participate in external linked data relationships they **should** be dereferenceable.
It is noteworthy that the identifier from the point of view of NGSI-LD is different from the inherent identifier that a specific Entity may have. For instance, an NGSI-LD Entity of Type ["Vehicle"]{.HTML_Code} may have a Property named *licencePlateNumber*, which it is actually a unique identifier from the point of view of the Entity domain, as it uniquely identifies the specific vehicle instance. However, from the point of view of the NGSI-LD system, it may have another identifier which might or might not include such licence plate number identifier.
It is noteworthy that the identifier from the point of view of NGSI-LD is different from the inherent identifier that a specific Entity may have. For instance, an NGSI-LD Entity of Type ["Vehicle"]{.HTML-Code} may have a Property named [licencePlateNumber]{.HTML-Variable}, which it is actually a unique identifier from the point of view of the Entity domain, as it uniquely identifies the specific vehicle instance. However, from the point of view of the NGSI-LD system, it may have another identifier which might or might not include such licence plate number identifier.
## A.3 NGSI-LD namespace
@@ -16,19 +16,19 @@ NGSI-LD defines a specific URN [n.9] namespace intended to help API users to des
The referred namespace is defined as follows (to be registered with IANA):
- namespace identifier: NID = ["ngsi-ld"]{.HTML_Code}
- namespace specific string: NSS = EntityTypeName [":"]{.HTML_Code} EntityIdentificationString
- namespace identifier: NID = ["ngsi-ld"]{.HTML-Code}
- namespace specific string: NSS = EntityTypeName [":"]{.HTML-Code} EntityIdentificationString
*EntityTypeName* shall be an Entity Type name which can be expanded to a URI as per the *\@context*.
EntityTypeName shall be an Entity Type name which can be expanded to a URI as per the [\@context]{.HTML-Variable}.
*EntityIdentificationString* shall be a string that allows uniquely identifying the subject Entity in combination with the other items being part of the NSS.
EntityIdentificationString shall be a string that allows uniquely identifying the subject Entity in combination with the other items being part of the NSS.
>>> [!tip] EXAMPLE:
[urn:ngsi-ld:Person:28976543]{.HTML_Code} .
[urn:ngsi-ld:Person:28976543]{.HTML-Code} .
>>>
It is recommended that applications use this URN namespace when applicable.
In general, the URN specification defines namespace equivalence in a case-insensitive manner, however it is assumed that context-broker implementations shall always use lowercase letters in namespaces where they have a choice in case, unless there is a strong reason otherwise. Restricting the namespace prefix to lower case [urn:ngsi-ld:]{.HTML_Code} can improve caching and retrieval, since this ensures since alphabetic characters within the namespace specific string are always consistent.
In general, the URN specification defines namespace equivalence in a case-insensitive manner, however it is assumed that context-broker implementations shall always use lowercase letters in namespaces where they have a choice in case, unless there is a strong reason otherwise. Restricting the namespace prefix to lower case [urn:ngsi-ld:]{.HTML-Code} can improve caching and retrieval, since this ensures since alphabetic characters within the namespace specific string are always consistent.
# Annex B (normative): Core NGSI-LD \@context definition
Below is the definition of the Core NGSI-LD *\@context* which shall be supported by implementations.
Below is the definition of the Core NGSI-LD [\@context]{.HTML-Variable} which shall be supported by implementations.
Such definition has been tested using [i.7].
@@ -448,6 +448,6 @@ Such definition has been tested using [i.7].
>>> [!note] NOTE:
Implementers can take advantage of prefixed terms, i.e. in the form ngsi-ld:term, to provide a terser representation of the Core *\@context* .
Implementers can take advantage of prefixed terms, i.e. in the form ngsi-ld:term, to provide a terser representation of the Core [\@context]{.HTML-Variable} .
@@ -6,7 +6,7 @@ These algorithms are informative but NGSI-LD implementations should aim at eithe
## D.2 Algorithm for transforming an NGSI-LD Entity into a JSON-LD document (ALG1)
This algorithm takes as input an NGSI-LD graph which top level node is a particular Entity and returns as output a JSON-LD document which represents all the data associated to the entity. The JSON-LD document (and its associated *\@context*) corresponds to a representation of the Entity in JSON-LD as per the NGSI-LD Information Model.
This algorithm takes as input an NGSI-LD graph which top level node is a particular Entity and returns as output a JSON-LD document which represents all the data associated to the entity. The JSON-LD document (and its associated [\@context]{.HTML-Variable}) corresponds to a representation of the Entity in JSON-LD as per the NGSI-LD Information Model.
>>> [!note] NOTE:
@@ -35,7 +35,7 @@ Let:
-**O** be a JSON object initialized to the empty object ({}).
-**C** be a JSON-LD *\@context* initialized as described by annex B.
-**C** be a JSON-LD [\@context]{.HTML-Variable} initialized as described by annex B.
The algorithm should run as follows, provided all the preconditions defined above are satisfied:
@@ -47,7 +47,7 @@ The algorithm should run as follows, provided all the preconditions defined abov
3. For each Property Psi (Pi, "AliasP", Vi, Di) associated to N:
a. Run Algorithm*ALG1.1*
a. Run AlgorithmALG1.1 taking the following inputs:
- Ps → Psi.
- O → O.
- C → C.
@@ -55,7 +55,7 @@ The algorithm should run as follows, provided all the preconditions defined abov
4. For each Relationship Rs (Ri, AliasRi, Robji) associated to N:
a. Run Algorithm*ALG1.2*
a. Run AlgorithmALG1.2 taking the following inputs:
- Rs → Rsi.
- O → O.
- C → C.
@@ -91,14 +91,14 @@ Let O be the output JSON-LD object and C the associated JSON-LD context:
a. For each Property associated to Ps (Pss) recursively run the present algorithm (*ALG1.1*
a. For each Property associated to Ps (Pss) recursively run the present algorithm (ALG1.1) taking the following inputs:
- Ps → Pss.
- O → Op.
- C → C.
a. For each Relationship associated to Ps (Rss) run algorithm*ALG1.2*
a. For each Relationship associated to Ps (Rss) run algorithmALG1.2 taking the following inputs:
- Rs → Rss.
- O → Op.
- C → C.
@@ -122,14 +122,14 @@ Let O be the output JSON-LD object and C the current JSON-LD context:
a. For each Property associated to Rs (Pss) run the algorithm*ALG1.1*
a. For each Property associated to Rs (Pss) run the algorithmALG1.1 taking the following inputs:
- Ps → Pss.
- O → Or.
- C → C.
a. For each Relationship associated to Rs (Rss) recursively run the present algorithm*ALG1.2*
a. For each Relationship associated to Rs (Rss) recursively run the present algorithmALG1.2 taking the following inputs: