SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
i4Trust Website
i4Trust Community
Connecting to Legacy Systems,
IoT and other Systems
Implementation Specific @context
"fiware": "https://uri.fiware.org/ns/data-models#",
"schema": "https://schema.org/",
"example": "https://example.com/datamodels.html/",
"Building": "fiware:Building",
"Device": "fiware:Device",
"FillingLevelSensor": "example:FillingLevelSensor",
"CowCollar": "example:CowCollar",
"TemperatureSensor": "example:TemperatureSensor",
"Tractor": "example:Tractor",
… etc
"accuracy": "fiware:accuracy",
"batteryLevel": "fiware:batteryLevel",
"category": "fiware:category",
"controlledAsset": "fiware:controlledAsset",
"controlledProperty": "fiware:controlledProperty",
"deviceState": "fiware:deviceState",
"ipAddress": "fiware:ipAddress",
"macAddress": "fiware:macAddress",
"mcc": "fiware:mcc",
"osVersion": "fiware:osVersion",
1
"actuator": "https://w3id.org/saref#actuator",
"filling": "https://w3id.org/saref#fillingLevel",
"temperature": "https://w3id.org/saref#temperature",
"sensor": "https://w3id.org/saref#sensor",
"status": "https://saref.etsi.org/core/status",
"state": "https://saref.etsi.org/core/hasState",
"heartRate":
"https://purl.bioontology.org/ontology/MESH/D006339",
… etc
"myCustomAttr": "example:mycustomAttr",
"secondCustomAttr": "example:2ndCustomAttr"
● Reuse common data models and ontologies
● Add use-case specific mappings where necessary
● Remember to map all entities types, attributes and
metadata attributes
Undefined terms will fallback to the default context
https://uri.etsi.org/ngsi-ld/default-context
Configuring an IoT Agent as NGSI-LD
iot-agent:
image: fiware/iotagent-ul:latest
hostname: iot-agent
container_name: fiware-iot-agent
networks:
- default
expose:
- "4041"
- "7896"
ports:
- "4041:4041"
- "7896:7896"
environment:
- IOTA_CB_HOST=orion
- IOTA_CB_PORT=1026
- IOTA_NORTH_PORT=4041
- IOTA_REGISTRY_TYPE=mongodb
- IOTA_TIMESTAMP=true
- IOTA_AUTOCAST=true
- IOTA_MONGO_HOST=mongo-db
- IOTA_MONGO_PORT=27017
- IOTA_MONGO_DB=iotagentul
- IOTA_HTTP_PORT=7896
- IOTA_PROVIDER_URL=http://iot-agent:4041
- IOTA_CB_NGSI_VERSION=ld
- IOTA_FALLBACK_TENANT=openiot
- IOTA_JSON_LD_CONTEXT=
http://../path/to/ngsi-context.jsonld
2
● Configure using ENV or config.js
Essentials
● IOTA_CB_NGSI_VERSION must be LD
● IOTA_JSON_LD_CONTEXT must point to a
hosted file
Useful
● IOTA_FALLBACK_TENANT if actuations
are required
● IOTA_TIMESTAMP
● IOTA_AUTOCAST
NGSI-LD Measures
▪ The IoT Device is using a known payload syntax
• Ultralight, JSON, SigFox, OPC-UA etc.
▪ The IoT Device sends a reading using the agreed
protocol
• HTTP, MQTT, AMPQ, LoRaWAN etc.
▪ The IoT Agent interprets the payload and
transforms the measure into NGSI-LD
▪ The only interface to the Context Broker is a
simple structured upsert of entities
• potentially including linked entities
3
Measure: “Device X in Building Y has registered 25°C”
curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' 
-H 'Content-Type: application/ld+json' 
-d '[
{
"@context": "http://example.com/context.json-ld",
"id": "urn:ngsi-ld:Device:thermometer1",
"type": "Device"
"temperature": {
"type": "Property",
"value": 25,
“observedAt": "2015-08-05T07:35:01.468Z",
"unitCode": "CEL",
"accuracy":{
"type": "Property", "value": 0.95,
"unitCode": "C62"
}
},
"controlledAsset": {
"type": "Relationship",
"object": "urn:ngsi-ld:Building:building1"
}
}
]'
Provisioning an NGSI-LD Service Group
/iot/services endpoint defines
common elements across groups
of devices
▪ entity_type, attributes and
static_attributes correspond
to a data model found within
the @context file
▪ attributes and static_attributes
may have associated metadata.
▪ types should be defined as:
• Property
• Relationship
• A native JSON type
• A GeoJSON type
5
curl -s -o /dev/null -X POST 
'http://iot-agent:4041/iot/services' 
-H 'Content-Type: application/json' -H 'fiware-service: openiot' 
-d '{
"services": [
{
"apikey": "321701236",
"cbroker": "http://orion:1026",
"entity_type": "Device",
"resource": "/iot/d",
"protocol": "PDI-IoTA-UltraLight",
"transport": "HTTP",
"timezone": "Europe/Berlin",
"attributes": [
{ "object_id": "t", "name":"temperature", "type": "Float",
"metadata": {"unitCode": {"type": "Property","value": "CEL"}}
}
],
"static_attributes": [
{"name": "description",
"type":"Property", "value": "Thermometer"},
{"name": "category", "type":"Property", "value": ["sensor"]},
{"name": "controlledProperty",
"type": "Property", "value": "temperature"},
{"name": "supportedProtocol",
"type": "Property", "value": ["ul20"]}
]
}
]
}'
Provisioning NGSI-LD device
/iot/devices endpoint defines
additional data for an individual device
▪ attributes and static_attributes
can also be defined at the device level
- the standard rules about types apply
▪ Use link on a static_attribute to
update a linked Entity
6
curl -s -o /dev/null -X POST 
'http://iot-agent:4041/iot/devices' 
-H 'Content-Type: application/json' 
-H 'fiware-service: openiot' 
-H 'fiware-servicepath: /' 
-d '{
"devices": [
{
"device_id": "txhme001xxe",
"entity_name": "urn:ngsi-ld:Device:temperature001",
"entity_type": "Device",
"static_attributes": [
{
"name": "controlledAsset",
"type": "Relationship",
"value": "urn:ngsi-ld:Building:001",
"link": {
"attributes": ["temperature"],
"name": "providedBy",
"type": "Building"
}
}
]
}
]
GPS Measure: “GPS X has moved to location x,y”
With location payloads such as:
▪ As Ultralight String
gps|13.3501,52.5143
▪ As Ultralight Multiple attributes
lng|13.3501|lat|52.5143
▪ JSON as string value:
{"gps": "13.3501,52.5143"}
▪ JSON as array value:
{"gps": [13.3501, 52.5143]}
▪ JSON as GeoJSON:
{
"gps": {
"type": "Point",
"coordinates": [13.3501, 52.5143]
}
}
▪ etc...
7
Context Broker receives an NGSI-LD upsert
curl -L -X POST
'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' 
-H 'Content-Type: application/ld+json' 
-d '[
{
"@context": "http://example.com/context.json-ld",
"id": "urn:ngsi-ld:Device:gps1",
"type": "Device"
"location": {
"type": "GeoProperty",
"value": :{
"type": "Point",
"coordinates": [13.3501, 52.5143]
},
“observedAt": "2015-08-05T07:35:01.468Z"
},
"controlledAsset": {
"type": "Relationship",
"object": "urn:ngsi-ld:Tractor:tractor1"
}
}
]'
Provisioning GPS Devices
GPS Provisioning from a single input
▪ Use location as the name of a geolocation attribute
▪ Set type=GeoProperty or any GeoJSON type
▪ Map an attribute object_id to NGSI-LD attribute name
Aliasing Latitude and Longitude as separate inputs
▪ Use location as the name of a geolocation attribute
▪ Set type=GeoProperty or any GeoJSON type
▪ Use expression aliasing to map multiple inputs to a String
▪ Remember GeoJSON uses Lng/Lan format
▪ Will only fire if both latitude and longitude are present in
the payload
All GeoProperty input values are automatically converted into GeoJSON in the NGSI-LD upsert
8
IoT Agent Device Provisioning
{
"object_id": "gps",
"name":"location",
"type": "geo:point"
}
{
"name": "location",
"type": "geo:json",
"expression": "${@lng}, ${@lat}"
}
NGSI-LD Actuations
▪ NGSI-LD actuation code is currently based on
the existing NGSI-v2 IoT Agent paradigm.
▪ Uses registrations and request forwarding
▪ Alternatively uses subscriptions and
notification payloads
▪ Both mechanisms supported by IoT Agents.
Internally syntax may change based on the
decisions of the ETSI committee, but since
the listening mechanism is internal to the
IoT Agent library it will be updated once the
proposed interface is finalized.
9
Command provisioning - via actuation registration:
“I am responsible for Attribute X”
IoT Agent Device Provisioning
10
Context Broker receives a Registration
curl -L -X POST 'http://localhost:4041/iot/devices' 
-H 'fiware-service: openiot' 
-H 'Content-Type: application/json' 
--data-raw '{
"devices": [
{
"device_id": "water001",
"protocol": "PDI-IoTA-UltraLight",
"transport": "HTTP",
"endpoint": "http://device:3001/iot/water001",
"entity_name": "urn:ngsi-ld:Device:water001",
"entity_type": "Device",
"commands": [
{
"name": "on",
"type": "command"
},
{
"name": "off",
"type": "command"
}
]
}
]
}'
curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/csourceRegistrations' 
-H 'NGSILD-Tenant: openiot' 
-H 'Content-Type: application/ld+json' 
-d '{
"@context": "http://context.json-ld",
"endpoint": "http://iotagent.com",
"information": [
{
"entities": [
{
"id": "urn:ngsi-ld:Device:water001",
"type": "Device"
}
],
"properties": [
"on",
"off"
]
}
],
"type": "ContextSourceRegistration"
}
'
Bidirectional attribute provisioning - actuation via subscription:
“Tell me when Attribute X changes”
11
Context Broker sends a Subscription
curl -L -X POST 'http://localhost:4041/iot/devices' 
-H 'fiware-service: openiot' 
-H 'fiware-servicepath: /' 
-H 'Content-Type: application/json' 
--data-raw '{
"devices": [
{
"device_id": "bell002",
"entity_name": "urn:ngsi-ld:Bell:002",
"entity_type": "Bell",
"protocol": "PDI-IoTA-UltraLight",
"transport": "HTTP",
"endpoint": "http://device:3001/iot/bell002",
"attributes": [
{ "name":"ring", "type":"Text",
"expression": "${@ring}",
"reverse": [
{
"object_id":"r", "type": "Text",
"expression": "${@ring}"
}
]
}
]
}
]
}'
{
"id": "urn:ngsi-ld:Notification:5fd0fa684eb81930c97005f3",
"type": "Notification",
"subscriptionId": "urn:ngsi-ld:Subscription:12345",
"notifiedAt": "2020-12-09T16:25:12.193Z",
"data": [
{
"id": "urn:ngsi-ld:Bell:002",
"type": "Bell",
"filling": {
"type": "Property",
"value": “ “,
}
}
]
}
Extending to legacy Systems via Upsert
12
Multiple options exist to architect this:
▪ Amend legacy processing component to use
NGSI directly as well as legacy protocol
▪ Upload a file as CSV via an Agent?
https://www.youtube.com/watch?v=HuEwI8wJKFU
▪ Create a separate chron-job to query legacy
system and upsert as NGSI?
Also consider using a database as an intermediary.
https://www.youtube.com/watch?v=_uLZDGFPlRA
function upsertToMongoDB(building) {
return new Promise((resolve, reject) => {
mongoDB
.upsert(
building.id, building.name,
building.address, building.verified)
.then(() => {
return resolve();
})
.catch((error) => {
return reject(error);
});
});
}
function duplicateBuildings(req, res) {
async function copyEntityData(building) {
await upsertToMongoDB(building);
}
req.body.data.forEach(copyEntityData);
res.status(204).send();
}
Extending to legacy Systems via Registration
“Tell me about X”, “I want to update X”
13
curl -L -X GET
'http://my-legacy-system/ngsi-ld/v1/entities/urn:ngsi-ld
:Building:store001?attrs=tweets' 
-H 'Link: <https://my-context/context.jsonld>;
rel="http://www.w3.org/ns/json-ld#context";
type="application/ld+json"' 
-H 'Content-Type: application/ld+json'
curl -L -X PATCH
'http://my-legacy-system/ngsi-ld/v1/entities/urn:ngsi-ld
:Building:store001/attrs/tweets' 
-H 'Link: <https://my-context/context.jsonld>;
rel="http://www.w3.org/ns/json-ld#context";
type="application/ld+json"' 
-H 'Content-Type: application/json' 
--data-raw '{
"type": "Property",
"value": [
"This must be Thursday",
"I never could get the hang of Thursdays."
]
} '
router.get('/ngsi-ld/v1/entities/:id',
NGSIProxy.getAsNgsiLD
);
router.patch(
'/ngsi-ld/v1/entities/:id/attrs',
NGSIProxy.updateEntity
);
function getAsNgsiLD(req, res) {
const response = doSomething(req);
if (req.headers.accept === 'application/json') {
res.set('Content-Type', 'application/json');
delete response['@context'];
} else {
res.set('Content-Type', 'application/ld+json');
}
res.send(response);
}
Extending to legacy Systems via Subscription
“Inform me about X so I can do something”
14
{
"id":
"urn:ngsi-ld:Notification:5fd0fa684eb81930c97005f3",
"type": "Notification",
"subscriptionId": "urn:ngsi-ld:Subscription:12345",
"notifiedAt": "2020-12-09T16:25:12.193Z",
"data": [
{
"id": "urn:ngsi-ld:Bell:002",
"type": "Bell",
"filling": {
"type": "Property",
"value": “ “,
}
}
]
}
router.post('/subscription/:type', (req, res) => {
_.forEach(req.body.data, (item) => {
doSomething(req, item);
});
res.status(204).send();
});
Useful links
JSON-LD
▪ Website: https://json-ld.org/
▪ Linked Data Video: https://www.youtube.com/watch?v=vioCbTo3C-4
▪ JSON-LD Video: https://www.youtube.com/watch?v=4x_xzT5eF5Q
NGSI-LD
▪ ETSI Specification:
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.03.01_60/gs_cim009v010301p.pdf
▪ NGSI-LD Video: https://www.youtube.com/watch?v=rZ13IyLpAtA
▪ Tutorials: https://ngsi-ld-tutorials.readthedocs.io/
Smart Data Models
▪ Website: http://smartdatamodels.org/
▪ Smart Cities Data Models Video: https://www.youtube.com/watch?v=dfMo0HnaIUQ
15
Thank you!
i4Trust has received funding from the European Union’s Horizon 2020
research and innovation programme under the Grant Agreement no 951975.

Mais conteúdo relacionado

Mais procurados

Real World Application Performance with MongoDB
Real World Application Performance with MongoDBReal World Application Performance with MongoDB
Real World Application Performance with MongoDB
MongoDB
 
Visualizing Mobile Broadband with MongoDB
Visualizing Mobile Broadband with MongoDBVisualizing Mobile Broadband with MongoDB
Visualizing Mobile Broadband with MongoDB
MongoDB
 

Mais procurados (20)

FIWARE Global Summit - NGSI-LD: Modelling, Linking and Utilizing Context Info...
FIWARE Global Summit - NGSI-LD: Modelling, Linking and Utilizing Context Info...FIWARE Global Summit - NGSI-LD: Modelling, Linking and Utilizing Context Info...
FIWARE Global Summit - NGSI-LD: Modelling, Linking and Utilizing Context Info...
 
FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...
FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...
FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...
 
Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Spring Data, Jongo & Co.
Spring Data, Jongo & Co.
 
Implementing and Visualizing Clickstream data with MongoDB
Implementing and Visualizing Clickstream data with MongoDBImplementing and Visualizing Clickstream data with MongoDB
Implementing and Visualizing Clickstream data with MongoDB
 
MongoDB ClickStream and Visualization
MongoDB ClickStream and VisualizationMongoDB ClickStream and Visualization
MongoDB ClickStream and Visualization
 
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
 
Real World Application Performance with MongoDB
Real World Application Performance with MongoDBReal World Application Performance with MongoDB
Real World Application Performance with MongoDB
 
Architecting An Enterprise Storage Platform Using Object Stores
Architecting An Enterprise Storage Platform Using Object StoresArchitecting An Enterprise Storage Platform Using Object Stores
Architecting An Enterprise Storage Platform Using Object Stores
 
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
 
MongoDB + Spring
MongoDB + SpringMongoDB + Spring
MongoDB + Spring
 
Joins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsJoins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation Enhancements
 
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep DiveMongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDBMongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
 
Visualizing Mobile Broadband with MongoDB
Visualizing Mobile Broadband with MongoDBVisualizing Mobile Broadband with MongoDB
Visualizing Mobile Broadband with MongoDB
 
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
MongoDB .local Paris 2020: Les bonnes pratiques pour travailler avec les donn...
 
PistonHead's use of MongoDB for Analytics
PistonHead's use of MongoDB for AnalyticsPistonHead's use of MongoDB for Analytics
PistonHead's use of MongoDB for Analytics
 
Eagle6 Enterprise Situational Awareness
Eagle6 Enterprise Situational AwarenessEagle6 Enterprise Situational Awareness
Eagle6 Enterprise Situational Awareness
 
FIWARE Wednesday Webinars - Architecting Your Smart Solution Powered by FIWARE
FIWARE Wednesday Webinars - Architecting Your Smart Solution Powered by FIWAREFIWARE Wednesday Webinars - Architecting Your Smart Solution Powered by FIWARE
FIWARE Wednesday Webinars - Architecting Your Smart Solution Powered by FIWARE
 
MongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
MongoDB .local Toronto 2019: MongoDB Atlas JumpstartMongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
MongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
 

Semelhante a Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the Trainers Program

Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
FIWARE
 
Building the IOT Platform as a Service
Building the IOT Platform as a ServiceBuilding the IOT Platform as a Service
Building the IOT Platform as a Service
Jesus Rodriguez
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
Fermin Galan
 

Semelhante a Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the Trainers Program (20)

FIWARE Training: Connecting to Legacy Systems, IoT and other Systems
FIWARE Training: Connecting to Legacy Systems, IoT and other SystemsFIWARE Training: Connecting to Legacy Systems, IoT and other Systems
FIWARE Training: Connecting to Legacy Systems, IoT and other Systems
 
Fiware io t_ul20_cpbr8
Fiware io t_ul20_cpbr8Fiware io t_ul20_cpbr8
Fiware io t_ul20_cpbr8
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Towards Interoperability between W3C Web of Things and NGSI-LD
Towards Interoperability between W3C Web of Things and NGSI-LDTowards Interoperability between W3C Web of Things and NGSI-LD
Towards Interoperability between W3C Web of Things and NGSI-LD
 
Fiware IoT Proposal & Community
Fiware IoT Proposal & Community Fiware IoT Proposal & Community
Fiware IoT Proposal & Community
 
NGSI-LD IoT Agents
NGSI-LD IoT AgentsNGSI-LD IoT Agents
NGSI-LD IoT Agents
 
Introduction to FIWARE IoT
Introduction to FIWARE IoTIntroduction to FIWARE IoT
Introduction to FIWARE IoT
 
Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction
 
Building the IOT Platform as a Service
Building the IOT Platform as a ServiceBuilding the IOT Platform as a Service
Building the IOT Platform as a Service
 
(MBL303) Build Mobile Apps for IoT Devices and IoT Apps for Devices
(MBL303) Build Mobile Apps for IoT Devices and IoT Apps for Devices(MBL303) Build Mobile Apps for IoT Devices and IoT Apps for Devices
(MBL303) Build Mobile Apps for IoT Devices and IoT Apps for Devices
 
Anwendungsfaelle für Elasticsearch
Anwendungsfaelle für ElasticsearchAnwendungsfaelle für Elasticsearch
Anwendungsfaelle für Elasticsearch
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
Bending the IoT to your will with JavaScript
Bending the IoT to your will with JavaScriptBending the IoT to your will with JavaScript
Bending the IoT to your will with JavaScript
 
FIWARE Internet of Things
FIWARE Internet of ThingsFIWARE Internet of Things
FIWARE Internet of Things
 
FIWARE Internet of Things
FIWARE Internet of ThingsFIWARE Internet of Things
FIWARE Internet of Things
 
Context Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basicsContext Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basics
 
Orion Context Broker
Orion Context Broker Orion Context Broker
Orion Context Broker
 
Testing API platform with Behat BDD tests
Testing API platform with Behat BDD testsTesting API platform with Behat BDD tests
Testing API platform with Behat BDD tests
 
Canopy unconference preso
Canopy unconference presoCanopy unconference preso
Canopy unconference preso
 

Mais de FIWARE

Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptxCameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
FIWARE
 
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptxBoris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
FIWARE
 
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
FIWARE
 
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdfAbdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
FIWARE
 
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdfFGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
FIWARE
 

Mais de FIWARE (20)

Behm_Herne_NeMo_akt.pptx
Behm_Herne_NeMo_akt.pptxBehm_Herne_NeMo_akt.pptx
Behm_Herne_NeMo_akt.pptx
 
Katharina Hogrebe Herne Digital Days.pdf
 Katharina Hogrebe Herne Digital Days.pdf Katharina Hogrebe Herne Digital Days.pdf
Katharina Hogrebe Herne Digital Days.pdf
 
Christoph Mertens_IDSA_Introduction to Data Spaces.pptx
Christoph Mertens_IDSA_Introduction to Data Spaces.pptxChristoph Mertens_IDSA_Introduction to Data Spaces.pptx
Christoph Mertens_IDSA_Introduction to Data Spaces.pptx
 
Behm_Herne_NeMo.pptx
Behm_Herne_NeMo.pptxBehm_Herne_NeMo.pptx
Behm_Herne_NeMo.pptx
 
Evangelists + iHubs Promo Slides.pptx
Evangelists + iHubs Promo Slides.pptxEvangelists + iHubs Promo Slides.pptx
Evangelists + iHubs Promo Slides.pptx
 
Lukas Künzel Smart City Operating System.pptx
Lukas Künzel Smart City Operating System.pptxLukas Künzel Smart City Operating System.pptx
Lukas Künzel Smart City Operating System.pptx
 
Pierre Golz Der Transformationsprozess im Konzern Stadt.pptx
Pierre Golz Der Transformationsprozess im Konzern Stadt.pptxPierre Golz Der Transformationsprozess im Konzern Stadt.pptx
Pierre Golz Der Transformationsprozess im Konzern Stadt.pptx
 
Dennis Wendland_The i4Trust Collaboration Programme.pptx
Dennis Wendland_The i4Trust Collaboration Programme.pptxDennis Wendland_The i4Trust Collaboration Programme.pptx
Dennis Wendland_The i4Trust Collaboration Programme.pptx
 
Ulrich Ahle_FIWARE.pptx
Ulrich Ahle_FIWARE.pptxUlrich Ahle_FIWARE.pptx
Ulrich Ahle_FIWARE.pptx
 
Aleksandar Vrglevski _FIWARE DACH_OSIH.pptx
Aleksandar Vrglevski _FIWARE DACH_OSIH.pptxAleksandar Vrglevski _FIWARE DACH_OSIH.pptx
Aleksandar Vrglevski _FIWARE DACH_OSIH.pptx
 
Water Quality - Lukas Kuenzel.pdf
Water Quality - Lukas Kuenzel.pdfWater Quality - Lukas Kuenzel.pdf
Water Quality - Lukas Kuenzel.pdf
 
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptxCameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
 
FiWareSummit.msGIS-Data-to-Value.2023.06.12.pptx
FiWareSummit.msGIS-Data-to-Value.2023.06.12.pptxFiWareSummit.msGIS-Data-to-Value.2023.06.12.pptx
FiWareSummit.msGIS-Data-to-Value.2023.06.12.pptx
 
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptxBoris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
 
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
 
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdfAbdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
 
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdfFGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
 
HTAG_Skalierung_Plattform_lokal_final_versand.pptx
HTAG_Skalierung_Plattform_lokal_final_versand.pptxHTAG_Skalierung_Plattform_lokal_final_versand.pptx
HTAG_Skalierung_Plattform_lokal_final_versand.pptx
 
WE_LoRaWAN _ IoT.pptx
WE_LoRaWAN  _ IoT.pptxWE_LoRaWAN  _ IoT.pptx
WE_LoRaWAN _ IoT.pptx
 
EU Opp_Clara Pezuela - German chapter.pptx
EU Opp_Clara Pezuela - German chapter.pptxEU Opp_Clara Pezuela - German chapter.pptx
EU Opp_Clara Pezuela - German chapter.pptx
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the Trainers Program

  • 1. i4Trust Website i4Trust Community Connecting to Legacy Systems, IoT and other Systems
  • 2. Implementation Specific @context "fiware": "https://uri.fiware.org/ns/data-models#", "schema": "https://schema.org/", "example": "https://example.com/datamodels.html/", "Building": "fiware:Building", "Device": "fiware:Device", "FillingLevelSensor": "example:FillingLevelSensor", "CowCollar": "example:CowCollar", "TemperatureSensor": "example:TemperatureSensor", "Tractor": "example:Tractor", … etc "accuracy": "fiware:accuracy", "batteryLevel": "fiware:batteryLevel", "category": "fiware:category", "controlledAsset": "fiware:controlledAsset", "controlledProperty": "fiware:controlledProperty", "deviceState": "fiware:deviceState", "ipAddress": "fiware:ipAddress", "macAddress": "fiware:macAddress", "mcc": "fiware:mcc", "osVersion": "fiware:osVersion", 1 "actuator": "https://w3id.org/saref#actuator", "filling": "https://w3id.org/saref#fillingLevel", "temperature": "https://w3id.org/saref#temperature", "sensor": "https://w3id.org/saref#sensor", "status": "https://saref.etsi.org/core/status", "state": "https://saref.etsi.org/core/hasState", "heartRate": "https://purl.bioontology.org/ontology/MESH/D006339", … etc "myCustomAttr": "example:mycustomAttr", "secondCustomAttr": "example:2ndCustomAttr" ● Reuse common data models and ontologies ● Add use-case specific mappings where necessary ● Remember to map all entities types, attributes and metadata attributes Undefined terms will fallback to the default context https://uri.etsi.org/ngsi-ld/default-context
  • 3. Configuring an IoT Agent as NGSI-LD iot-agent: image: fiware/iotagent-ul:latest hostname: iot-agent container_name: fiware-iot-agent networks: - default expose: - "4041" - "7896" ports: - "4041:4041" - "7896:7896" environment: - IOTA_CB_HOST=orion - IOTA_CB_PORT=1026 - IOTA_NORTH_PORT=4041 - IOTA_REGISTRY_TYPE=mongodb - IOTA_TIMESTAMP=true - IOTA_AUTOCAST=true - IOTA_MONGO_HOST=mongo-db - IOTA_MONGO_PORT=27017 - IOTA_MONGO_DB=iotagentul - IOTA_HTTP_PORT=7896 - IOTA_PROVIDER_URL=http://iot-agent:4041 - IOTA_CB_NGSI_VERSION=ld - IOTA_FALLBACK_TENANT=openiot - IOTA_JSON_LD_CONTEXT= http://../path/to/ngsi-context.jsonld 2 ● Configure using ENV or config.js Essentials ● IOTA_CB_NGSI_VERSION must be LD ● IOTA_JSON_LD_CONTEXT must point to a hosted file Useful ● IOTA_FALLBACK_TENANT if actuations are required ● IOTA_TIMESTAMP ● IOTA_AUTOCAST
  • 4. NGSI-LD Measures ▪ The IoT Device is using a known payload syntax • Ultralight, JSON, SigFox, OPC-UA etc. ▪ The IoT Device sends a reading using the agreed protocol • HTTP, MQTT, AMPQ, LoRaWAN etc. ▪ The IoT Agent interprets the payload and transforms the measure into NGSI-LD ▪ The only interface to the Context Broker is a simple structured upsert of entities • potentially including linked entities 3
  • 5. Measure: “Device X in Building Y has registered 25°C” curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' -H 'Content-Type: application/ld+json' -d '[ { "@context": "http://example.com/context.json-ld", "id": "urn:ngsi-ld:Device:thermometer1", "type": "Device" "temperature": { "type": "Property", "value": 25, “observedAt": "2015-08-05T07:35:01.468Z", "unitCode": "CEL", "accuracy":{ "type": "Property", "value": 0.95, "unitCode": "C62" } }, "controlledAsset": { "type": "Relationship", "object": "urn:ngsi-ld:Building:building1" } } ]'
  • 6. Provisioning an NGSI-LD Service Group /iot/services endpoint defines common elements across groups of devices ▪ entity_type, attributes and static_attributes correspond to a data model found within the @context file ▪ attributes and static_attributes may have associated metadata. ▪ types should be defined as: • Property • Relationship • A native JSON type • A GeoJSON type 5 curl -s -o /dev/null -X POST 'http://iot-agent:4041/iot/services' -H 'Content-Type: application/json' -H 'fiware-service: openiot' -d '{ "services": [ { "apikey": "321701236", "cbroker": "http://orion:1026", "entity_type": "Device", "resource": "/iot/d", "protocol": "PDI-IoTA-UltraLight", "transport": "HTTP", "timezone": "Europe/Berlin", "attributes": [ { "object_id": "t", "name":"temperature", "type": "Float", "metadata": {"unitCode": {"type": "Property","value": "CEL"}} } ], "static_attributes": [ {"name": "description", "type":"Property", "value": "Thermometer"}, {"name": "category", "type":"Property", "value": ["sensor"]}, {"name": "controlledProperty", "type": "Property", "value": "temperature"}, {"name": "supportedProtocol", "type": "Property", "value": ["ul20"]} ] } ] }'
  • 7. Provisioning NGSI-LD device /iot/devices endpoint defines additional data for an individual device ▪ attributes and static_attributes can also be defined at the device level - the standard rules about types apply ▪ Use link on a static_attribute to update a linked Entity 6 curl -s -o /dev/null -X POST 'http://iot-agent:4041/iot/devices' -H 'Content-Type: application/json' -H 'fiware-service: openiot' -H 'fiware-servicepath: /' -d '{ "devices": [ { "device_id": "txhme001xxe", "entity_name": "urn:ngsi-ld:Device:temperature001", "entity_type": "Device", "static_attributes": [ { "name": "controlledAsset", "type": "Relationship", "value": "urn:ngsi-ld:Building:001", "link": { "attributes": ["temperature"], "name": "providedBy", "type": "Building" } } ] } ]
  • 8. GPS Measure: “GPS X has moved to location x,y” With location payloads such as: ▪ As Ultralight String gps|13.3501,52.5143 ▪ As Ultralight Multiple attributes lng|13.3501|lat|52.5143 ▪ JSON as string value: {"gps": "13.3501,52.5143"} ▪ JSON as array value: {"gps": [13.3501, 52.5143]} ▪ JSON as GeoJSON: { "gps": { "type": "Point", "coordinates": [13.3501, 52.5143] } } ▪ etc... 7 Context Broker receives an NGSI-LD upsert curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' -H 'Content-Type: application/ld+json' -d '[ { "@context": "http://example.com/context.json-ld", "id": "urn:ngsi-ld:Device:gps1", "type": "Device" "location": { "type": "GeoProperty", "value": :{ "type": "Point", "coordinates": [13.3501, 52.5143] }, “observedAt": "2015-08-05T07:35:01.468Z" }, "controlledAsset": { "type": "Relationship", "object": "urn:ngsi-ld:Tractor:tractor1" } } ]'
  • 9. Provisioning GPS Devices GPS Provisioning from a single input ▪ Use location as the name of a geolocation attribute ▪ Set type=GeoProperty or any GeoJSON type ▪ Map an attribute object_id to NGSI-LD attribute name Aliasing Latitude and Longitude as separate inputs ▪ Use location as the name of a geolocation attribute ▪ Set type=GeoProperty or any GeoJSON type ▪ Use expression aliasing to map multiple inputs to a String ▪ Remember GeoJSON uses Lng/Lan format ▪ Will only fire if both latitude and longitude are present in the payload All GeoProperty input values are automatically converted into GeoJSON in the NGSI-LD upsert 8 IoT Agent Device Provisioning { "object_id": "gps", "name":"location", "type": "geo:point" } { "name": "location", "type": "geo:json", "expression": "${@lng}, ${@lat}" }
  • 10. NGSI-LD Actuations ▪ NGSI-LD actuation code is currently based on the existing NGSI-v2 IoT Agent paradigm. ▪ Uses registrations and request forwarding ▪ Alternatively uses subscriptions and notification payloads ▪ Both mechanisms supported by IoT Agents. Internally syntax may change based on the decisions of the ETSI committee, but since the listening mechanism is internal to the IoT Agent library it will be updated once the proposed interface is finalized. 9
  • 11. Command provisioning - via actuation registration: “I am responsible for Attribute X” IoT Agent Device Provisioning 10 Context Broker receives a Registration curl -L -X POST 'http://localhost:4041/iot/devices' -H 'fiware-service: openiot' -H 'Content-Type: application/json' --data-raw '{ "devices": [ { "device_id": "water001", "protocol": "PDI-IoTA-UltraLight", "transport": "HTTP", "endpoint": "http://device:3001/iot/water001", "entity_name": "urn:ngsi-ld:Device:water001", "entity_type": "Device", "commands": [ { "name": "on", "type": "command" }, { "name": "off", "type": "command" } ] } ] }' curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/csourceRegistrations' -H 'NGSILD-Tenant: openiot' -H 'Content-Type: application/ld+json' -d '{ "@context": "http://context.json-ld", "endpoint": "http://iotagent.com", "information": [ { "entities": [ { "id": "urn:ngsi-ld:Device:water001", "type": "Device" } ], "properties": [ "on", "off" ] } ], "type": "ContextSourceRegistration" } '
  • 12. Bidirectional attribute provisioning - actuation via subscription: “Tell me when Attribute X changes” 11 Context Broker sends a Subscription curl -L -X POST 'http://localhost:4041/iot/devices' -H 'fiware-service: openiot' -H 'fiware-servicepath: /' -H 'Content-Type: application/json' --data-raw '{ "devices": [ { "device_id": "bell002", "entity_name": "urn:ngsi-ld:Bell:002", "entity_type": "Bell", "protocol": "PDI-IoTA-UltraLight", "transport": "HTTP", "endpoint": "http://device:3001/iot/bell002", "attributes": [ { "name":"ring", "type":"Text", "expression": "${@ring}", "reverse": [ { "object_id":"r", "type": "Text", "expression": "${@ring}" } ] } ] } ] }' { "id": "urn:ngsi-ld:Notification:5fd0fa684eb81930c97005f3", "type": "Notification", "subscriptionId": "urn:ngsi-ld:Subscription:12345", "notifiedAt": "2020-12-09T16:25:12.193Z", "data": [ { "id": "urn:ngsi-ld:Bell:002", "type": "Bell", "filling": { "type": "Property", "value": “ “, } } ] }
  • 13. Extending to legacy Systems via Upsert 12 Multiple options exist to architect this: ▪ Amend legacy processing component to use NGSI directly as well as legacy protocol ▪ Upload a file as CSV via an Agent? https://www.youtube.com/watch?v=HuEwI8wJKFU ▪ Create a separate chron-job to query legacy system and upsert as NGSI? Also consider using a database as an intermediary. https://www.youtube.com/watch?v=_uLZDGFPlRA function upsertToMongoDB(building) { return new Promise((resolve, reject) => { mongoDB .upsert( building.id, building.name, building.address, building.verified) .then(() => { return resolve(); }) .catch((error) => { return reject(error); }); }); } function duplicateBuildings(req, res) { async function copyEntityData(building) { await upsertToMongoDB(building); } req.body.data.forEach(copyEntityData); res.status(204).send(); }
  • 14. Extending to legacy Systems via Registration “Tell me about X”, “I want to update X” 13 curl -L -X GET 'http://my-legacy-system/ngsi-ld/v1/entities/urn:ngsi-ld :Building:store001?attrs=tweets' -H 'Link: <https://my-context/context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' -H 'Content-Type: application/ld+json' curl -L -X PATCH 'http://my-legacy-system/ngsi-ld/v1/entities/urn:ngsi-ld :Building:store001/attrs/tweets' -H 'Link: <https://my-context/context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' -H 'Content-Type: application/json' --data-raw '{ "type": "Property", "value": [ "This must be Thursday", "I never could get the hang of Thursdays." ] } ' router.get('/ngsi-ld/v1/entities/:id', NGSIProxy.getAsNgsiLD ); router.patch( '/ngsi-ld/v1/entities/:id/attrs', NGSIProxy.updateEntity ); function getAsNgsiLD(req, res) { const response = doSomething(req); if (req.headers.accept === 'application/json') { res.set('Content-Type', 'application/json'); delete response['@context']; } else { res.set('Content-Type', 'application/ld+json'); } res.send(response); }
  • 15. Extending to legacy Systems via Subscription “Inform me about X so I can do something” 14 { "id": "urn:ngsi-ld:Notification:5fd0fa684eb81930c97005f3", "type": "Notification", "subscriptionId": "urn:ngsi-ld:Subscription:12345", "notifiedAt": "2020-12-09T16:25:12.193Z", "data": [ { "id": "urn:ngsi-ld:Bell:002", "type": "Bell", "filling": { "type": "Property", "value": “ “, } } ] } router.post('/subscription/:type', (req, res) => { _.forEach(req.body.data, (item) => { doSomething(req, item); }); res.status(204).send(); });
  • 16. Useful links JSON-LD ▪ Website: https://json-ld.org/ ▪ Linked Data Video: https://www.youtube.com/watch?v=vioCbTo3C-4 ▪ JSON-LD Video: https://www.youtube.com/watch?v=4x_xzT5eF5Q NGSI-LD ▪ ETSI Specification: https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.03.01_60/gs_cim009v010301p.pdf ▪ NGSI-LD Video: https://www.youtube.com/watch?v=rZ13IyLpAtA ▪ Tutorials: https://ngsi-ld-tutorials.readthedocs.io/ Smart Data Models ▪ Website: http://smartdatamodels.org/ ▪ Smart Cities Data Models Video: https://www.youtube.com/watch?v=dfMo0HnaIUQ 15
  • 17. Thank you! i4Trust has received funding from the European Union’s Horizon 2020 research and innovation programme under the Grant Agreement no 951975.