This session consists of two parts. In the first part you will get introduced to NGSI-LD: the basic model/concept behind and basic operations allowing you to start developing applications with the API. In the second part, you will get introduced to the Smart Data Models initiative. Technical Session for Local Experts in Data Sharing (LEBDs)
3. FIWARE in a nutshell
● REST done right
● Standard mapping of HTTP verbs and status codes
● JSON payloads plus some additional structure rules
● Registrations to augment context
● Publish/Subscribe mechanism for asynchronous
processing
2
FIWARE is an open source initiative defining a universal set of
standards for context data management which facilitate the
development of smart solutions.
4. Data/API
Management
Publication
Monetization
Core Context Management
(Context Broker)
Context
Processing, Analysis, Visualization
Interface to IoT, Robotics and
Third Party Systems
Deployment
Tools
Development of
Context-aware
Applications
(STH-Comet, Cygnus,
QuantumLeap, Draco)
Connection to IoT
(IoT Agents, OpenMTC)
Real-time processing of
context events
(Perseo)
Handling
authorization and
access control to APIs
(Keyrock, Wilma,
AuthZForce, APInf )
Publication and
Monetization of
Context Information
(CKAN extensions, Data/API
Biz Framework, IDRA)
Creation of
Application Dashboards
(Wirecloud)
Real-time Processing of
media streams
(Kurento, OpenVidu)
Connection to Robots
(FIROS, Fast DDS,Micro XRCE-DDS)
Big Data
Context Analysis
(Cosmos)
Cloud Edge
(FogFlow)
Documents
Exchange
(Domibus)
NGSI Context Broker
Implementations
(Orion, Orion-LD,
Scorpio, Stellio)
Connection to
External Systems
(Oliot)
5. NGSI v2 already exists, why bother with NGSI-LD?
I like the idea of:
▪ No vendor lock-in
▪ Adding an interoperability layer between processes and the real world
▪ Flexible architectures
• Powered by FIWARE Solutions
• FIWARE Ready Devices
• FIWARE Ready Enablers
• etc.
I’ve already gained those advantages, so what comes next?
4
6. My data is useful to me, but is more powerful shared with others
… but what about Conway's law?
Any organization that designs a system (defined broadly) will produce a design whose
structure is a copy of the organization's communication structure.
— Melvin E. Conway
… how can I share data and benefit from other organizations if their
organization “communicates” differently?
5
8. Linked Data: JSON to JSON-LD
From: https://json-ld.org/
▪ JSON-LD is a lightweight Linked Data format. It is easy for humans to read and write. It is
based on the already successful JSON format and provides a way to help JSON data
interoperate at Web-scale.
▪ Linked Data empowers people that publish and use information on the Web. It is a way to
create a network of standards-based, machine-readable data across Web sites. It allows an
application to start at one piece of Linked Data, and follow embedded links to other pieces of
Linked Data that are hosted on different sites across the Web.
7
{
"@context": "https://json-ld.org/contexts/person.jsonld",
"@id": "http://dbpedia.org/resource/John_Lennon",
"name": "John Lennon",
"born": "1940-10-09",
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
}
12. Linked Data: NGSI v2 to NGSI-LD
From: https://fiware-datamodels.readthedocs.io/en/latest/ngsi-ld_faq/index.html
▪ NGSI-LD is an evolution of the FIWARE NGSI v2 information model, and has been updated/improved to
support linked data (entity relationships), property graphs and semantics (exploiting the capabilities
offered by JSON-LD). This work has been conducted under the ETSI ISG Context Information
Management initiative.
▪ Creating proper machine-readable Linked Data is fundamental to NGSI-LD.
▪ NGSI-LD Payloads are valid JSON-LD
11
{
"@context": [
"https://fiware.github.io/data-models/context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
],
"id": "http://dbpedia.org/resource/John_Lennon",
"type": "Person",
"name": {"type": "Property", "value": "John Lennon"},
"born": {"type": "Property", "value": "1940-10-09"},
"spouse": {"type": "Relationship", "object": "http://dbpedia.org/resource/Cynthia_Lennon" }
}
14. NGSI-LD Properties: Data Model
NGSI v2
▪ Entities
▪ Attributes
▪ MetaData
13
NGSI-LD
▪ Entities
▪ Properties
▪ Relationships
▪ Values
plus …
plus …
etc...
The NGSI LD data model is more
complex; the definitions of use are
more rigid which lead to a
navigable knowledge graph.
▪ Properties of Properties
▪ Properties of Relationships
▪ Relationships of Properties
▪ Relationships of Relationships
. ▪ Properties of Properties of Properties
▪ Relationships of Properties of Properties
▪ Properties of Properties of Relationships
▪ Relationships of Properties of Relationships
▪ Properties of Relationships of Properties
▪ Relationships of Relationships of Properties
▪ Properties of Relationships of Relationships
▪ Relationships of Relationships of Relationships
15. NGSI-LD Properties: Data Model
14
The Entity Example Notes
Has an id urn:ngsi-ld:Building:store001 URI/URN. id must be unique.
Has a type. https://uri.fiware.org/ns/
data-models#Building
● Fully qualified URI of a well defined data model
● Short-hand strings for types, mapped to fully qualified URIs through the JSON-LD
@context.
Has a series of properties name, address, category etc. This can be expanded into http://schema.org/address, which is
known as a fully qualified name (FQN).
Has a series of
properties-of-properties
a verified field for the address This is the equivalent of NGSI v2 metadata
Has a series of relationships managedBy The object corresponds to the URI/URN of another data entity.
Equivalent of NGSI v2 refXXX
Has a series of
properties-of-relationships
managedBy.since Holds additional information about a relationship.
This is the equivalent of metadata about a refXXX property
Has a series of
relationships-of-relationships
managedBy.subordinateTo holds the URI/URN of another relationship.
16. NGSI-LD Properties: Reading Entity Data
NGSI-LD
▪ Response is just a JSON payload plus an @context
▪ @context can be passed either in the Link header
or the payload body:
▪ Accept: application/ld+json to include
the @context as a JSON attribute
▪ Accept: application/json returns plain old
JSON objects - @context is passed as a Link header
▪ Just a minute what has happened to category?
15
curl -G -X GET
'http://localhost:1026/ngsi-ld/v1/entities'
-H 'Link: <https://fiware.github.io/data-models/context.jsonld>;
rel="http://www.w3.org/ns/json-ld#context";
type="application/ld+json"'
-H 'Accept: application/ld+json'
-d 'type=Building'
-d 'options=keyValues'
[
{
"@context": "https://fiware.github.io/data-models/context.jsonld",
"id": "urn:ngsi-ld:Building:store001", "type": "Building",
"address": {
"streetAddress": "Bornholmer Straße 65",
"addressRegion": "Berlin",
"addressLocality": "Prenzlauer Berg",
"postalCode": "10439"
},
"name": "Bösebrücke Einkauf",
"category": [
"https://uri.fiware.org/ns/data-models#commercial"
],
"location": {
"type": "Point", "coordinates": [13.3986, 52.5547]
}
}
]
17. NGSI-LD Properties: What to call a location?
▪ location
▪ locatedAt
▪ geocoordinate
▪ geocoordinates
▪ place
▪ ubicación
▪ standort
▪ 置き場所
16
With NGSI-LD core @context a location is always
https://uri.etsi.org/ngsi-ld/location
NGSI-LD core @context
"@context": {
"ngsi-ld": "https://uri.etsi.org/ngsi-ld/",
"id": "@id",
"type": "@type",
"value": "https://uri.etsi.org/ngsi-ld/hasValue",
"object": {
"@id": "https://uri.etsi.org/ngsi-ld/hasObject",
"@type": "@id"
},
"Property": "https://uri.etsi.org/ngsi-ld/Property"
"Relationship": "https://uri.etsi.org/ngsi-ld/Relationship",
... etc.
"unitCode": "https://uri.etsi.org/ngsi-ld/unitCode",
"location": "https://uri.etsi.org/ngsi-ld/location",
... etc.
}
18. NGSI-LD Properties: @vocab and Enumerated Values
▪ An “address” is:
https://schema.org/address
▪ A “category” is:
https://uri.fiware.org/ns/data-models#category
▪ A category is an enum which takes a
set of values such as:
https://uri.fiware.org/ns/data-models#commercial
https://uri.fiware.org/ns/data-models#office
https://uri.fiware.org/ns/data-models#retail
https://uri.fiware.org/ns/data-models#residential
enum is in progress.
17
FIWARE Data Models @context
"@context": {
"type": "@type",
"id": "@id",
"schema": "https://schema.org/",
"fiware": "https://uri.fiware.org/ns/data-models#",
... etc.
"address": "schema:address",
"category": {
"@id" :"fiware:category",
"@type": "@vocab"
},
"commercial": "fiware:commercial",
"office": "fiware:office",
"retail": "fiware:retail",
"residential": "fiware:residential",
... etc.
}
With NGSI-LD Data Models, attributes and enums are well-defined in a computer-readable fashion
21. Useful links
What is JSON-LD:
https://www.youtube.com/watch?v=vioCbTo3C-4
JSON-LD Core Markup:
https://www.youtube.com/watch?v=UmvWk_TQ30A
Compaction and Expansion:
https://www.youtube.com/watch?v=Tm3fD89dqRE
JSON-LD Playground & examples
https://json-ld.org/playground/
20
22. Linked Context Data: NGSI v2 to NGSI-LD
From: https://fiware-datamodels.readthedocs.io/en/latest/ngsi-ld_faq/index.html
▪ NGSI-LD is an evolution of the FIWARE NGSI v2 information model, and has been updated/improved to
support linked data (entity relationships), property graphs and semantics (exploiting the capabilities
offered by JSON-LD). This work has been conducted under the ETSI ISG Context Information
Management initiative.
▪ Creating proper machine-readable Linked Data is fundamental to NGSI-LD.
▪ NGSI-LD Payloads are valid JSON-LD
21
{
"@context": [
"https://fiware.github.io/data-models/context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
],
"id": "http://dbpedia.org/resource/John_Lennon",
"type": "Person",
"name": {"type": "Property", "value": "John Lennon"},
"born": {"type": "Property", "value": "1940-10-09"},
"spouse": {"type": "Relationship", "object": "http://dbpedia.org/resource/Cynthia_Lennon" }
}
24. NGSI-LD: Evolution not Revolution
NGSI v2
▪ Well defined REST API for context data
using JSON payloads.
GET, POST and other HTTP verbs do
the things you expect
▪ CRUD operations -
/v2/entities endpoint
▪ Augment your context data -
/v2/registrations endpoint
▪ Push context data to other services -
/v2/subscriptions endpoint
23
NGSI-LD
▪ Well defined REST API for context data
using JSON and JSON-LD payloads.
GET, POST and other HTTP verbs do the
things you expect
▪ CRUD operations - /ngsi-
ld/v1/entities endpoint
▪ Augment your context data - /ngsi-
ld/v1/registrations endpoint
▪ Push context data to other services - /ngsi-
ld/v1/subscriptions endpoint
27. NGSI-LD Properties: Data Model
NGSI v2
▪ Entities
▪ Attributes
▪ MetaData
26
NGSI-LD
▪ Entities
▪ Properties
▪ Relationships
▪ Values
plus …
plus …
etc...
The NGSI LD data model is more
complex; the definitions of use are
more rigid which lead to a
navigable knowledge graph.
▪ Properties of Properties
▪ Properties of Relationships
▪ Relationships of Properties
▪ Relationships of Relationships
. ▪ Properties of Properties of Properties
▪ Relationships of Properties of Properties
▪ Properties of Properties of Relationships
▪ Relationships of Properties of Relationships
▪ Properties of Relationships of Properties
▪ Relationships of Relationships of Properties
▪ Properties of Relationships of Relationships
▪ Relationships of Relationships of Relationships
28. NGSI-LD Properties: Data Model
27
The Entity Example Notes
Has an id urn:ngsi-ld:Building:store001 URI/URN. id must be unique.
Has a type. https://uri.fiware.org/ns/
data-models#Building
● Fully qualified URI of a well defined data model
● Short-hand strings for types, mapped to fully qualified URIs through the JSON-LD
@context.
Has a series of properties name, address, category etc. This can be expanded into http://schema.org/address, which is
known as a fully qualified name (FQN).
Has a series of
properties-of-properties
a verified field for the address This is the equivalent of NGSI v2 metadata
Has a series of relationships managedBy The object corresponds to the URI/URN of another data entity.
Equivalent of NGSI v2 refXXX
Has a series of
properties-of-relationships
managedBy.since Holds additional information about a relationship.
This is the equivalent of metadata about a refXXX property
Has a series of
relationships-of-relationships
managedBy.subordinateTo holds the URI/URN of another relationship.
29. NGSI-LD Properties: Reading Entity Data as JSON-LD
NGSI-LD
▪ Response is just a JSON payload plus an @context
▪ @context can be passed either in the Link header
or the payload body:
▪ Accept: application/ld+json to include
the @context as a JSON attribute
▪ Accept: application/json returns plain old
JSON objects - @context is passed as a Link header
28
curl -G -X GET
'http://localhost:1026/ngsi-ld/v1/entities'
-H 'Link: <https://fiware.github.io/data-models/context.jsonld>;
rel="http://www.w3.org/ns/json-ld#context";
type="application/ld+json"'
-H 'Accept: application/ld+json'
-d 'type=Building'
-d 'options=keyValues'
[
{
"@context": "https://fiware.github.io/data-models/context.jsonld",
"id": "urn:ngsi-ld:Building:store001", "type": "Building",
"address": {
"streetAddress": "Bornholmer Straße 65",
"addressRegion": "Berlin",
"addressLocality": "Prenzlauer Berg",
"postalCode": "10439"
},
"name": "Bösebrücke Einkauf",
"category": “commercial",
"location": {
"type": "Point", "coordinates": [13.3986, 52.5547]
}
}
]
30. NGSI-LD Properties: What to call a location?
▪ place ?
▪ locatedAt ?
▪ geocoordinate ?
▪ geocoordinates ?
29
With NGSI-LD core @context a location is always https://uri.etsi.org/ngsi-ld/location
Thereafter, with JSON-LD you may map your preferred short name if necessary
NGSI-LD core @context
"@context": {
"ngsi-ld": "https://uri.etsi.org/ngsi-ld/",
"geojson": "https://purl.org/geojson/vocab#",
"id": "@id",
"type": "@type",
"value": "ngsi-ld:hasValue",
... etc.
"GeoProperty": "ngsi-ld:GeoProperty",
"Point": "geojson:Point",
"coordinates": {
"@container": "@list",
"@id": "geojson:coordinates"
},
"location": "https://uri.etsi.org/ngsi-ld/location",
... etc.
}
▪ ubicación ?
▪ standort ?
▪ 置き場所 ?
▪ location ✓
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [13.3986, 52.5547]}
}
}
31. NGSI-LD Relationships: Traversing Edge Nodes
From: https://www.w3.org/TR/json-ld/#dfn-graph
A JSON-LD document serializes a dataset which is a collection of graphs
A graph is a labeled directed graph, i.e., a set of nodes connected by edges.
In NGSI-LD:
▪ Node = NGSI Entity
▪ Edge = A relationship attribute linking two NGSI Entities
Therefore NGSI Linked Data relies on three separate definitions:
1. A definition that a particular attribute within an NGSI entity really represents a link
2. A machine readable definition of that link in the Data Model (i.e. the @context)
3. A machine readable definition of the set of all types of links available (the @graph)
30
Creating proper machine-readable Linked Data is fundamental to NGSI-LD.
32. NGSI-LD Relationships: 1. Creating Entities
Relationship Links within an NGSI Entity are formally defined using:
"type": "Relationship" OR "@type": "https://uri.etsi.org/ngsi-ld/Relationship"
The attribute of the linked entity is an object rather than a value
31
curl -X POST
http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001/attrs
-H 'Content-Type: application/ld+json'
-H 'fiware-servicepath: /'
-d '{
"stocks": { "type": "Relationship","object": "urn:ngsi-ld:Product:001"},
"numberOfItems": {"type": "Property","value": 50},
"locatedIn" : {
"type": "Relationship", "object": "urn:ngsi-ld:Building:store001",
"requestedBy": {"type": "Relationship","object": "urn:ngsi-ld:Person:bob-the-manager"},
"installedBy": {"type": "Relationship","object": "urn:ngsi-ld:Person:employee001"},
"statusOfWork": {"type": "Property","value": "completed"}
},
"@context": "https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld"
}'
33. NGSI-LD Relationships: 2. Machine Readable Data Models
Relationship links within the @context are formally defined using: "@type": "@id"
32
FIWARE Data Models @context
"@context": {
"tutorial": "https://fiware.github.io/tutorials.Step-by-Step/schema/",
"Product": "tutorial:Product",
"Shelf": "tutorial:Shelf",
...etc
"installedBy": {
"@id": "tutorial:installedBy",
"@type": "@id"
},
"requestedBy": {
"@id": "tutorial:requestedBy",
"@type": "@id"
},
...etc
37. NGSI-LD Registrations: Creating a Registration
NGSI LD
36
curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/csourceRegistrations/'
-H 'Content-Type: application/json'
-H 'Link: <https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld>;
rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
--data-raw ' {
"type": "ContextSourceRegistration",
"information": [
{
"entities": [
{
"type": "Building",
"id": "urn:ngsi-ld:Building:store001"
}
],
"properties": [
"tweets"
]
}
],
"endpoint": "http://context-provider:3000/static/tweets"
}'
Note that properties is defined in the
1.1.1 NGSI-LD core context
In 1.3.1, it is due to be replaced with two
separate attributes - propertyNames and
relationshipNames - this change has
been made in order to offer full
GeoJSON-LD support.
Your context broker may or may not
support the updated core context
39. 38
Context Data as Linked Data - How does it help?
Rich Text Snippets
Standard schema.org/Product data model
marked up as JSON-LD on the web. Interpreted by
third parties. Search Engine can display product
rating on screen. System “knows” if a product is out
of stock.
NGSI-LD Supermarket Tutorial
Third party ARV could “know” when a shelf needs filling and
retrieve goods from the warehouse
No need to reprogram for new customers if data follows the
fiware.org/ns/data-models, or the JSON-LD can be
converted to do so.
41. ■ About:
■ During this part of the session you will get introduced to the Smart Data Models initiative
■ This session will:
■ Explain basics about the Smart Data Models initiative and how it is governed
■ Introduce you to data models for specific verticals that are already available
■ Explain how you may contribute extensions to existing data models under Smart Data Models
■ Explain how you may contribute new data models under Smart Data Models
■ Goals:
■ After this session you will be able to implement a service using a Smart Data Model
■ You will be able to explain how to become an active contributor to the Smart Data Model initiative
■ Target Audience:
■ LEBDs
■ Link to the content
Contents and goals
43. Steering Board :
■ Three members (April-2021)
■ IUDX: Indian Urban Data Exchange
■ Public entity supporting data interchange for Smart cities in India
■ TMForum:
■ Worldwide Telco association
■ FIWARE Foundation
■ Curator of the open source FIWARE platform and its ecosystem
Introduction and Governance
44. Introduction and Governance
▪ A community site with detailed data models available for open use for multiple sectors
▪ Together with other relevant organizations in the curation of the different domains and subjects
▪ Providing coherence and consistency between data models across different domains
▪ To create a method for AGILE standardization and evolution these data models
▪ To provide extended usefulness to FIWARE platform users in terms of:
− Extended interoperability
− Reduced time dedicated to data model codying
− Accumulated experience tested in real case scenarios
− Mapped to be integrated with other platforms
▪ Using open licensing to allow extensive use and adoption
▪ Used in real case scenarios (and based on real use cases)
▪ Based on git platform and github as development frontend
▪ Consensus as main decision method
▪ Based on widely adopted standards (including ontologies and international schemas (i.e. schema.org)
45. 44
By Pieter Brueghel the Elder - bAGKOdJfvfAhYQ at Google
Cultural Institute, zoom level maximum, Public Domain,
https://commons.wikimedia.org/w/index.php?curid=22178101
Differential advantages
1. Agile standardization. Standardization time takes
Weeks vs months/years
2. Easy contribution. One single file source of truth.
3. Based on actual experience. All data models are
based on real case scenario.
4. Multilanguage. Automation translation of specs.
5. 1 change for all domains. Changing a data model
impact on all the domains related to it.
Introduction and Governance
47. ■ What is a Smart Data Model:
■ It is the combination of 3 elements
■ A technical description of the data types and relationships of the attributes of an element
that has to be modeled
■ A documented description of these attributes aligned with the technical description
■ Some examples of the use of the data model
■ Based on real case scenario (not theory or academic research)
■ With an open license allowing its use, share and modification
■ What is NOT a Smart Data Model
■ It is not an ontology describing the elements of an area of knowledge
■ A new standard
■ An academic exercise
Smart Data Models: Structure and contents. Verticals
48. Structure and contents. Verticals
GITHUB
http://github.com/smart-data-models
- Oriented to developers
- All resources available
- Contribution by PR
- Issues on data models
SITE (wp)
http://smartdatamodels.org
- Oriented to end users
- News on updates (subscription)
- Check attributes and enumerations
- Check descriptions
47
49. Structure and contents. Verticals
data-models
Umbrella repo
Smart
Water
Subject
1
(sewage)
Smart
Cities
Smart
Building
Smart
Environment
Smart
Destinations
Smart
Energy
Smart
Manufacturing
Smart
Agrifood
Smart
Robotics
Subject
2
(parking)
Subject
3
(weather)
Subject
4 (...)
DOMAINS
REPOSITORIES
Readme
pointing to the
list of subjects
General info or
shared
resources
DATA-MODELS
- Guides for coding new data models
- Template for new data models and examples
- Directory for scripting tools to check data models
- Inventory of domains and data models
- Inventory of attributes and terms
SUBJECTS’ REPOSITORIES
Readme pointing to the list of data models for the objects
Contributors.md
subject-schema.json
DATA MODELS
README.md
/doc/spec.md
/examples
schema.json
Current Adopters
48
LIFECYCLE MANAGEMENT REPOSITORIES
Incubated Harmonization
50. Structure and contents. Verticals
49
About: 554 data models available. Data Models per domain*:
■ 'SmartEnergy': 414
■ 'SmartCities': 59
■ 'CrossSector': 33
■ 'SmartWater': 22
■ 'SmartAgrifood': 19
■ 'SmartEnvironment': 16
■ 'SmartDestination': 10
■ 'SmartAeronautics': 6
■ 'Smart-Sensoring': 4
■ 'SmartRobotics': 1
*Some subjects are linked to several domains so the # of data models exceeds the actual figure
** ROS data models could mean > 100 data models
Updated 25-4-2021
Last Subjects :
● dataModel.Forestry
● dataModel.SocialMedia,
● dataModel.WasteWater,
● dataModel.OPCUA,
● dataModel.OpenChannelManagement,
● dataModel.QueueManagement
51. Structure and contents. Verticals
50
Incubated repository (They could end up being official data models or not):
Total estimated : 98 (+49)
In domains of:
SmartRobotics 53* (not related to ROS)
SmartCities 12
SmartWater 11
CrossSector 11
Smart-Sensoring 6
Smart Environment 3
SmartAgrifood 1
Cross Sector 5
52. ▪ Services for users
− News, subscription to newsletter, and twitter account @smartdatamodels
− Search data models
− Repositories of data models, quick list.
▪ Services for developers
− Checklist for submitting your new data model
− Create your data model with a spreadsheet
− Create your data model in the incubated repository
− Create a examples compliant with a data model (NGSI-LD)
− Validate if your data model is well documented
− Validate your payload (external)
51
Structure and contents. Verticals
53. 52
Structure and contents. Verticals
■ Contents:
■ doc: directory for specifications
■ examples : Directory for examples
■ ADOPTERS.yaml use cases of the data model
■ LICENSE.md license of the data model. I.e. CC-BY
■ README.md pointer to the main elements of the data
model, including examples, specifications and other
services
■ model.yaml technical description of the attributes for
embedding into the specifications
■ notes.yaml additional file for customization contents
for the specifications
■ schema.json single source of truth of the model.
Validates only the key-values payloads
■ swagger.yaml yaml file required for the interactive
specification and future test of services
■ Mandatory
■ Optional
■ Automatic
55. 54
1
Do you have a
use case?
Exception
management
No
Yes
Is any data
model related?
Yes
Access contribution manual
and draft yor data model
(tool) in your repository
Ask permission to contribute
in the incubated repository
Option 1
Option 2
(recommended)
Pull request on the
incubated repository after
completing the contribution
checklist
Work on the incubated
repository and ask for
support through issues or
mail
Pass the
manual review?
No
Fix the comments
Publication process
2
LEGEND
1: Start new model
2: End new model
3: Start update existing model
3
Create your proposal of
update
Pull request on the official
repository of the data model
3
No
Yes
Pass the
manual review?
Fix the comments
No
Yes
Smart Data Models: Become a contributor.
56. Smart Data Models: Exercise
Turn a data source definition into a data model
57. ■ Expected knowledge from the participants
■ Knowledge of NGSI-v2 and NGSI-LD and their differences
■ Some work with a context broker (any of them)
■ Json and Json schema
■ Git and github concepts
■ A code editor like pycharm
Exercise
56
58. ■ It is required your github users to be written here (http://bit.ly/github_users) to grant you
access to the incubated repository.
■ If you do not have a github user, then go here: http://bit.ly/register_github
■ Use the repository incubated. https://github.com/smart-data-models/incubated/tree/master
■ The final exercise is to submit a complete data model.
■ Complete the creation of an official data model through all its steps.
■ It will be done with official sources, so the result of the exercise, if completed, will become
an official data model of the initiative.
■ Comments to the contribution manual will be incorporated
■ If not completed during session time It can be completed afterwards
Exercise
57
60. Data sources
These data sources have dozens of properties. We’ll only take a few for the exercise.
■ https://www.schema.org/MedicalCondition
■ https://www.schema.org/MedicalGuideline
■ https://www.schema.org/Drug
■ https://www.schema.org/MedicalScholarlyArticle
■ https://www.schema.org/LocalBusiness
■ https://www.schema.org/Organization
■ https://www.schema.org/Restaurant
■ Other available. https://www.schema.org/docs/health-lifesci.home.html
Take a minimum of 5 properties, one an object / array.
Exercise
59
61. Data sources
Other data sources could be valid as well as:
1. It has documented attributes
2. It has clear data types for the attributes
3. It is on use in some real case scenario
Exercise
60
62. ■ Steps:
1. Review the contribution manual
2. Access to the data source
3. Open our spreadsheet
4. Paste the data definitions in the spreadsheet according to the contribution manual.
5. Generate the json schema
6. Validate the json schema
7. Generate the example of payload
8. Validate the example against the schema
9. Submit the new data model
Exercise
61
63. ■ Review the contribution manual
1. Contribution manual is linked in the main page or in https://bit.ly/contribution_manual
Exercise
62
64. ■ Access to the data source. Examples available.
a. https://www.schema.org/MedicalCondition
b. https://www.schema.org/MedicalGuideline
c. https://www.schema.org/Drug
d. https://www.schema.org/MedicalScholarlyArticle
e. https://www.schema.org/LocalBusiness
f. https://www.schema.org/Organization
g. https://www.schema.org/Restaurant
a. https://www.schema.org/docs/health-lifesci.home.html
Exercise
63
65. ■ Open our spreadsheet (need a google drive account)
Exercise
64
66. ■ Paste the data definitions in the spreadsheet according to the contribution manual.
Exercise
65
67. ■ Generate the json schema
■ Fix possible errors
■ Provide more detail / limits
■ Include Units
■ Include Enumerations
■ Include Privacy
■ Include limitations to values
■ Required Properties
Exercise
66
68. ■ Validate the json schema
■ Validation of the json schema
https://www.jsonschemavalidator.net/
■ Validation of the documentation
https://smartdatamodels.org/index.php/da
ta-models-contribution-api/
Exercise
67
69. ■ Generate the normalized example of payload
■ I.e. NGSI-LD is available
■ Needs edit for meaningful data
Exercise
68
70. ■ Generate the key-values of payload
■ Use the script or manually with your code
editor
Exercise
69
71. ■ Validate the payload (keyvalues). https://www.jsonschemavalidator.net/
Exercise
70
72. ■ Fork the incubated repository
■ PR your changes to the data model
They will appear in the front page in 5 minutes maximum (right
column, bottom)
Exercise
71
74. ■ Goal
■ Allow real interoperability between NGSI data sources
■ Contribution:
■ Always possible as long as it has a use case, and comply with contribution workflow
■ Use of the data models
■ Search tools for finding the right data model
■ Best not to reinvent the wheel
■ Differential advantages of agile standardization
■ Quick answer
■ Do not invent
■ Easy contribution
■ Single source of truth
■ Better simple and useful than technically ‘correct’ and powerful
Summary
75. Thank you!
i4Trust has received funding from the European Union’s Horizon 2020
research and innovation programme under the Grant Agreement no 951975.