Skip to content

FIWARE/tutorials.NGSI-LD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Farm Tutorials

Documentation License: MIT Support badge Docker badge
Documentation CI

This is a collection of tutorials for the FIWARE ecosystem designed for NGSI-LD developers. Each tutorial consists of a series of exercises to demonstrate the correct use of individual FIWARE components and shows the flow of context data within a simple Smart Solution either by connecting to a series of dummy IoT devices or manipulating the context directly or programmatically.

📚
NGSI-LD
Documentation

Postman
Collections
Docker Hub
Quay.io
Artifact Hub

developer.​fiware.org

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

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

Data models

The tutorials define a series of data-models to be used within the @context. More information about the classes and attributes used can be found in the following:

Install

To download the full set of tutorials, simply clone this repository:

git clone https://github.com/FIWARE/tutorials.NGSI-LD.git
cd tutorials.NGSI-LD/
git submodule update --init --recursive

Swagger

The OpenAPI Specification (commonly known as Swagger) is an API description format for REST APIs. A Swagger spec allows you to describe an entire API (such as NGSI-LD itself) however in this tutorial we shall be concentrating on using Swagger to define data models.

API specifications can be written in YAML or JSON. The format is easy to learn and readable to both humans and machines. The complete OpenAPI Specification can be found on GitHub: OpenAPI 3.0 Specification. This is important since we will need a well-defined structure to be able to generate @context files.

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 or WSL set-up can be used when facing issues.

Each tutorial runs all components using Docker. Docker is a container technology which allows to different components isolated into their respective environments.

  • To install Docker on Windows follow the instructions here.
  • To install Docker on Mac follow the instructions here.
  • To install Docker on Linux follow the instructions here.

Docker Compose is a tool for defining and running multi-container Docker applications. A series of *.yaml files are used configure the required services for the application. This means all container services can be brought up in a single command. Docker Compose is installed by default as part of Docker for Windows and Docker for Mac, however Linux users will need to follow the instructions found here.

You can check your current Docker and Docker Compose versions using the following commands:

docker-compose -v
docker version

Please ensure that you are using Docker version 24.0.x or higher and Docker Compose 2.24.x or higher and upgrade if necessary.

Although not officially supported, older versions of docker without an integrated docker-compose can be run by adding legacy to all bash script commands:

./services start legacy

Postman

The tutorials which use HTTP requests supply a collection for use with the Postman utility. Postman is a testing framework for REST APIs. The tool can be downloaded from www.postman.com. All the FIWARE Postman collections can be downloaded directly from the Postman API network.

GitPod

Gitpod is an open-source Kubernetes application for ready-to-code cloud 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 to provide a command-line functionality similar to a Linux distribution on Windows.

Tutorials List

Core Context Management: NGSI-LD Fundamentals

  101. Understanding @context
  102. Working with @context
  103. CRUD Operations
  104. Concise Payloads
  105. Merge-Patch and Put
  106. Entity Relationships
  107. Subscriptions
  108. Temporal Operations
  109. Extended Properties

Internet of Things, Robots and third-party systems

  201. Introduction to IoT Sensors
  202. Provisioning the Ultralight IoT Agent
  203. Provisioning the JSON IoT Agent

Core Context Management: Manipulating Context Data and Persisting Historic Data

  304. Querying Time Series Data (QuantumLeap)
  305. Big Data Analysis (Flink)
  306. Big Data Analysis (Spark)

Security: Identity Management

  401. Managing Users and Organizations
  402. Roles and Permissions

Processing, Analysis and Visualization

  507. Cloud-Edge Computing

Integrating NGSI-v2 Systems:

  601. Federative Data Spaces

Usage

Most tutorials supply a services script to start the containers:

cd <tutorial-name>
git checkout NGSI-LD
./services start

Following the tutorial exercises via Postman

Each tutorial submodule contains one or more docker-compose.yml files, along with a Postman collection containing the necessary HTTP requests: import the collection into Postman and follow the instructions.

Following the tutorial exercises from the command-line

Each submodule contains full instructions in README which details the appropriate bash commands (cUrl and Docker Compose) to run.

Full instructions can be found within the documentation


License

MIT © 2020-2024 FIWARE Foundation e.V.