Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
FIWARE Global Summit - NGSI-LD – an Evolution from NGSIv2
1. This project has received funding from the European Union’s Horizon 2020
research and innovation programme under grant agreements No 731993
and No 814918.
NGSI-LD – an Evolution from NGSIv2
Martin Bauer – NEC Laboratories Europe
2. Outline
§ NGSI-LD background
§ Evolution from NGSIv2 to NGSI-LD
§ Advantages and new features in NGSI-LD
§ Practical steps for migration
§ Comparison of NGSIv2/NGSI-LD operations
§ Conclusions
àNext talk: NEC‘s Scorpio NGSI-LD Broker
àOutlook Orion-LD: next generation NGSI-LD Context Broker
1
3. NGSI-LD background
Making NGSI fit for the future
§ History
§ NGSI Context Interfaces originally specified in OMA
§ Evolution in FIWARE with JSON binding and later NGSIv2
§ Decision: Bring NGSI back to standardization in ETSI Industry Specification Group on
Context Information Management (ETSI ISG CIM)
§ Benefits of independent open standard (i.e. ETSI Group Specification)
§ Standards can be referenced in tenders
§ Avoid “vendor lock-in”
§ Good technical specification to achieve good interoperability
§ Scalability and support of different deployment scenarios
§ Basis for AI and connection to world of linked data and semantics
2
5. All clipart is under Creative Commons BY 4.0 Licence from https://www.svgrepo.com
Advantages and new features in NGSI-LD
Modelling: relationships – from convention to „first-class citizen“
4
Store Store
name: Checker...
address: ...
location: ...
name: Checker
Market
address: ...
location: ...
id: urn:ngsi-ld:Store:001 id: urn:ngsi-ld:Store:001
Customer
id: urn:ngsi-ld:Customer
:285
Customer
id: urn:ngsi-ld:Customer
:285
refVisited: id:
urn:ngsi-
ld:Store:001
name: Paul
name: Paul ...
visited: id: urn:ngsi-ld:Store:001
Attribute
Property
Relationship
• Application‘s may know that the value of an
attribute is the id of another entity, but it
cannot be directly inferred
• Using “ref” as a prefix is a convention that
may help in certain cases, but does not
guarantee the value to refer to an entity
object
• NGSI-LD explicitly introduces the concept of Relationship
• Clear distinction between Properties which have values and
Relationships that have an object pointing to an entity
• No ambiguity and, using JSON-LD, the link is explicit and can
be correctly interpreted by any component, not requiring specific
application knowledge.
Aplication knowledge &
convention
Relationship concept
6. Advantages and new features in NGSI-LD
Modeling: relationships create graphs of entities
5
<buildingA>
<room5>
<occupancy>1
10</...>
asNDAGAINqwq
Ajksajasdfahdsjfk
ASD2348FNA;W
Asdafnasd;fmasd
ASwt5iqwerjsfg43
a foaf:Person ;
foaf:name
"Jimmy Wales" ;
foaf:mbox
<mailto:jwales@
bomis.com> ;
foaf:homepage
<http://www.jim
mywales.com>
<situation id="GU
ID2A22530C-D4
52-4ae8-B942-9
93BC2923D13" v
ersion="1">
<overallSeverity>
high<
/overallSeverity>
"contextRegistration": [
{ "entities": [ { "id": "E1",
"type": "T1",
“ isPattern": "false" },
{ "id": "E2",
"type": "T2", “
isPattern": "false" } ],
link to
video
link to
3D model
speed
location,
speed
location
location
address
owns
livesAt
isAttached
Entity (type, identifier)
Property
Relationship
Advantages of
NGSI-LD Entity Graph
• = knowledge graph
• ~ index structure,
follow relationships
to find relevant entities
• retrieve relevant
subset of entities and
use advanced graph
tools
All clipart is under Creative Commons BY 4.0 Licence from https://www.svgrepo.com
7. Advantages and new features in NGSI-LD
Modeling: @context – uniquely defining entity types
6
Customer Product Store InventoryItem
Customer
Product
Store
InventoryItem
Shelf
https://forge.etsi.org/gitlab/primerContext/StoreOntology/Customer
https://forge.etsi.org/gitlab/primerContext/StoreOntology/Product
https://forge.etsi.org/gitlab/primerContext/StoreOntology/Store
https://forge.etsi.org/gitlab/primerContext/StoreOntology/InventoryItem
https://forge.etsi.org/gitlab/primerContext/StoreOntology/Shelf
relatesTo https://forge.etsi.org/gitlab/primerContext/StoreOntology/relatesTo
name https://forge.etsi.org/gitlab/primerContext/StoreOntology/name
Entity Types, relationships and properties
play an important role in NGSI
hasVisited hasPurchased relatesTo holds
name location address price
Simple Strings
ü human readable
ü short
à convenient
û often not unique
û problem when
sharing
URIs
ü unique
û long
à cumbersome
Compromise?
Best of both?
@context in JSON-LD
• Define unique URIs
• Define mapping of shortnames
to URIs in @context
• Reference @context and use
shortnames for serialization
8. Advantages and new features in NGSI-LD
Modeling: linked data and the world of semantics
§ JSON-LD is JSON for Linked Data – and it is a serialization of RDF
§ Information retrieved via NGSI-LD can be used with semantic tools and combined with
existing linked data
7
The Linked Open Data Cloud from https://lod-cloud.net/
under Creative Commons License
Linked Data
All clipart is under Creative Commons BY 4.0 Licence from https://www.svgrepo.com
9. Advantages and new features in NGSI-LD
Architectures: standardized multi-architecture support
8
Context
Source
Context
Producer
Context
Source
Context
Consumer
Context
Consumer
Context
Consumer
Query
Subscribe/
Notify
Query
Subscribe/
Notify
Discover
Subscribe/
Notify
Discovery
Register
Discover
Subscribe/
Notify
Discovery
Registry
Server
Broker
Context
Producer
Create
Update
Delete
Enables Evolution
of Deployments
à future-proof
Central
Deployment
Distributed
Deployment
Federated
Deployment
10. Advantages and new features in NGSI-LD
History: standardized temporal queries
9
/temporal
/entities
/{entityId}
/attrs
/{attrId}
/{instanceId}
Temporal Operations
• Optional temporal functionality in
NGSI-LD
• Implementation options:
• Separate component
• Integrated with Broker
• Primarily for history, but also
enabling predictions
Get
information
about CarA
Get information
about CarA within
time interval
12. Practical steps for migration
Creating and referencing @context
§ @context is main new element in NGSI-LD as it is based on JSON-LD
§ In NGSI-LD operations the @context can be
a. part of the body (content-type: application/ld+json) or
b. there can be a Link header referencing the @context (content-type: application/json)
Link <http://localhost:9090/ngsi-ld/contextes/urn:ngsi-ld:Store:011>;
rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
§ NGSI-LD core @context: https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld, needs to be
always included (NGSI-LDs own terms)
§ Recommended approach for own @context:
§ Create @context with ALL terms used
§ Make them available on a webserver
§ Reference the @context using Link header
§ Example: For FIWARE data models complete @context is already available:
https://schema.lab.fiware.org/ld/jsonldcontext.jsonld
11
17. Summary migration
§ Migration Steps from NGSIv2 to NGSI-LD:
§ Create suitable JSON-LD @context, ideally containing all relevant terms and make it
available in a location you can link to
§ NGSI v2 entity id attributes have to be converted to URIs, preferably using the NGSI-LD URN
§ Regular entity attributes have to be converted to JSON-LD nodes of type Property.
§ ref attributes (pointing to other entities) have to be converted to JSON-LD nodes of type
Relationship.
§ The timestamp metadata item has to be mapped to the observedAt member of a Property node.
§ The unitCode metadata item has to be mapped to the unitCode member of a Property node.
§ The NGSI v2 DateTime type has to be properly encoded as per the JSON-LD rules.
§ The NGSI v2 geo:json type has to be renamed to GeoProperty.
https://fiware-datamodels.readthedocs.io/en/latest/ngsi-ld_howto/index.html
A python script is available that does the syntactical conversion and can be adpapted
for specific cases:
https://github.com/Fiware/dataModels/blob/master/tools/normalized2LD.py
16
18. Comparison NGSIv2 and NGSI-LD Operations
Operation
Retrieve Entity ü ü
Query (List) Entities (incl. type, idPattern, query, geoquery) ü ü
Create Entity ü ü
Update Entity Attributes ü ü
Append Entity Attributes ü ü
Partial Attribute Update ü ü
Delete (Remove) Entity Attribute ü ü
Delete Entity ü ü
Subscription/Notification ü ü
Context Source Registrations (ü) ü
Batch Entity Operations (Create, Upsert, Update, Delete) ü ü
Temporal Entity Operations (Create, Add, Delete Attribute,
Modify instance, Delete instance, Delete)
ü
17
19. Conclusions
§ NGSI-LD is an evolution of NGSIv2 – it is not a revolution, but there are some changes
§ Overall: in general you can still do what you could do with NGSIv2, in some cases more
§ NGSI-LD is aimed at making NGSI future-proof
§ Standard based on good specification by independent standardization organization
§ Knowledge graph based model – connection to linked data and semantics and basis for AI
§ Support of different deployment architectures
§ Optional temporal API
§ Next Steps
§ Make NGSI-LD Brokers available (next talk on A New NGSI-LD Broker – Features and
Supported Architectures)
§ Evolve other FIWARE GEs to support NGSI-LD
§ Make more NGSI-LD-based data models available with retrievable @context
(already there: FIWARE Data Models, GSMA)
18
20. 19
Orion-LD Status – Next Steps
§ https://github.com/Fiware/context.Orion-LD
§ Alpha Version .- already implemented
§ Create Entity
§ Query / Retrieve Entity(ies) (Basic & Geo)
§ Delete Entity (Attrs)
§ Create Subscription
§ Notification (Basic)
§ Append Attributes
§ Test Suite
§ https://github.com/Fiware/NGSI-LD_TestSuite
§ 130 tests developed. 114 of them passed by Orion-LD
§ Next Steps
§ Add extra tests.
21. Thank you!
http://fiware.org
Follow @FIWARE on Twitter
This project has received funding from the European Union’s Horizon 2020
research and innovation programme under grant agreements No 731993
and No 814918.
Martin Bauer
NEC Laboratories Europe
martin.bauer@neclab.eu