FIWARE Smart Data Models
FIWARE Smart Data Models
1
1
Information Model (as UML) – NGSI-LD
2
Information Model - Highlights
NGSI Entity Physical or virtual object.
It has (one) Entity Type.
Uniquely identified by an Entity Id (URI, mandatory in NGSI-LD)
Entity has zero or more attributes identified by a name
Property --> Static or dynamic intrinsic characteristic of an Entity
GeoProperty (geospatial context)
Relationship Association with a Linked entity (unidirectional)
Properties have a value. An NGSI value can be
single value (Number, String, boolean, DateTime).
null is not allowed in NGSI-LD and not recommended.
complex (Array, Structured Value)
Smart City
5
Smart City Data Model
6
Classical JSON Representation (a.k.a. NGSIv2)
{
"id": "urn:ngsi-ld:OffStreetParking:Downtown1",
"type": "OffStreetParking",
{ "availableSpotNumber": {
"id": "urn:ngsi-ld:Vehicle:A4567", "type": "Property",
"type": "Vehicle", "value": 121,
"brandName": { "metadata" : {
”timestamp": {
"type": "Property", "value" : "2017-07-29T12:00:04Z",
"value": "Mercedes" "type" : "DateTime"
}, },
"isParked": { "reliability": {
"type": "Relationship", "type" : "Property",
"value": "urn:ngsi-ld:OffStreetParking:Downtown1", "value" : 0.7
},
"metadata": { "providedBy": {
”timestamp": { "type" : "Relationship",
"value" : "2017-07-29T12:00:04Z", "value" : "urn:ngsi-ld:Camera:C1"
"type" : "DateTime" }
}, }
"providedBy": { },
"location": {
"type" : "Relationship", "type": "geo:json",
"value" : "urn:ngsi-ld:Person:Bob" "value": {
} "type": "Point",
} "coordinates": [-8.5, 41.2]
} }
} }
}
7
JSON-LD (RDF friendly) representation (a.k.a. NGSI-LD)
{
"id": "urn:ngsi-ld:OffStreetParking:Downtown1",
"type": "OffStreetParking",
{ "availableSpotNumber": {
"id": "urn:ngsi-ld:Vehicle:A4567", "type": "Property",
"type": "Vehicle", "value": 121,
"brandName": { "observedAt": "2017-07-29T12:05:02Z",
"type": "Property", "reliability": {
"value": "Mercedes" "type": "Property",
}, "value": 0.7
"isParked": { },
"type": "Relationship", "providedBy": {
"object": "urn:ngsi-ld:OffStreetParking:Downtown1", "type": "Relationship",
"observedAt": "2017-07-29T12:00:04Z", "object": "urn:ngsi-ld:Camera:C1"
"providedBy": { }
"type": "Relationship", },
"object": "urn:ngsi-ld:Person:Bob" "location": {
} "type": "GeoProperty",
}, "value": {
"@context": [ "type": "Point",
"https://uri.etsi.org/ngsi-ld/v1/", "coordinates": [-8.5, 41.2]
"https://schema.lab.fiware.org/ld/context/" }
] },
} "@context": [
"https://uri.etsi.org/ngsi-ld/v1/",
"https://schema.lab.fiware.org/ld/context/"
]
8 }
Simplified representation (keyValues)
{
"id": "urn:ngsi-ld:OffStreetParking:Downtown1",
"type": "OffStreetParking",
"name": "Downtown One",
"availableSpotNumber": 121,
"totalSpotNumber": 200,
"location": {
"type": "Point",
"coordinates": [-8.5, 41.2]
},
"@context": [
"https://uri.etsi.org/ngsi-ld/v1/",
"https://schema.lab.fiware.org/ld/context/"
]
}
9
Case of Study 2
Smart Agrifood
10
Data Model: Smart Agrifood
11
Classical JSON Representation (a.k.a. NGSIv2)
{ {
"id": "urn:ngsi-ld:Tractor:A4567", "id": "urn:ngsi-ld:AgriParcel:A456",
"type": ”Tractor", "type": ”AgriParcel",
"brandName": { "location": {
"type": "Property", "type" : "geo:json" {
"value" : {
"value": ”John Deere"
"type": "Polygon",
}, "coordinates": [
"speed": { [
type": "Property" 100,
"value": 12, 0
"metadata": { ],
[
”timestamp": {
101,
"value" : "2017-07-29T12:00:04Z", 0
"type" : "DateTime" ],
} [
} 101,
}, 1
],
"isLabouring": {
[
"type": "Relationship", 100,
"value": "urn:ngsi-ld:AgriParcel:A456", 1
"metadata": { ],
"startedAt": { [
"value" : "2017-07-29T12:00:04Z", 100,
0
"type" : "DateTime"
]
} ] }
} }
} } 12
}
JSON-LD (RDF friendly) representation (a.k.a. NGSI-LD)
{
"id": "urn:ngsi-ld:AgriParcel:A456",
{ "type": "AgriParcel",
"id": "urn:ngsi-ld:Tractor:A4567", "location": {
"type" : "GeoProperty" {
"type": ”Tractor", "value" : {
"brandName": { "type": "Polygon",
"type": "Property", "coordinates": [
"value": "Mercedes" [
100,
}, 0
"speed" : { ],
"type": "Property", [
101,
"value": 12,
0
"observedAt": "2017-07-29T12:01:32Z" ],
}, [
"isLabouring": { 101,
1
"type": "Relationship", ],
"object": "urn:ngsi-ld:AgriParcel:A456", [
”startedAt": { 100,
"type": "Property", 1
],
"value": "2017-07-29T12:00:04Z" [
} 100,
}, 0
]
"@context": [
] }
"https://uri.etsi.org/ngsi-ld/v1/", },
"https://schema.lab.fiware.org/ld/context/" "@context": [
] "https://uri.etsi.org/ngsi-ld/v1/",
"https://schema.lab.fiware.org/ld/context/"
} ]
13 }
Simplified representation (keyValues)
{
"id": "urn:ngsi-ld:Tractor:A4567",
"type": ”Tractor",
”brandName": ”John Deere",
”speed": 12,
”isLabouring": ”urn:ngsi-ld:AgriParcel:A456",
"@context": [
"https://uri.etsi.org/ngsi-ld/v1/",
"https://schema.lab.fiware.org/ld/context/"
]
}
14
FIWARE Data Models
1
5
FIWARE Data Models
16
References
NGSI-LD FAQ
https://github.com/FIWARE/dataModels/blob/master/specs/ngsi-ld_faq.md
NGSI-LD HowTo
https://github.com/FIWARE/dataModels/blob/master/specs/ngsi-ld_howto.md
17
Thank you!
http://fiware.org
Follow @FIWARE on Twitter