diff --git a/README.md b/README.md index ea10793..e991eaa 100644 --- a/README.md +++ b/README.md @@ -18,23 +18,22 @@ directly or programmatically.
> [!NOTE] +> > **Should I use NGSI-LD or NGSI-v2?** > > FIWARE offers two flavours of the NGSI interfaces: > +> - **NGSI-v2** offers JSON based interoperability used in individual Smart Systems +> - **NGSI-LD** offers JSON-LD based interoperability used for Federations and Data Spaces > -> - **NGSI-v2** offers JSON based interoperability used in individual Smart Systems -> - **NGSI-LD** offers JSON-LD based interoperability used for Federations and Data Spaces -> -> Of the two, NGSI-LD is more complex and relies on the introduction of a JSON-LD `@context`. -> A full understanding of JSON-LD (Linked Data) is required to obtain the benefits of NGSI-LD , -> which allows for interoperability across apps and organisations. +> Of the two, NGSI-LD is more complex and relies on the introduction of a JSON-LD `@context`. A full understanding of +> JSON-LD (Linked Data) is required to obtain the benefits of NGSI-LD , which allows for interoperability across apps +> and organisations. > > In general, you should use NGSI-LD when creating a data space or introducing a system of systems aproach. > -> Use NGSI-v2 for simpler isolated systems. More information about NGSI-v2 can be found [here](https://fiware-tutorials.readthedocs.io) - - +> Use NGSI-v2 for simpler isolated systems. More information about NGSI-v2 can be found +> [here](https://fiware-tutorials.readthedocs.io)

Data models

@@ -70,9 +69,8 @@ important since we will need a well-defined structure to be able to generate `@c ### Docker and Docker Compose The NGSI-LD tutorials are designed to run under any Unix environment, the tested configuration and GitPod environment is -currently based on Ubuntu 22.04.2 LTS. However, there may be some minor issues when running the tutorials directly on Windows -machines or Apple M1 Silicon amd64 systems, and the following -[Virtual Box set-up](docs/virtual-box.md) or +currently based on Ubuntu 22.04.2 LTS. However, there may be some minor issues when running the tutorials directly on +Windows machines or Apple M1 Silicon amd64 systems, and the following [Virtual Box set-up](docs/virtual-box.md) or [WSL set-up](docs/wsl.md) can be used when facing issues. Each tutorial runs all components using [Docker](https://www.docker.com). **Docker** is a container technology which @@ -117,6 +115,12 @@ FIWARE Postman collections can be downloaded directly from the development environments that spins up an automated dev environment for each task, in the cloud. It enables you to run the tutorials in a cloud development environment directly from your browser or your Desktop IDE. +### Windows Subsystem for Linux + +We will start up our services using a simple bash script. Windows users should download the +[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) to provide a command-line +functionality similar to a Linux distribution on Windows. + ## Tutorials List[](https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.08.01_60/gs_cim009v010801p.pdf) ### Core Context Management: NGSI-LD Fundamentals diff --git a/docs/extended-properties.md b/docs/extended-properties.md index d6e089e..030964b 100644 --- a/docs/extended-properties.md +++ b/docs/extended-properties.md @@ -1,7 +1,9 @@ [![FIWARE Core Context Management](https://nexus.lab.fiware.org/repository/raw/public/badges/chapters/core.svg)](https://github.com/FIWARE/catalogue/blob/master/core/README.md) [![NGSI LD](https://img.shields.io/badge/NGSI-LD-d6604d.svg)](https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.08.01_60/gs_cim009v010801p.pdf) -**Description:** This tutorial examines the keyword syntax tokens of JSON-LD and introduces custom property types which extend NGSI-LD properties to cover multilingual capabilities and preferred enumeration names whilst reusing the data from the [Smart Farm example](https://github.com/FIWARE/tutorials.Getting-Started/tree/NGSI-LD). The tutorial uses +**Description:** This tutorial examines the keyword syntax tokens of JSON-LD and introduces custom property types which +extend NGSI-LD properties to cover multilingual capabilities and preferred enumeration names whilst reusing the data +from the [Smart Farm example](https://github.com/FIWARE/tutorials.Getting-Started/tree/NGSI-LD). The tutorial uses [cUrl](https://ec.haxx.se/) commands throughout. [Run In Postman](https://god.gw.postman.com/run-collection/217860-3b538d21-0f19-4c63-a9d6-e184ef829ca7?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D217860-3b538d21-0f19-4c63-a9d6-e184ef829ca7%26entityType%3Dcollection%26workspaceId%3Db6e7fcf4-ff0c-47cb-ada4-e222ddeee5ac) @@ -11,48 +13,51 @@ # Understanding JSON-LD `@keywords` -> "Я понять тебя хочу, Темный твой язык учу."
-> _"I want to understand you, I am studying your incomprehensible language."_ +> "Я понять тебя хочу, Темный твой язык учу."
> _"I want to understand you, I am studying your incomprehensible +> language."_ > > — Alexander Pushkin (Verses, composed during a sleepless night) -The [JSON-LD syntax](https://www.w3.org/TR/json-ld/#syntax-tokens-and-keywords) defines a series of keywords to describe the structure of the JSON displayed. Since **NGSI-LD** is just a formally structured _extended subset_ of **JSON-LD**, **NGSI-LD** should be -directly or indirectly capable of offering an equivalent for all the functions defined by JSON-LD. +The [JSON-LD syntax](https://www.w3.org/TR/json-ld/#syntax-tokens-and-keywords) defines a series of keywords to describe +the structure of the JSON displayed. Since **NGSI-LD** is just a formally structured _extended subset_ of **JSON-LD**, +**NGSI-LD** should be directly or indirectly capable of offering an equivalent for all the functions defined by JSON-LD. -As an example, JSON-LD defines `@id` to indicate the unique identifier of an Entity, and `@type` to define the type of an Entity. -The NGSI-LD core `@context` further refines this further, so that `id`/`@id` and `type`/`@type` are considered as interchangeable. +As an example, JSON-LD defines `@id` to indicate the unique identifier of an Entity, and `@type` to define the type of +an Entity. The NGSI-LD core `@context` further refines this further, so that `id`/`@id` and `type`/`@type` are +considered as interchangeable. Both of the following syntaxes (with and without `@`) are acceptable in NGSI-LD: ```json { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Building", - "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + "id": "urn:ngsi-ld:Building:farm001", + "type": "Building", + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" } ``` ```json { - "@id": "urn:ngsi-ld:Building:farm001", - "@type": "Building", - "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + "@id": "urn:ngsi-ld:Building:farm001", + "@type": "Building", + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" } ``` -Among the keywords defined in JSON-LD, the following terms are used or mapped within the NGSI-LD core `@context` to maintain their meaning when JSON-LD data is supplied. +Among the keywords defined in JSON-LD, the following terms are used or mapped within the NGSI-LD core `@context` to +maintain their meaning when JSON-LD data is supplied. -- `@list` - Used to express an ordered set of data. -- `@json` - Used in association with unexpandable JSON objects -- `@language` - Used to specify the language for a particular string value or string array -- `@none` - Used as a default index value, when an attribute does not have the feature being indexed. -- `@value` - Used to specify the data that is associated with a particular property -- `@vocab` - Used to expand properties and values +- `@list` - Used to express an ordered set of data. +- `@json` - Used in association with unexpandable JSON objects +- `@language` - Used to specify the language for a particular string value or string array +- `@none` - Used as a default index value, when an attribute does not have the feature being indexed. +- `@value` - Used to specify the data that is associated with a particular property +- `@vocab` - Used to expand properties and values -Certain other keywords such as `@graph`, which describe statements about relationships are accepted in NGSI-LD, but are never processed directly by NGSI-LD Context brokers +Certain other keywords such as `@graph`, which describe statements about relationships are accepted in NGSI-LD, but are +never processed directly by NGSI-LD Context brokers -For example. Looking at the core `@context`, the GeoProperty attribute -`coordinates` is fully defined as: +For example. Looking at the core `@context`, the GeoProperty attribute `coordinates` is fully defined as: ```json "coordinates": { @@ -63,73 +68,84 @@ For example. Looking at the core `@context`, the GeoProperty attribute This ensure that the ordering of the values in its array (longitude, latitude) is always maintained. -All ordinary NGSI-LD **Properties** (and **GeoProperties**) have a `value`, which is the equivalent of a JSON-LD `@value` - this mean that the `value` of a Property is just the data that is associated with a particular property. +All ordinary NGSI-LD **Properties** (and **GeoProperties**) have a `value`, which is the equivalent of a JSON-LD +`@value` - this mean that the `value` of a Property is just the data that is associated with a particular property. -However, there are recent updates to the NGSI-LD specification which have introduced various extensions or subclasses to this principle, allowing the creation of NGSI-LD properties which directly conform to -JSON-LD keywords other than `@value`. +However, there are recent updates to the NGSI-LD specification which have introduced various extensions or subclasses to +this principle, allowing the creation of NGSI-LD properties which directly conform to JSON-LD keywords other than +`@value`. -- An NGSI-LD **LanguageProperty** holds a set of internationalized strings and is defined using the JSON-LD `@language` keyword. -- An NGSI-LD **VocabularyProperty** holds is a mapping of a URI to a value within the user'`@context` and is defined using the JSON-LD `@vocab` keyword. +- An NGSI-LD **LanguageProperty** holds a set of internationalized strings and is defined using the JSON-LD + `@language` keyword. +- An NGSI-LD **VocabularyProperty** holds is a mapping of a URI to a value within the user'`@context` and is defined + using the JSON-LD `@vocab` keyword. -In each case, the meaning of the resultant payload will be altered according to the standard JSON-LD definitions, so the output NGSI-LD remains fully valid JSON-LD. +In each case, the meaning of the resultant payload will be altered according to the standard JSON-LD definitions, so the +output NGSI-LD remains fully valid JSON-LD.

Entities within a Farm Management Information System (FMIS)

-To illustrate some extended NGSI-LD properties within an FMIS system based on NGSI-LD, we will alter the previously defined **Building** Entity type. As a reminder this has been defined as follows +To illustrate some extended NGSI-LD properties within an FMIS system based on NGSI-LD, we will alter the previously +defined **Building** Entity type. As a reminder this has been defined as follows -- A building, such as a barn, is a real world bricks and mortar construct. **Building** entities would have properties - such as: - - A name of the building e.g. "The Big Red Barn" - - The category of the building (e.g. "barn") - - An address "Friedrichstraße 44, 10969 Kreuzberg, Berlin" - - A physical location e.g. _52.5075 N, 13.3903 E_ - - A filling level - the degree to which the building is full. - - A temperature - e.g. _21 °C_ - - An association to the owner of the building (a real person) - - ...etc. +- A building, such as a barn, is a real world bricks and mortar construct. **Building** entities would have properties + such as: + - A name of the building e.g. "The Big Red Barn" + - The category of the building (e.g. "barn") + - An address "Friedrichstraße 44, 10969 Kreuzberg, Berlin" + - A physical location e.g. _52.5075 N, 13.3903 E_ + - A filling level - the degree to which the building is full. + - A temperature - e.g. _21 °C_ + - An association to the owner of the building (a real person) + - ...etc. Taking the first attribute, the Property `name` could be localized into multiple languages, for example: -- **Big Red Barn** in English -- **Große Rote Scheune** in German -- **大きな赤い納屋** in Japanese +- **Big Red Barn** in English +- **Große Rote Scheune** in German +- **大きな赤い納屋** in Japanese -Similarly, even if all participants in a data space can agree for a common URI for the definition of the enumerations of all the different building types within `category`, internally within their own systems, they may be requied to display these enumerations with their own localised values. +Similarly, even if all participants in a data space can agree for a common URI for the definition of the enumerations of +all the different building types within `category`, internally within their own systems, they may be requied to display +these enumerations with their own localised values. -For example if the FMIS follows the URIs defined by openstreetmap.org. A building designated as A _"barn"_ would actually be defined by the URI: `https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn`. A JSON-LD `@context` could be used to shorten this as required. +For example if the FMIS follows the URIs defined by openstreetmap.org. A building designated as A _"barn"_ would +actually be defined by the URI: `https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn`. A JSON-LD `@context` could be +used to shorten this as required. -If a user wanted the `category` defined as `"barn"` internally within their system, the following JSON-LD `@context` could be used: +If a user wanted the `category` defined as `"barn"` internally within their system, the following JSON-LD `@context` +could be used: ```json { - "@context": { - "barn": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn" - } + "@context": { + "barn": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn" + } } ``` -If a user wanted the `category` defined as `"scheune"` internally within their system, the following JSON-LD `@context` could be used: +If a user wanted the `category` defined as `"scheune"` internally within their system, the following JSON-LD `@context` +could be used: ```json { - "@context": { - "scheune": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn" - } + "@context": { + "scheune": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn" + } } ``` -The definition and redefinition of enumerations is not necessarily just a language localisation issue. It is possible that an FMIS may wish to use a separate code -list of values for -regulatory reasons. For example, the names of ingredients within a pesticide, -could be regulated by law and the required name could differ based on the market in which the product is sold (e.g. `Water`, `H₂O`, `Hydrogen Hydroxide`, `Oxygen Dihydride`, -`Hydric Acid`) +The definition and redefinition of enumerations is not necessarily just a language localisation issue. It is possible +that an FMIS may wish to use a separate code list of values for regulatory reasons. For example, the names of +ingredients within a pesticide, could be regulated by law and the required name could differ based on the market in +which the product is sold (e.g. `Water`, `H₂O`, `Hydrogen Hydroxide`, `Oxygen Dihydride`, `Hydric Acid`) ## Architecture -The demo application will send and receive NGSI-LD calls to a compliant context broker. Although the standardised NGSI-LD -interface is available across multiple context brokers, we only need to pick one - for example the -[Scorpio Broker](https://fiware-orion.readthedocs.io/en/latest/). The application will therefore only make use of -one FIWARE component. +The demo application will send and receive NGSI-LD calls to a compliant context broker. Although the standardised +NGSI-LD interface is available across multiple context brokers, we only need to pick one - for example the +[Scorpio Broker](https://fiware-orion.readthedocs.io/en/latest/). The application will therefore only make use of one +FIWARE component. Currently, the Orion Context Broker relies on open source [MongoDB](https://www.mongodb.com/) technology to hold the current state of the context data it contains and persistent information relevant to subscriptions and registrations. @@ -144,76 +160,78 @@ on the network. In our case the tutorial application will be used to host a seri Therefore, the architecture will consist of three elements: -- The [Scorpio Context Broker](https://scorpio.readthedocs.io/) which will receive requests using - [NGSI-LD](https://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/spec/updated/generated/full_api.json) -- The underlying [Postgres](https://www.postgresql.org/) database: - - Used by the Scorpio Context Broker to hold context data information such as data entities, subscriptions and - registrations. -- An HTTP **Web-Server** which offers static `@context` files defining the context entities within the system. +- The [Scorpio Context Broker](https://scorpio.readthedocs.io/) which will receive requests using + [NGSI-LD](https://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/rep/NGSI-LD/NGSI-LD/raw/master/spec/updated/generated/full_api.json) +- The underlying [Postgres](https://www.postgresql.org/) database: + - Used by the Scorpio Context Broker to hold context data information such as data entities, subscriptions and + registrations. +- An HTTP **Web-Server** which offers static `@context` files defining the context entities within the system. Since all interactions between the three elements are initiated by HTTP requests, the elements can be containerized and run from exposed ports. The necessary configuration information can be seen in the services section of the associated `scorpio.yml` file: -

Tutorial Configuration

```yaml scorpio: - labels: - org.fiware: "tutorial" - image: quay.io/fiware/scorpio:java-${SCORPIO_VERSION} - hostname: scorpio - container_name: fiware-scorpio - networks: - - default - ports: - - "1026:9090" - depends_on: - - postgres + labels: + org.fiware: "tutorial" + image: quay.io/fiware/scorpio:java-${SCORPIO_VERSION} + hostname: scorpio + container_name: fiware-scorpio + networks: + - default + ports: + - "1026:9090" + depends_on: + - postgres ``` ```yaml postgres: - labels: - org.fiware: "tutorial" - image: postgis/postgis - hostname: postgres - container_name: db-postgres - networks: - - default - ports: - - "5432" - environment: - POSTGRES_USER: ngb - POSTGRES_PASSWORD: ngb - POSTGRES_DB: ngb - logging: - driver: none - volumes: - - postgres-db:/var/lib/postgresql/data + labels: + org.fiware: "tutorial" + image: postgis/postgis + hostname: postgres + container_name: db-postgres + networks: + - default + ports: + - "5432" + environment: + POSTGRES_USER: ngb + POSTGRES_PASSWORD: ngb + POSTGRES_DB: ngb + logging: + driver: none + volumes: + - postgres-db:/var/lib/postgresql/data ``` ```yaml ld-context: - labels: - org.fiware: "tutorial" - image: httpd:alpine - hostname: context - container_name: fiware-ld-context - ports: - - "3004:80" - volumes: - - data-models:/usr/local/apache2/htdocs/ - healthcheck: - test: (wget --server-response --spider --quiet http://ld-context/ngsi-context.jsonld 2>&1 | awk 'NR==1{print $$2}'| grep -q -e "200") || exit 1 -``` - -All containers reside on the same network - the Scorpop Context Broker is listening on Port `9090` internally and `1026` externally and PostGres is -listening on the default port `5432` and the httpd web server is offering `@context` files on port `80`. All containers -are also exposing ports externally - this is purely for the tutorial access - so that cUrl or Postman can access them -without being part of the same network. The command-line initialization should be self-explanatory. + labels: + org.fiware: "tutorial" + image: httpd:alpine + hostname: context + container_name: fiware-ld-context + ports: + - "3004:80" + volumes: + - data-models:/usr/local/apache2/htdocs/ + healthcheck: + test: + (wget --server-response --spider --quiet http://ld-context/ngsi-context.jsonld 2>&1 | awk 'NR==1{print + $$2}'| grep -q -e "200") || exit 1 +``` + +All containers reside on the same network - the Scorpop Context Broker is listening on Port `9090` internally and `1026` +externally and PostGres is listening on the default port `5432` and the httpd web server is offering `@context` files on +port `80`. All containers are also exposing ports externally - this is purely for the tutorial access - so that cUrl or +Postman can access them without being part of the same network. The command-line initialization should be +self-explanatory. --- @@ -237,40 +255,42 @@ cd tutorials.Extended-Properties > ./services stop > ``` - ### Reading `@context` files -Two `@context` files have been generated and hosted on the tutorial application. They would be used by different organizations within the data space, and internally they define the names of attributes and enumerations in different ways. +Two `@context` files have been generated and hosted on the tutorial application. They would be used by different +organizations within the data space, and internally they define the names of attributes and enumerations in different +ways. -- [`ngsi-context.jsonld`](http://localhost:3000/data-models/ngsi-context.jsonld) -The **NGSI-LD** `@context` serves to - define all attributes when sending data to the context broker or retrieving data. This - `@context` must be used for all **NGSI-LD** to **NGSI-LD** interactions. +- [`ngsi-context.jsonld`](http://localhost:3000/data-models/ngsi-context.jsonld) -The **NGSI-LD** `@context` serves to + define all attributes when sending data to the context broker or retrieving data. This `@context` must be used for + all **NGSI-LD** to **NGSI-LD** interactions. -- [`alternate-context.jsonld`](http://localhost:3000/data-models/alternate-context.jsonld) is an alternative - **JSON-LD** definition of the attributes of the data models used by a third-party. In this case we have a German speaking customer who wishes to have all attribute names and enumerations to be defined using terminology common in the German language. Effectively, internally within their billing application a different set of short names for attributes is used. Their `@context` file reflects - the agreed mapping between attribute names. +- [`alternate-context.jsonld`](http://localhost:3000/data-models/alternate-context.jsonld) is an alternative + **JSON-LD** definition of the attributes of the data models used by a third-party. In this case we have a German + speaking customer who wishes to have all attribute names and enumerations to be defined using terminology common in + the German language. Effectively, internally within their billing application a different set of short names for + attributes is used. Their `@context` file reflects the agreed mapping between attribute names. The full data model description for a **Building** entity as used in this tutorial is based on the standard -[Smart Data Models definition](https://github.com/smart-data-models/dataModel.Building/tree/master/Building). -A [Swagger Specification](https://petstore.swagger.io/?url=https://smart-data-models.github.io/dataModel.Building/Building/swagger.yaml) +[Smart Data Models definition](https://github.com/smart-data-models/dataModel.Building/tree/master/Building). A +[Swagger Specification](https://petstore.swagger.io/?url=https://smart-data-models.github.io/dataModel.Building/Building/swagger.yaml) of the same model is also available, and would be used to generate code stubs in a full application. - ## Working with multilanguage properties -Sometimes, it is required to localize strings to offer variations for different languages in the creation and consumption of Entity data. In order to -proceed, we need to create initially a new entity data that defines the new data type `LanguageProperty` and use the -sub-attribute `LanguageMap` (and not `value`) to keep the representation of the values of this attribute in different -languages. +Sometimes, it is required to localize strings to offer variations for different languages in the creation and +consumption of Entity data. In order to proceed, we need to create initially a new entity data that defines the new data +type `LanguageProperty` and use the sub-attribute `LanguageMap` (and not `value`) to keep the representation of the +values of this attribute in different languages. This `LanguageMap` corresponds to a JSON object consisting of a series of simplified pairs where the keys shall be JSON strings representing [IETF RFC 5646](https://www.rfc-editor.org/info/rfc5646) language codes. ### Creating a new data entity -This example creates an entity with a **LanguageProperty** and a **VocabularyProperty**. -Let's create a farm **Building** entity in which we want to make the `name` available in three different languages, _English_, _German_, and _Japanese_. The process will be to -send a **POST** request to the Broker with the following information: +This example creates an entity with a **LanguageProperty** and a **VocabularyProperty**. Let's create a farm +**Building** entity in which we want to make the `name` available in three different languages, _English_, _German_, and +_Japanese_. The process will be to send a **POST** request to the Broker with the following information: #### 1️⃣ Request: @@ -329,8 +349,9 @@ Content-Length: 0 #### 2️⃣ Request: -This example creates a second entity with a **LanguageProperty** and a **VocabularyProperty**. -Each subsequent entity must have a unique `id` for the given `type`. Note that within a `languageMap`, the `@none` simplified pair indicates the default fallback value to be displayed for unknown languages. +This example creates a second entity with a **LanguageProperty** and a **VocabularyProperty**. Each subsequent entity +must have a unique `id` for the given `type`. Note that within a `languageMap`, the `@none` simplified pair indicates +the default fallback value to be displayed for unknown languages. ```bash curl -iX POST 'http://localhost:1026/ngsi-ld/v1/entities/' \ @@ -377,9 +398,9 @@ curl -iX POST 'http://localhost:1026/ngsi-ld/v1/entities/' \ ### Reading multilingual data in normalised format -This example retrieves a **LanguageProperty** in normalized format. If we want to get `name` of a specific entity (`urn:ngsi-ld:Building:farm001`) in normalised -format and without any reference to the language that we want to obtain the data. We should execute the following -command: +This example retrieves a **LanguageProperty** in normalized format. If we want to get `name` of a specific entity +(`urn:ngsi-ld:Building:farm001`) in normalised format and without any reference to the language that we want to obtain +the data. We should execute the following command: #### 3️⃣ Request: @@ -389,22 +410,23 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building: -d 'attrs=name' ``` -And the response that we obtain the whole `languageMap` including all the string values defined for the different languages: +And the response that we obtain the whole `languageMap` including all the string values defined for the different +languages: #### Response: ```json { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Building", - "name": { - "type": "LanguageProperty", - "languageMap": { - "en": "Victory Farm", - "de": "Bauernhof von Sieg", - "ja": "ビクトリーファーム" + "id": "urn:ngsi-ld:Building:farm001", + "type": "Building", + "name": { + "type": "LanguageProperty", + "languageMap": { + "en": "Victory Farm", + "de": "Bauernhof von Sieg", + "ja": "ビクトリーファーム" + } } - } } ``` @@ -420,30 +442,29 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:f -d 'lang=de' ``` -In this case, the response provides a new sub-attribute `lang` with the details of the language that was selected (`"lang": "de"`) -together with the sub-attribute `value` with the content of the string in the corresponding _German_ language. It is -important to notice that in this response the value of `type` is now _Property_ and there is no `LanguageMap` but `value` -sub-attribute. +In this case, the response provides a new sub-attribute `lang` with the details of the language that was selected +(`"lang": "de"`) together with the sub-attribute `value` with the content of the string in the corresponding _German_ +language. It is important to notice that in this response the value of `type` is now _Property_ and there is no +`LanguageMap` but `value` sub-attribute. #### Response: ```json { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Building", - "name": { - "type": "Property", - "lang": "de", - "value": "Bauernhof von Sieg" - } + "id": "urn:ngsi-ld:Building:farm001", + "type": "Building", + "name": { + "type": "Property", + "lang": "de", + "value": "Bauernhof von Sieg" + } } ``` ### Reading multilingual data in simplified format -This example retrieves a **LanguageProperty** in key-values format. -If we wanted to get the response in simplified format, we need to send the corresponding request parameter `format` -equal to `simplified`: +This example retrieves a **LanguageProperty** in key-values format. If we wanted to get the response in simplified +format, we need to send the corresponding request parameter `format` equal to `simplified`: #### 5️⃣ Request: @@ -462,20 +483,20 @@ The **Language Property** is returned within the `languageMap` attribute. ```json { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Building", - "name": { - "languageMap": { - "en": "Victory Farm", - "de": "Bauernhof von Sieg", - "ja": "ビクトリーファーム" + "id": "urn:ngsi-ld:Building:farm001", + "type": "Building", + "name": { + "languageMap": { + "en": "Victory Farm", + "de": "Bauernhof von Sieg", + "ja": "ビクトリーファーム" + } } - } } ``` -and if we wanted to get only the corresponding value of the `name` in **English** language, -the `lang=en` parameter must be present in the request. +and if we wanted to get only the corresponding value of the `name` in **English** language, the `lang=en` parameter must +be present in the request. #### 6️⃣ Request: @@ -489,21 +510,22 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:f #### Response: -In this case, the **Language Property** is returned as an ordinary **Property** and only -the value of the _English_ string is returned. Sub attributes are not returned in the simplified format. +In this case, the **Language Property** is returned as an ordinary **Property** and only the value of the _English_ +string is returned. Sub attributes are not returned in the simplified format. ```json { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Building", - "name": "Victory Farm" + "id": "urn:ngsi-ld:Building:farm001", + "type": "Building", + "name": "Victory Farm" } ``` ### Fallbacks when requesting data for an unsupported Language -Not all languages will necessarily be present within a `languageMap`. If an unsupported language (like _French_ `lang=fr`) is requested, the context broker will try its best to return -some data in an alternate language instead. The preferred default is the `@none` language, but if this is not present, any other language can be returned. +Not all languages will necessarily be present within a `languageMap`. If an unsupported language (like _French_ +`lang=fr`) is requested, the context broker will try its best to return some data in an alternate language instead. The +preferred default is the `@none` language, but if this is not present, any other language can be returned. #### 7️⃣ Request: @@ -520,24 +542,23 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:b #### Response: -Since **French** is not a supported language for this Entity, but a default alternative is present (as -indicated by the `@none` attribute), the default `@none` value is returned. -The **Language Property** is returned as an ordinary **Property** and only -the value of the default string is returned. +Since **French** is not a supported language for this Entity, but a default alternative is present (as indicated by the +`@none` attribute), the default `@none` value is returned. The **Language Property** is returned as an ordinary +**Property** and only the value of the default string is returned. ```json { - "id": "urn:ngsi-ld:Building:barn002", - "type": "Building", - "name": { - "type": "Property", - "lang": "@none", - "value": "The Big Red Barn" - }, - "@context": [ - "http://context/ngsi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] + "id": "urn:ngsi-ld:Building:barn002", + "type": "Building", + "name": { + "type": "Property", + "lang": "@none", + "value": "The Big Red Barn" + }, + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] } ``` @@ -556,32 +577,31 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:f #### Response: -Since _French_ is not a supported language, and not default alternative is present (as -indicated by the `@none` attribute), another value in the set is returned, in this -case the string in **English** as shown by the `"@lang": "en"` sub-property. -Once again the **Language Property** is returned as an ordinary **Property** and only -the value of the _English_ string is returned. +Since _French_ is not a supported language, and not default alternative is present (as indicated by the `@none` +attribute), another value in the set is returned, in this case the string in **English** as shown by the `"@lang": "en"` +sub-property. Once again the **Language Property** is returned as an ordinary **Property** and only the value of the +_English_ string is returned. ```json { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Building", - "name": { - "type": "Property", - "lang": "en", - "value": "Victory Farm" - }, - "@context": [ - "http://context/ngsi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] + "id": "urn:ngsi-ld:Building:farm001", + "type": "Building", + "name": { + "type": "Property", + "lang": "en", + "value": "Victory Farm" + }, + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] } ``` ### Querying for Multilingual Data -Use the standard Object attribute bracket `[ ]` notation when querying individual languages within `LanguageProperties`. For example, if we want to -obtain the Building whose name is equal to `Big Red Barn` in _English_. +Use the standard Object attribute bracket `[ ]` notation when querying individual languages within `LanguageProperties`. +For example, if we want to obtain the Building whose name is equal to `Big Red Barn` in _English_. #### 9️⃣ Request: @@ -598,28 +618,28 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ ```json [ - { - "id": "urn:ngsi-ld:Building:barn002", - "type": "Building", - "name": { - "type": "LanguageProperty", - "languageMap": { - "@none": "The Big Red Barn", - "en": "Big Red Barn", - "de": "Große Rote Scheune", - "ja": "大きな赤い納屋" - } - }, - "@context": [ - "http://context/ngsi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - } + { + "id": "urn:ngsi-ld:Building:barn002", + "type": "Building", + "name": { + "type": "LanguageProperty", + "languageMap": { + "@none": "The Big Red Barn", + "en": "Big Red Barn", + "de": "Große Rote Scheune", + "ja": "大きな赤い納屋" + } + }, + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] + } ] ``` -Now, I wanted to receive the response but corresponding to `Big Red Barn` in _Any_ language: -Using the Asterisk Syntax `*` to check for data in all available languages. +Now, I wanted to receive the response but corresponding to `Big Red Barn` in _Any_ language: Using the Asterisk Syntax +`*` to check for data in all available languages. #### 1️⃣0️⃣ Request: @@ -636,51 +656,54 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ ```json [ - { - "id": "urn:ngsi-ld:Building:barn002", - "type": "Building", - "name": { - "type": "LanguageProperty", - "languageMap": { - "@none": "The Big Red Barn", - "en": "Big Red Barn", - "de": "Große Rote Scheune", - "ja": "大きな赤い納屋" - } - }, - "@context": [ - "http://context/ngsi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - } + { + "id": "urn:ngsi-ld:Building:barn002", + "type": "Building", + "name": { + "type": "LanguageProperty", + "languageMap": { + "@none": "The Big Red Barn", + "en": "Big Red Barn", + "de": "Große Rote Scheune", + "ja": "大きな赤い納屋" + } + }, + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] + } ] ``` ## Enumerations and using an alternative `@context` -The User's `@context` is a mechanism for mapping URNs and defining the Entities held within -the system It is therefore possible to retrieve _the same -data_ using a different set of short names for the attributes, and in the case of a **VocabularyProperty**, different short names for the values of the attributes themselves. This is particularly useful when dealing with distributed data, federations and data spaces as the end user many not have full control of data held within another participant's context broker. +The User's `@context` is a mechanism for mapping URNs and defining the Entities held within the system It is therefore +possible to retrieve _the same data_ using a different set of short names for the attributes, and in the case of a +**VocabularyProperty**, different short names for the values of the attributes themselves. This is particularly useful +when dealing with distributed data, federations and data spaces as the end user many not have full control of data held +within another participant's context broker. -When the **Building** entities were created, we used an `@context` file called `ngsi-context.jsonld`. -Within the `ngsi-context.jsonld` file, we have already mapped many terms as shown: +When the **Building** entities were created, we used an `@context` file called `ngsi-context.jsonld`. Within the +`ngsi-context.jsonld` file, we have already mapped many terms as shown: ```json { - "@context": { - "type": "@type", - "id": "@id", - "ngsi-ld": "https://uri.etsi.org/ngsi-ld/", - "fiware": "https://uri.fiware.org/ns/dataModels#", - "Building": "fiware:Building", - "barn": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn", - "category": "fiware:category", - "farm": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm" - } + "@context": { + "type": "@type", + "id": "@id", + "ngsi-ld": "https://uri.etsi.org/ngsi-ld/", + "fiware": "https://uri.fiware.org/ns/dataModels#", + "Building": "fiware:Building", + "barn": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn", + "category": "fiware:category", + "farm": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm" + } } ``` -This means that internally the long URIs for the `category` are being used, as can be proven by making a request without adding a User `@context`. +This means that internally the long URIs for the `category` are being used, as can be proven by making a request without +adding a User `@context`. #### 1️⃣1️⃣ Request: @@ -693,40 +716,37 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ #### Response: -As can be seen, two Building entities are returned with the long names for all the attributes, and in the case of a `vocab` for the attribute value as well. -Terms defined in the core context (such as `id`, `type`, `vocab` and `VocabularyProperty`) are not -expanded, as the core context is implied as a default. +As can be seen, two Building entities are returned with the long names for all the attributes, and in the case of a +`vocab` for the attribute value as well. Terms defined in the core context (such as `id`, `type`, `vocab` and +`VocabularyProperty`) are not expanded, as the core context is implied as a default. ```json [ - { - "id": "urn:ngsi-ld:Building:farm001", - "type": "https://uri.fiware.org/ns/dataModels#Building", - "https://uri.fiware.org/ns/dataModels#category": { - "type": "VocabularyProperty", - "vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm" - }, - "@context": [ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - }, - { - "id": "urn:ngsi-ld:Building:barn002", - "type": "https://uri.fiware.org/ns/dataModels#Building", - "https://uri.fiware.org/ns/dataModels#category": { - "type": "VocabularyProperty", - "vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn" + { + "id": "urn:ngsi-ld:Building:farm001", + "type": "https://uri.fiware.org/ns/dataModels#Building", + "https://uri.fiware.org/ns/dataModels#category": { + "type": "VocabularyProperty", + "vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm" + }, + "@context": ["https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"] }, - "@context": [ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - } + { + "id": "urn:ngsi-ld:Building:barn002", + "type": "https://uri.fiware.org/ns/dataModels#Building", + "https://uri.fiware.org/ns/dataModels#category": { + "type": "VocabularyProperty", + "vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn" + }, + "@context": ["https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"] + } ] ``` #### 1️⃣2️⃣ Request: -If the `ngsi-context.jsonld` `@context` is included as a `Link` header in the request, the response will convert all the attribute names to short names, and in the case of a **VocabularyProperty**, use the short names for the value as well. +If the `ngsi-context.jsonld` `@context` is included as a `Link` header in the request, the response will convert all the +attribute names to short names, and in the case of a **VocabularyProperty**, use the short names for the value as well. ```bash curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ @@ -742,30 +762,30 @@ In the response the categories `farm` and `barn` are used. ```json [ - { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Building", - "category": { - "type": "VocabularyProperty", - "vocab": "farm" - }, - "@context": [ - "http://context/ngsi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - }, - { - "id": "urn:ngsi-ld:Building:barn002", - "type": "Building", - "category": { - "type": "VocabularyProperty", - "vocab": "barn" + { + "id": "urn:ngsi-ld:Building:farm001", + "type": "Building", + "category": { + "type": "VocabularyProperty", + "vocab": "farm" + }, + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] }, - "@context": [ - "http://context/ngsi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - } + { + "id": "urn:ngsi-ld:Building:barn002", + "type": "Building", + "category": { + "type": "VocabularyProperty", + "vocab": "barn" + }, + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] + } ] ``` @@ -773,22 +793,24 @@ The `alternate-context.jsonld` `@context` file maps all the terms and enumeratio ```json { - "@context": { - "type": "@type", - "id": "@id", - "ngsi-ld": "https://uri.etsi.org/ngsi-ld/", - "fiware": "https://uri.fiware.org/ns/dataModels#", - "Gebäude": "fiware:Building", - "scheune": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn", - "kategorie": "fiware:category", - "bauernhof": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm" - } + "@context": { + "type": "@type", + "id": "@id", + "ngsi-ld": "https://uri.etsi.org/ngsi-ld/", + "fiware": "https://uri.fiware.org/ns/dataModels#", + "Gebäude": "fiware:Building", + "scheune": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn", + "kategorie": "fiware:category", + "bauernhof": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm" + } } ``` #### 1️⃣3️⃣ Request: -When `alternate-context.jsonld` included as a `Link` header in the request, the response will convert all the attribute names to short names used in `alternate-context.jsonld`, and in the case of a **VocabularyProperty**, return the short names for the value as well. +When `alternate-context.jsonld` included as a `Link` header in the request, the response will convert all the attribute +names to short names used in `alternate-context.jsonld`, and in the case of a **VocabularyProperty**, return the short +names for the value as well. ```bash curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ @@ -800,34 +822,35 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ #### Response: -In the response the category attribute is renamed `kategorie` and the values `bauernhof` and `scheune` are used. The shortname of the Entity `type` has also been amended. +In the response the category attribute is renamed `kategorie` and the values `bauernhof` and `scheune` are used. The +shortname of the Entity `type` has also been amended. ```json [ - { - "id": "urn:ngsi-ld:Building:farm001", - "type": "Gebäude", - "kategorie": { - "type": "VocabularyProperty", - "vocab": "bauernhof" - }, - "@context": [ - "http://context/alternate-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - }, - { - "id": "urn:ngsi-ld:Building:barn002", - "type": "Gebäude", - "kategorie": { - "type": "VocabularyProperty", - "vocab": "scheune" + { + "id": "urn:ngsi-ld:Building:farm001", + "type": "Gebäude", + "kategorie": { + "type": "VocabularyProperty", + "vocab": "bauernhof" + }, + "@context": [ + "http://context/alternate-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] }, - "@context": [ - "http://context/alternate-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - } + { + "id": "urn:ngsi-ld:Building:barn002", + "type": "Gebäude", + "kategorie": { + "type": "VocabularyProperty", + "vocab": "scheune" + }, + "@context": [ + "http://context/alternate-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] + } ] ``` @@ -845,25 +868,27 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:b #### Response: -The simplified response retains the `vocab` attribute (which implies that the right-hand side of the `category` attribute can be re-expanded using JSON-LD `@vocab`) +The simplified response retains the `vocab` attribute (which implies that the right-hand side of the `category` +attribute can be re-expanded using JSON-LD `@vocab`) ```json { - "id": "urn:ngsi-ld:Building:barn002", - "type": "Building", - "category": { - "vocab": "barn" - }, - "@context": [ - "http://context/nsgi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] + "id": "urn:ngsi-ld:Building:barn002", + "type": "Building", + "category": { + "vocab": "barn" + }, + "@context": [ + "http://context/nsgi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] } ``` #### 1️⃣5️⃣ Request: -When querying using the `q` parameter, also include the `expandValues` parameter to indicate which attributes in the query are **VocabularyProperties** +When querying using the `q` parameter, also include the `expandValues` parameter to indicate which attributes in the +query are **VocabularyProperties** ```bash curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ @@ -879,17 +904,17 @@ curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \ ```json [ - { - "id": "urn:ngsi-ld:Building:barn002", - "type": "Building", - "category": { - "type": "VocabularyProperty", - "vocab": "barn" - }, - "@context": [ - "http://context/ngsi-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" - ] - } + { + "id": "urn:ngsi-ld:Building:barn002", + "type": "Building", + "category": { + "type": "VocabularyProperty", + "vocab": "barn" + }, + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ] + } ] ``` diff --git a/docs/index.md b/docs/index.md index 910e1aa..1ac3ad5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -109,6 +109,12 @@ the JSON responses received from the context broker and other FIWARE components. can be found [here](https://www.digitalocean.com/community/tutorials/how-to-transform-json-data-with-jq). `jq-1.6` is recommended. +### Windows Subsystem for Linux + +We will start up our services using a simple bash script. Windows users should download the +[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) to provide a command-line +functionality similar to a Linux distribution on Windows. + ## Context Brokers The NGSI-LD tutorials can be run using any context broker offering the NGSI-LD API, currently the diff --git a/docs/time-series-data.md b/docs/time-series-data.md index 53fdf1b..9b5ad7b 100644 --- a/docs/time-series-data.md +++ b/docs/time-series-data.md @@ -345,8 +345,8 @@ curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \ ### Checking Subscriptions for QuantumLeap -Before anything, check the subscriptions you created in steps 1️⃣ and 2️⃣ are working (i.e., at least one -notification for each was sent). +Before anything, check the subscriptions you created in steps 1️⃣ and 2️⃣ are working (i.e., at least one notification for +each was sent). #### 3 Request: @@ -385,8 +385,8 @@ curl -X GET \ "accept": "application/json", "receiverInfo": [ { - "key": "fiware-service", - "value": "openiot" + "key": "fiware-service", + "value": "openiot" } ] } @@ -411,8 +411,8 @@ curl -X GET \ "accept": "application/json", "receiverInfo": [ { - "key": "fiware-service", - "value": "openiot" + "key": "fiware-service", + "value": "openiot" } ] } diff --git a/docs/understanding-@context.md b/docs/understanding-@context.md index 96357be..b7cb33e 100644 --- a/docs/understanding-@context.md +++ b/docs/understanding-@context.md @@ -159,14 +159,13 @@ resulting `@context` file will be understandable to the widest number of systems > to help generate a rich [`@graph`](https://w3c.github.io/json-ld-syntax/#dfn-graph-object) and more comprehensive > documentation. -> **Caution:** -> The simple NGSI-LD `@context` generator in the tutorial defaults to using `uri.fiware.org` namespaces and updates with -> corrected URIs based on the `x-ngsi.uri` and `x-ngsi.uri-prefix` attributes. The code and defaults found within this -> tutorial should be altered to a more widely recognised standard ontology provider within your domain as necessary for -> your use case. +> **Caution:** The simple NGSI-LD `@context` generator in the tutorial defaults to using `uri.fiware.org` namespaces and +> updates with corrected URIs based on the `x-ngsi.uri` and `x-ngsi.uri-prefix` attributes. The code and defaults found +> within this tutorial should be altered to a more widely recognised standard ontology provider within your domain as +> necessary for your use case. > -> For more complex scenarios, additional `@context` generation tools can be found on -> the [Smart Data Models](https://smartdatamodels.org/) website. +> For more complex scenarios, additional `@context` generation tools can be found on the +> [Smart Data Models](https://smartdatamodels.org/) website. ## Amending Models @@ -361,9 +360,10 @@ FillingLevelSensor: $ref: https://fiware.github.io/tutorials.NGSI-LD/models/saref-terms.yaml#/fillingLevel ``` -4. The list of controlled attributes can be reduced to those measured by Agricultural devices (e.g `depth`, `eatingActivity`, `humidity`, `location`, `milking`, `motion`, - `movementActivity`, `occupancy`, `precipitation`, `pressure`, `soilMoisture`, `solarRadiation`, `temperature`, - `waterConsumption`, `weatherConditions`, `weight`, `windDirection`, `windSpeed`) +4. The list of controlled attributes can be reduced to those measured by Agricultural devices (e.g `depth`, + `eatingActivity`, `humidity`, `location`, `milking`, `motion`, `movementActivity`, `occupancy`, `precipitation`, + `pressure`, `soilMoisture`, `solarRadiation`, `temperature`, `waterConsumption`, `weatherConditions`, `weight`, + `windDirection`, `windSpeed`) 5. The other definitions remain unchanged. diff --git a/docs/working-with-@context.md b/docs/working-with-@context.md index b491b6c..10bd302 100644 --- a/docs/working-with-@context.md +++ b/docs/working-with-@context.md @@ -603,7 +603,7 @@ files explicitly as element in the array of `@context` sent. The response is nor ```json { - "@context": [ + "@context": [ "http://context/ngsi-context.jsonld", "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld" ],