SlideShare uma empresa Scribd logo
1 de 44
Context Information Management with
FIWARE
José Manuel Cantera Fonseca (@jmcantera)
Senior Expert - Technical Lead & Architect
FIWARE Foundation e.V.
May 2018 (Aligned with ETSI ISG CIM)
Introduction
1
2
Digitization is starting to gravitate around context information.
Information and its context which describes what is going on,
where, when, why …
3
Tractor
• Location
• Speed
• Direction
Crop
• Humidity
• Leaf area
• Age
Drone
• Location
• Battery level
• Speed
• Direction
… but also
in Agrifood
… not only in
cities
4
Tanker
• Driver
• Location
• Max Volume
• Current Level
• Speed
• Direction
Gas Tank
• Station
• Max Volume
• Current Level
• Min Threshold
• Temperature
Station
• Location
• Owner
• SLA
… but also
in Industry /
Energy
… not only in
cities
FIWARE: Driving the standard for Context Information Management
§ FIWARE NGSI is a simple yet powerful open, royalty-free standard API for Context
Information Management à Published as ETSI Specification
§ A RESTful API using JSON so any web/backend developer gets quickly used to it
§ Yet powerful: FIWARE NGSI supports geo-queries and Linked Data (JSON-LD)
5
Application/Service
Bus
• Location
• No. passengers
• Driver
• Licence plate
Parking
• name
• totalSpotNumber
• availableSpotNumber
• location
• floorNumber
Shop
• Location
• Business name
• Franchise
• Offerings
Context Information
FIWARE NGSI API
Context Information might come from
different sources not only IoT
Architectures
6
7
Context Information Management Architectures (I)
Centralized Distributed
8
Context Information Management Architectures (II)
Federated
Information Model
9
10
Information Model (as UML)
11
Information Model - Highlights
§ NGSI Entity à Physical or virtual object.
§ It has (one) Entity Type.
§ Uniquely identified by an Entity Id (URI)
§ Entity has zero or more attributes identified by a name
§ Property --> Static or dynamic characteristic of an entity
§ GeoProperty (geospatial context)
§ TemporalProperty (time context)
§ Relationship à Association with a Linked entity (unidirectional)
§ Properties have a value
§ An NGSI value can be a single value (Number, String, boolean), or complex (Array, Structured
Value)
§ Relationships have an object
§ A URI which points to another entity (target of the relationship). Target can be a collection.
12
Information Model – Highlights (II)
§ Cross-Domain, core properties for giving context to your information
§ location à Geospatial location, encoded as GeoJSON.
§ observedAt à Observation timestamp, encoded as ISO8601. (timestamp)
§ createdAt à Creation timestamp (of entity, attribute). dateCreated in Orion
§ modifiedAt à Update timestamp (of entity, attribute). dateModified in Orion
§ unitCode à Units of measurement, encoded as mandated by UN/CEFACT.
§ Recommended practice
§ Use URIs to identify your entities.
§ A URN schema is provided off-the-shelf. It enables to know in advance what entity type
an id refers to
§ urn:ngsi-ld:<Entity_Type_Name>:<Entity_Identification_String>
13
Example
Source: ETSI Specification
JSON Representation
14
15
Classical JSON Representation (a.k.a. Orion / NGSIv2)
{
"id": "urn:ngsi-ld:Vehicle:A4567",
"type": "Vehicle",
"brandName": {
"type": "Property",
"value": "Mercedes"
},
"isParked": {
"type": "Relationship",
"value": "urn:ngsi-ld:OffStreetParking:Downtown1",
"metadata": {
"observedAt": {
"value" : "2017-07-29T12:00:04",
"type" : "DateTime"
},
"providedBy": {
"type" : "Relationship",
"value" : "urn:ngsi-ld:Person:Bob"
}
}
}
}
{
"id": "urn:ngsi-ld:OffStreetParking:Downtown1",
"type": "OffStreetParking",
"availableSpotNumber": {
"type": "Property",
"value": 121,
"metadata" : {
"observedAt": {
"value" : "2017-07-29T12:00:04",
"type" : "DateTime"
},
"reliability": {
"type" : "Property",
"value" : 0.7
},
"providedBy": {
"type" : "Relationship",
"value" : "urn:ngsi-ld:Camera:C1"
}
}
},
"location": {
"type": "geo:json",
"value": {
"type": "Point",
"coordinates": [-8.5, 41.2]
}
}
}
16
Remarks – NGSIv2 representation
§ metadata dictionary allows grouping nested properties and/or nested relationships
§ Should I label attributes using data type names, such as integer, float, etc. or even let
the API implementation to fill them out?
§ Is that really needed? Your runtime already provide JSON member’s data type
§ Exception is “DateTime” for timestamps (Orion implementation needs it)
§ Note: In NGSI-LD “DateTime” is mapped to “TemporalProperty”
§ Should I use other metadata or attribute names different than “location”,
“observedAt”, etc.?
§ We do not recommend it. Please keep your context harmonised!
§ Is it possible to use plain entity identifiers i.e. no URIs?
§ We do not recommend it.
§ Please enable a smooth transition to JSON-LD (NGSI-LD)!!
17
JSON-LD (RDF friendly) representation (a.k.a. NGSI-LD)
{
"id": "urn:ngsi-ld:Vehicle:A4567",
"type": "Vehicle",
"brandName": {
"type": "Property",
"value": "Mercedes"
},
"isParked": {
"type": "Relationship",
"object": "urn:ngsi-ld:OffStreetParking:Downtown1",
"observedAt": "2017-07-29T12:00:04",
"providedBy": {
"type": "Relationship",
"object": "urn:ngsi-ld:Person:Bob"
}
},
"@context": [
"http://uri.etsi.org/ngsi-ld/coreContext.jsonld",
"http://example.org/cim/commonTerms.jsonld",
"http://example.org/cim/vehicle.jsonld",
"http://example.org/cim/parking.jsonld"
]
}
{
"id": "urn:ngsi-ld:OffStreetParking:Downtown1",
"type": "OffStreetParking",
"availableSpotNumber": {
"type": "Property",
"value": 121,
"observedAt": "2017-07-29T12:05:02",
"reliability": {
"type": "Property",
"value": 0.7
},
"providedBy": {
"type": "Relationship",
"object": "urn:ngsi-ld:Camera:C1"
}
},
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [-8.5, 41.2]
}
},
"@context": [
"http://uri.etsi.org/ngsi-ld/coreContext.jsonld",
"http://example.org/cim/parking.jsonld"
]
}
18
Remarks – NGSI-LD vs NGSIv2 (Orion)
§ NGSI-LD: Main syntactical differences with NGSIv2:
§ metadata dictionary no longer needed
§ “object” field to encode relationship target (in order to be compliant with JSON-LD we
cannot overload the “value” field)
§ GeoProperty vs geo:json
§ TemporalProperty vs DateTime
§ included JSON-LD @context à “Unambiguous Semantics”
§ There is a direct mapping between the classical and JSON-LD representation
§ if nested properties and relationships are direct children (only one nesting level)
§ There is a plugin (proxy-wrapper), provided by FIWARE, that can be used to work
directly with JSON-LD representations. See next slides.
19
Remarks – NGSI-LD
§ What is the JSON-LD “@context” member?
§ It provides unambiguous mappings from (local) terms to URIs (fully qualified
names)
§ “Vehicle”: “http://myvocabulary.org/Vehicle”
§ It allows specifying data types for properties outside the main JSON document.
§ Ex. http://schema.org/DateTime
§ In general, you should not worry about it!
§ Provided off-the-shelf by the domain-specific data model designer, ex. Schema.org
§ A default @context will always be implicitly present
20
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": [
"http://uri.etsi.org/ngsi-ld/coreContext.jsonld",
"http://example.org/cim/parking.jsonld"
]
}
Equivalent in NGSI-LD and NGSIv2
Context Information Provision
21
22
HTTP Binding (I)
§ Create Entity
§ POST {apiEndPoint}/entities/
§ 201 Created. Location /entities/{entityId}
§ Delete Entity
§ DELETE {apiEndPoint}/entities/{entityId}
§ 204 No Content
§ 404 if entity does not exist
§ Append new attributes to Entity
§ POST {apiEndPoint}/entities/{entityId}/attrs/
§ 201 Created. 404 if entity does not exist
§ Payload shall contain entity fragment with the new attributes to be appended
§ If attribute already exists, it is overwritten..
Note: In Orion the API endpoint is : /v2
23
HTTP Binding (II)
§ Update Entity Attributes
§ PATCH {apiEndPoint}/entities/{entityId}/attrs/
§ 204 No Content
§ Payload shall contain entity fragment with the new content for attributes
§ Attributes shall already exist. Otherwise 404 error.
§ Delete Entity Attribute
§ DELETE {apiEndPoint}/entities/{entityId}/attrs/{attributeName}
§ 204 No Content
§ 404 if attribute or entity not exist
Context Information Consumption
24
25
HTTP Binding (I)
§ Retrieve Entity by id
§ GET {apiEndPoint}/entities/{entityId}?attrs=<attrList>
§ Returns a JSON object representing the concerned Entity
§ attrs is a list (comma separated) of attributes to be retrieved (each list element can
be a Property or a Relationship name)
§ If attrs is not present then all Entity Attributes will be retrieved
§ Note: In Orion the API endpoint is : /v2
26
HTTP Binding (II)
§ Query Entities
§ GET {apiEndPoint}/entities/?
§ type<typeList>
§ &id=<idList>
§ &idPattern=<RegExp>
§ &q=<Expression>
§ &attrs=<attrList>
§ Lists are comma-separated
§ q accepted expressions
§ <attribute>==<value>, !=, <, <=, >=, pattern matching
§ Use ; to separate terms (logical and)
§ Returns Entity list as a JSON Array. Pagination is available. (limit, offset params)
§ Note: In Orion the API endpoint is : /v2
27
HTTP Binding (III)
§ Geo-query
§ GET {apiEndPoint}/entities/?
§ &georel. Geo-relationship (near, contains, intersects, overlaps, etc.)
§ &geometry. GeoJSON reference geometry (Point, Polygon, etc.)
§ &coordinates. Array of GeoJSON coordinates encoded as string.
§ &coords (Orion Broker). Be careful, order is lat,long (opposite to GeoJSON).
§ Example
§ Give me entities located in a 2km radius of a reference point
§ georel=near;maxDistance==2000&geometry=Point&coordinates=[-4,55] ß ETSI
§ georel=near;maxDistance:2000&geometry=point&coords=55,-4 <– Orion supports this
§ Geo-queries can be combined with content-based filter queries
Context Subscriptions
28
29
Context Subscription - Description
§ You can subscribe, i.e. ask to receive a notification, to Context Information changes
§ Subscriptions can be on
§ A particular Entity id / set of Entities / Any Entity
§ An Entity Type / set of Entity Types
§ A particular set of watched attributes / Any attribute (of an entity or all entities)
§ Additionally it can be provided
§ A query that must be met by the notified Entities
§ Ex: Only notify when temperature > 20
§ A geoquery that must be met by the notified Entities
§ Ex: Only notify when Entity is located in this area (encoded as a GeoJSON polygon)
§ Notifications are delivered via HTTP POST requests, as a JSON Array of affected Entities,
as per the notification details described by the subscription
30
Context Subscription – JSON Representation
{
"id": "urn:ngsi-ld:Subscription:5aeb0ee97",
"type": "Subscription",
"entities": [
{
"type": "Vehicle"
}
],
"watchedAttributes": ["speed"],
"q": "speed>50",
"geoQ": {
"georel": "near;maxDistance==2000",
"geometry": "Point",
"coordinates": [-1,100]
},
"notification": {
"attributes": ["speed"],
"format": "keyValues",
"endpoint": {
"uri": "https://putsreq.com/2ZvwbG0bl1NvZF1KLTjo",
"accept": "application/json"
}
},
"@context": [
"http://uri.etsi.org/ngsi-ld/coreContext.jsonld",
"http://example.org/cim/vehicle.jsonld"
]
}
{
"id": "5aeb0ee97",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Vehicle"
}
],
"condition": {
"attrs": ["speed"],
"expression": {
"q": "speed>50",
"georel": "near;maxDistance:2000",
"geometry": "point",
"coords": "100,-1"
}
}
},
"notification": {
"attrs": ["speed"],
"attrsFormat": "keyValues",
"http": {
"url": "https://putsreq.com/2ZvwbG0bl1NvZF1KLTjo"
}
}
}
31
Context Subscription - HTTP Binding
§ Create Subscription
§ POST {apiEndPoint}/subscriptions/ à 201 Created
§ Update Subscription
§ PATCH {apiEndPoint}/subscriptions/{subscriptionId} à 204 No Content. 404 if not found
§ Remove Subscription
§ DELETE {apiEndPoint}/subscriptions/{subscriptionId} à 204 No Content. 404 if not found.
§ List Subscriptions
§ GET {apiEndPoint}/subscriptions/
§ Returns JSON Array
§ Retrieve Subscription by id
§ GET {apiEndPoint}/subscriptions/{subscriptionId}
§ Returns JSON Object
§ Note: In Orion the API endpoint is : /v2
Context Source Registration
32
33
Context Source Registration - Description
§ You can register Context Sources capable of providing Context Information concerning
§ A particular Entity id / Set of Entities / Any Entity
§ An Entity Type / Set of Entity Types
§ A particular set of Entity Attributes i.e. Properties or Relationships / Any Attribute (of an Entity
or any Entity)
§ Additionally it can be provided
§ A geographical area associated to the Context Source i.e. an area for which the Context
Source has Context Information
§ Ex: a Context Source capable of providing Context Information for a whole Smart City
§ (A time scope. To be refined in the final NGSI-LD specification)
§ The Orion Broker implementation can even forward requests to Context Sources when
querying entities
34
Context Source Registration - Representation
{
"id": "urn:ngsi-ld:ContextSourceRegistration:csr1a3456",
"type": "ContextSourceRegistration",
"information": [
{
"entities": [
{
"id": "urn:ngsi-ld:Vehicle:A456",
"type": "Vehicle"
}
],
"properties": ["brandName","speed"],
"relationships": ["isParked"]
}
],
"endpoint": "http://my.csource.org:1026",
"location": {
"type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
[100.0, 1.0], [100.0, 0.0] ] ]
},
"@context": [
"http://uri.etsi.org/ngsi-ld/coreContext.jsonld",
"http://example.org/cim/commonTerms.jsonld",
"http://example.org/cim/vehicle.jsonld",
"http://example.org/cim/parking.jsonld"
]
}
{
"id”: "csr1a3456"
"dataProvided": {
"entities": [
{
"id": "urn:ngsi-ld:Vehicle:A456",
"type": "Vehicle"
}
],
"attrs": [
"brandName", "speed", "isParked"
]
},
"expression": {
"geometry": "polygon",
"georel": "within",
"coords": "0.0,100.0;0.0,100;1.0,101.0;1.0,100.0;0.0,100.0"
},
"provider": {
"http": {
"url": "http://contextsource.example.org"
},
"legacyForwarding": true
}
}
35
Context Source Registration - HTTP Binding
§ Create Context Source Registration
§ POST {apiEndPoint}/registrations/ à 201 Created
§ Update Context Source Registration
§ PATCH {apiEndPoint}/registrations/{registrationId} à 204 No Content. 404 if not found.
§ Remove Context Source Registration
§ DELETE {apiEndPoint}/registrations/{registrationId} à 204 No Content. 404 if not found.
§ Query Context Source Registrations
§ GET {apiEndPoint}/registrations/?<Same as Query Entities>
§ Returns JSON Array of ContextSourceRegistrations
§ Retrieve Context Source Registration
§ GET {apiEndPoint}/registrations/{registrationId}
§ Returns JSON Object
§ Note: In Orion the API endpoint is : /v2
NGSI implementations
36
37
FIWARE Context Broker (Orion)
MongoDB
38
Remarks – Orion
§ MongoDB as persistent data store
§ Implements the “NGSIv2 flavour”. In the future NGSI-LD
§ Multitenant (Fiware-Service HTTP header) àMultiple Mongo Databases.
§ Battle-tested. Deployed in various smart city projects.
§ Can play the role of Central Broker or Distribution Broker. Federated.
§ Source code
§ https://github.com/fiware/context.Orion
§ How to run
$ wget https://raw.githubusercontent.com/Fiware/context.Orion/master/docker/docker-
compose.yml
$ docker-compose up
$ curl localhost:1026/version
39
Other implementations
§ Aeron Broker (a.k.a. IoT Broker)
§ https://github.com/Aeronbroker/Aeron
§ Distribution broker
§ Experimental
§ OMA NGSI10/9 compliant
§ IoT Discovery
§ https://github.com/Aeronbroker/NEConfMan
§ Registry for distribution brokers
§ Experimental
§ OMA NGSI9 compliant
NGSI-LD Roadmap
40
41
NGSI-LD implementation Roadmap
§ Short term. Quick win. Planned June 2018.
§ A plugin (proxy-wrapper) on top of the Orion Context Broker
§ NGSI-LD Wrapper implemented in Scala / Scalatra. Drop existing Java /Jersey one.
§ Automatic mapping between the NGSIv2 representation and the NGSI-LD representation
§ docker-compose to make the two services working together seamlessly
§ Medium term. Planned December 2018.
§ Native implementation, i.e. a new release of the Orion Context Broker.
§ Converge the NGSIv2 representation with the NGSI-LD representation
§ Target: Design for backwards and forwards compatibility
§ Longer term. Planned Q1 2019
§ Full @context, namespace support. Advanced Queries.
§ Historical data support (through the QuantumLeap plugin)
42
Related content
§ Open API specification (NGSIv2. NGSI-LD coming soon)
§ https://bit.ly/2I9ZWfe
§ Orion in HA Mode
§ https://fiware-orion.readthedocs.io/en/master/admin/extra/ha/index.html
§ Tutorials (NGSIv2 flavour. NGSI-LD coming soon)
§ https://github.com/Fiware?utf8=%E2%9C%93&q=tutorials&type=&language=
§ Generating historical data
§ http://fiwaretourguide.readthedocs.io/en/latest/generating-historical-context-information-sth-comet/how-to-
generate-the-history-of-Context-Information-using-STH-Comet/ (old API. MongoDB based)
§ http://fiwaretourguide.readthedocs.io/en/latest/storing-data-cygnus-mysql/how-to-store-data-cygnus-mysql/
§ https://github.com/smartsdk/ngsi-timeseries-api (NGSIv2 aligned, CrateDB, Grafana Ready!)
§ Harmonized Data Models (NGSIv2 flavour. Soon NGSI-LD)
§ https://schema.fiware.org
Thank you!
http://fiware.org
Follow @FIWARE on Twitter
José Manuel Cantera Fonseca
FIWARE Foundation Senior Expert
Josemanuel.cantera@fiware.org

Mais conteúdo relacionado

Mais procurados

User Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: StethoscopeUser Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: Stethoscope
Jesse Kriss
 
Introducing a horizontally scalable, inference-based business Rules Engine fo...
Introducing a horizontally scalable, inference-based business Rules Engine fo...Introducing a horizontally scalable, inference-based business Rules Engine fo...
Introducing a horizontally scalable, inference-based business Rules Engine fo...
Cask Data
 
Sahara presentation latest - Codemotion Rome 2015
Sahara presentation latest - Codemotion Rome 2015Sahara presentation latest - Codemotion Rome 2015
Sahara presentation latest - Codemotion Rome 2015
Codemotion
 

Mais procurados (20)

FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
 
Time Series Analysis Using an Event Streaming Platform
 Time Series Analysis Using an Event Streaming Platform Time Series Analysis Using an Event Streaming Platform
Time Series Analysis Using an Event Streaming Platform
 
Enterprise Metadata Integration
Enterprise Metadata IntegrationEnterprise Metadata Integration
Enterprise Metadata Integration
 
NoSQL, which way to go?
NoSQL, which way to go?NoSQL, which way to go?
NoSQL, which way to go?
 
Omc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van SoestOmc AMIS evenement 26012017 Dennis van Soest
Omc AMIS evenement 26012017 Dennis van Soest
 
How to Handle DEV&TEST&PROD for Oracle Data Integrator
How to Handle DEV&TEST&PROD for Oracle Data IntegratorHow to Handle DEV&TEST&PROD for Oracle Data Integrator
How to Handle DEV&TEST&PROD for Oracle Data Integrator
 
Log analysis using elk
Log analysis using elkLog analysis using elk
Log analysis using elk
 
Docker data science pipeline
Docker data science pipelineDocker data science pipeline
Docker data science pipeline
 
Iottoolkit wot
Iottoolkit wotIottoolkit wot
Iottoolkit wot
 
Unified Data Access with Gimel
Unified Data Access with GimelUnified Data Access with Gimel
Unified Data Access with Gimel
 
User Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: StethoscopeUser Focused Security at Netflix: Stethoscope
User Focused Security at Netflix: Stethoscope
 
Introducing a horizontally scalable, inference-based business Rules Engine fo...
Introducing a horizontally scalable, inference-based business Rules Engine fo...Introducing a horizontally scalable, inference-based business Rules Engine fo...
Introducing a horizontally scalable, inference-based business Rules Engine fo...
 
Monitoring @ scale over diverse data sources @ PayPal - Druid, TSDB, Hadoop
Monitoring @ scale over diverse data sources @ PayPal  - Druid, TSDB, HadoopMonitoring @ scale over diverse data sources @ PayPal  - Druid, TSDB, Hadoop
Monitoring @ scale over diverse data sources @ PayPal - Druid, TSDB, Hadoop
 
Hypermedia System Architecture for a Web of Things
Hypermedia System Architecture for a Web of ThingsHypermedia System Architecture for a Web of Things
Hypermedia System Architecture for a Web of Things
 
Druid + Kafka: transform your data-in-motion to analytics-in-motion | Gian Me...
Druid + Kafka: transform your data-in-motion to analytics-in-motion | Gian Me...Druid + Kafka: transform your data-in-motion to analytics-in-motion | Gian Me...
Druid + Kafka: transform your data-in-motion to analytics-in-motion | Gian Me...
 
Sahara presentation latest - Codemotion Rome 2015
Sahara presentation latest - Codemotion Rome 2015Sahara presentation latest - Codemotion Rome 2015
Sahara presentation latest - Codemotion Rome 2015
 
IP based standards for IoT
IP based standards for IoTIP based standards for IoT
IP based standards for IoT
 
What Is ELK Stack | ELK Tutorial For Beginners | Elasticsearch Kibana | ELK S...
What Is ELK Stack | ELK Tutorial For Beginners | Elasticsearch Kibana | ELK S...What Is ELK Stack | ELK Tutorial For Beginners | Elasticsearch Kibana | ELK S...
What Is ELK Stack | ELK Tutorial For Beginners | Elasticsearch Kibana | ELK S...
 
Hybrid Streaming Analytics for Apache Kafka Users | Firat Tekiner, Google
Hybrid Streaming Analytics for Apache Kafka Users | Firat Tekiner, GoogleHybrid Streaming Analytics for Apache Kafka Users | Firat Tekiner, Google
Hybrid Streaming Analytics for Apache Kafka Users | Firat Tekiner, Google
 
Tracking crime as it occurs with apache phoenix, apache hbase and apache nifi
Tracking crime as it occurs with apache phoenix, apache hbase and apache nifiTracking crime as it occurs with apache phoenix, apache hbase and apache nifi
Tracking crime as it occurs with apache phoenix, apache hbase and apache nifi
 

Semelhante a FIWARE Global Summit - FIWARE Context Information Management

Semelhante a FIWARE Global Summit - FIWARE Context Information Management (20)

FIWARE Global Summit - NGSI-LD - NGSI with Linked Data
FIWARE Global Summit - NGSI-LD - NGSI with Linked DataFIWARE Global Summit - NGSI-LD - NGSI with Linked Data
FIWARE Global Summit - NGSI-LD - NGSI with Linked Data
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
 
曾勇 Elastic search-intro
曾勇 Elastic search-intro曾勇 Elastic search-intro
曾勇 Elastic search-intro
 
Elastic search intro-@lamper
Elastic search intro-@lamperElastic search intro-@lamper
Elastic search intro-@lamper
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction
 
Elasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analyticsElasticsearch, a distributed search engine with real-time analytics
Elasticsearch, a distributed search engine with real-time analytics
 
myEquivalents, aka a new cross-reference service
myEquivalents, aka a new cross-reference servicemyEquivalents, aka a new cross-reference service
myEquivalents, aka a new cross-reference service
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
FIWARE Global Summit - NGSI-LD – an Evolution from NGSIv2
FIWARE Global Summit - NGSI-LD – an Evolution from NGSIv2FIWARE Global Summit - NGSI-LD – an Evolution from NGSIv2
FIWARE Global Summit - NGSI-LD – an Evolution from NGSIv2
 
JSON in der Oracle Datenbank
JSON in der Oracle DatenbankJSON in der Oracle Datenbank
JSON in der Oracle Datenbank
 
Consuming REST services with ActiveResource
Consuming REST services with ActiveResourceConsuming REST services with ActiveResource
Consuming REST services with ActiveResource
 
Java Persistence API 2.0: An Overview
Java Persistence API 2.0: An OverviewJava Persistence API 2.0: An Overview
Java Persistence API 2.0: An Overview
 
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...
 
Workshop: Learning Elasticsearch
Workshop: Learning ElasticsearchWorkshop: Learning Elasticsearch
Workshop: Learning Elasticsearch
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring Data
 
Introduction to Datastore
Introduction to DatastoreIntroduction to Datastore
Introduction to Datastore
 
Angular.js Primer in Aalto University
Angular.js Primer in Aalto UniversityAngular.js Primer in Aalto University
Angular.js Primer in Aalto University
 

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

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

FIWARE Global Summit - FIWARE Context Information Management

  • 1. Context Information Management with FIWARE José Manuel Cantera Fonseca (@jmcantera) Senior Expert - Technical Lead & Architect FIWARE Foundation e.V. May 2018 (Aligned with ETSI ISG CIM)
  • 3. 2 Digitization is starting to gravitate around context information. Information and its context which describes what is going on, where, when, why …
  • 4. 3 Tractor • Location • Speed • Direction Crop • Humidity • Leaf area • Age Drone • Location • Battery level • Speed • Direction … but also in Agrifood … not only in cities
  • 5. 4 Tanker • Driver • Location • Max Volume • Current Level • Speed • Direction Gas Tank • Station • Max Volume • Current Level • Min Threshold • Temperature Station • Location • Owner • SLA … but also in Industry / Energy … not only in cities
  • 6. FIWARE: Driving the standard for Context Information Management § FIWARE NGSI is a simple yet powerful open, royalty-free standard API for Context Information Management à Published as ETSI Specification § A RESTful API using JSON so any web/backend developer gets quickly used to it § Yet powerful: FIWARE NGSI supports geo-queries and Linked Data (JSON-LD) 5 Application/Service Bus • Location • No. passengers • Driver • Licence plate Parking • name • totalSpotNumber • availableSpotNumber • location • floorNumber Shop • Location • Business name • Franchise • Offerings Context Information FIWARE NGSI API Context Information might come from different sources not only IoT
  • 8. 7 Context Information Management Architectures (I) Centralized Distributed
  • 9. 8 Context Information Management Architectures (II) Federated
  • 12. 11 Information Model - Highlights § NGSI Entity à Physical or virtual object. § It has (one) Entity Type. § Uniquely identified by an Entity Id (URI) § Entity has zero or more attributes identified by a name § Property --> Static or dynamic characteristic of an entity § GeoProperty (geospatial context) § TemporalProperty (time context) § Relationship à Association with a Linked entity (unidirectional) § Properties have a value § An NGSI value can be a single value (Number, String, boolean), or complex (Array, Structured Value) § Relationships have an object § A URI which points to another entity (target of the relationship). Target can be a collection.
  • 13. 12 Information Model – Highlights (II) § Cross-Domain, core properties for giving context to your information § location à Geospatial location, encoded as GeoJSON. § observedAt à Observation timestamp, encoded as ISO8601. (timestamp) § createdAt à Creation timestamp (of entity, attribute). dateCreated in Orion § modifiedAt à Update timestamp (of entity, attribute). dateModified in Orion § unitCode à Units of measurement, encoded as mandated by UN/CEFACT. § Recommended practice § Use URIs to identify your entities. § A URN schema is provided off-the-shelf. It enables to know in advance what entity type an id refers to § urn:ngsi-ld:<Entity_Type_Name>:<Entity_Identification_String>
  • 16. 15 Classical JSON Representation (a.k.a. Orion / NGSIv2) { "id": "urn:ngsi-ld:Vehicle:A4567", "type": "Vehicle", "brandName": { "type": "Property", "value": "Mercedes" }, "isParked": { "type": "Relationship", "value": "urn:ngsi-ld:OffStreetParking:Downtown1", "metadata": { "observedAt": { "value" : "2017-07-29T12:00:04", "type" : "DateTime" }, "providedBy": { "type" : "Relationship", "value" : "urn:ngsi-ld:Person:Bob" } } } } { "id": "urn:ngsi-ld:OffStreetParking:Downtown1", "type": "OffStreetParking", "availableSpotNumber": { "type": "Property", "value": 121, "metadata" : { "observedAt": { "value" : "2017-07-29T12:00:04", "type" : "DateTime" }, "reliability": { "type" : "Property", "value" : 0.7 }, "providedBy": { "type" : "Relationship", "value" : "urn:ngsi-ld:Camera:C1" } } }, "location": { "type": "geo:json", "value": { "type": "Point", "coordinates": [-8.5, 41.2] } } }
  • 17. 16 Remarks – NGSIv2 representation § metadata dictionary allows grouping nested properties and/or nested relationships § Should I label attributes using data type names, such as integer, float, etc. or even let the API implementation to fill them out? § Is that really needed? Your runtime already provide JSON member’s data type § Exception is “DateTime” for timestamps (Orion implementation needs it) § Note: In NGSI-LD “DateTime” is mapped to “TemporalProperty” § Should I use other metadata or attribute names different than “location”, “observedAt”, etc.? § We do not recommend it. Please keep your context harmonised! § Is it possible to use plain entity identifiers i.e. no URIs? § We do not recommend it. § Please enable a smooth transition to JSON-LD (NGSI-LD)!!
  • 18. 17 JSON-LD (RDF friendly) representation (a.k.a. NGSI-LD) { "id": "urn:ngsi-ld:Vehicle:A4567", "type": "Vehicle", "brandName": { "type": "Property", "value": "Mercedes" }, "isParked": { "type": "Relationship", "object": "urn:ngsi-ld:OffStreetParking:Downtown1", "observedAt": "2017-07-29T12:00:04", "providedBy": { "type": "Relationship", "object": "urn:ngsi-ld:Person:Bob" } }, "@context": [ "http://uri.etsi.org/ngsi-ld/coreContext.jsonld", "http://example.org/cim/commonTerms.jsonld", "http://example.org/cim/vehicle.jsonld", "http://example.org/cim/parking.jsonld" ] } { "id": "urn:ngsi-ld:OffStreetParking:Downtown1", "type": "OffStreetParking", "availableSpotNumber": { "type": "Property", "value": 121, "observedAt": "2017-07-29T12:05:02", "reliability": { "type": "Property", "value": 0.7 }, "providedBy": { "type": "Relationship", "object": "urn:ngsi-ld:Camera:C1" } }, "location": { "type": "GeoProperty", "value": { "type": "Point", "coordinates": [-8.5, 41.2] } }, "@context": [ "http://uri.etsi.org/ngsi-ld/coreContext.jsonld", "http://example.org/cim/parking.jsonld" ] }
  • 19. 18 Remarks – NGSI-LD vs NGSIv2 (Orion) § NGSI-LD: Main syntactical differences with NGSIv2: § metadata dictionary no longer needed § “object” field to encode relationship target (in order to be compliant with JSON-LD we cannot overload the “value” field) § GeoProperty vs geo:json § TemporalProperty vs DateTime § included JSON-LD @context à “Unambiguous Semantics” § There is a direct mapping between the classical and JSON-LD representation § if nested properties and relationships are direct children (only one nesting level) § There is a plugin (proxy-wrapper), provided by FIWARE, that can be used to work directly with JSON-LD representations. See next slides.
  • 20. 19 Remarks – NGSI-LD § What is the JSON-LD “@context” member? § It provides unambiguous mappings from (local) terms to URIs (fully qualified names) § “Vehicle”: “http://myvocabulary.org/Vehicle” § It allows specifying data types for properties outside the main JSON document. § Ex. http://schema.org/DateTime § In general, you should not worry about it! § Provided off-the-shelf by the domain-specific data model designer, ex. Schema.org § A default @context will always be implicitly present
  • 21. 20 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": [ "http://uri.etsi.org/ngsi-ld/coreContext.jsonld", "http://example.org/cim/parking.jsonld" ] } Equivalent in NGSI-LD and NGSIv2
  • 23. 22 HTTP Binding (I) § Create Entity § POST {apiEndPoint}/entities/ § 201 Created. Location /entities/{entityId} § Delete Entity § DELETE {apiEndPoint}/entities/{entityId} § 204 No Content § 404 if entity does not exist § Append new attributes to Entity § POST {apiEndPoint}/entities/{entityId}/attrs/ § 201 Created. 404 if entity does not exist § Payload shall contain entity fragment with the new attributes to be appended § If attribute already exists, it is overwritten.. Note: In Orion the API endpoint is : /v2
  • 24. 23 HTTP Binding (II) § Update Entity Attributes § PATCH {apiEndPoint}/entities/{entityId}/attrs/ § 204 No Content § Payload shall contain entity fragment with the new content for attributes § Attributes shall already exist. Otherwise 404 error. § Delete Entity Attribute § DELETE {apiEndPoint}/entities/{entityId}/attrs/{attributeName} § 204 No Content § 404 if attribute or entity not exist
  • 26. 25 HTTP Binding (I) § Retrieve Entity by id § GET {apiEndPoint}/entities/{entityId}?attrs=<attrList> § Returns a JSON object representing the concerned Entity § attrs is a list (comma separated) of attributes to be retrieved (each list element can be a Property or a Relationship name) § If attrs is not present then all Entity Attributes will be retrieved § Note: In Orion the API endpoint is : /v2
  • 27. 26 HTTP Binding (II) § Query Entities § GET {apiEndPoint}/entities/? § type<typeList> § &id=<idList> § &idPattern=<RegExp> § &q=<Expression> § &attrs=<attrList> § Lists are comma-separated § q accepted expressions § <attribute>==<value>, !=, <, <=, >=, pattern matching § Use ; to separate terms (logical and) § Returns Entity list as a JSON Array. Pagination is available. (limit, offset params) § Note: In Orion the API endpoint is : /v2
  • 28. 27 HTTP Binding (III) § Geo-query § GET {apiEndPoint}/entities/? § &georel. Geo-relationship (near, contains, intersects, overlaps, etc.) § &geometry. GeoJSON reference geometry (Point, Polygon, etc.) § &coordinates. Array of GeoJSON coordinates encoded as string. § &coords (Orion Broker). Be careful, order is lat,long (opposite to GeoJSON). § Example § Give me entities located in a 2km radius of a reference point § georel=near;maxDistance==2000&geometry=Point&coordinates=[-4,55] ß ETSI § georel=near;maxDistance:2000&geometry=point&coords=55,-4 <– Orion supports this § Geo-queries can be combined with content-based filter queries
  • 30. 29 Context Subscription - Description § You can subscribe, i.e. ask to receive a notification, to Context Information changes § Subscriptions can be on § A particular Entity id / set of Entities / Any Entity § An Entity Type / set of Entity Types § A particular set of watched attributes / Any attribute (of an entity or all entities) § Additionally it can be provided § A query that must be met by the notified Entities § Ex: Only notify when temperature > 20 § A geoquery that must be met by the notified Entities § Ex: Only notify when Entity is located in this area (encoded as a GeoJSON polygon) § Notifications are delivered via HTTP POST requests, as a JSON Array of affected Entities, as per the notification details described by the subscription
  • 31. 30 Context Subscription – JSON Representation { "id": "urn:ngsi-ld:Subscription:5aeb0ee97", "type": "Subscription", "entities": [ { "type": "Vehicle" } ], "watchedAttributes": ["speed"], "q": "speed>50", "geoQ": { "georel": "near;maxDistance==2000", "geometry": "Point", "coordinates": [-1,100] }, "notification": { "attributes": ["speed"], "format": "keyValues", "endpoint": { "uri": "https://putsreq.com/2ZvwbG0bl1NvZF1KLTjo", "accept": "application/json" } }, "@context": [ "http://uri.etsi.org/ngsi-ld/coreContext.jsonld", "http://example.org/cim/vehicle.jsonld" ] } { "id": "5aeb0ee97", "subject": { "entities": [ { "idPattern": ".*", "type": "Vehicle" } ], "condition": { "attrs": ["speed"], "expression": { "q": "speed>50", "georel": "near;maxDistance:2000", "geometry": "point", "coords": "100,-1" } } }, "notification": { "attrs": ["speed"], "attrsFormat": "keyValues", "http": { "url": "https://putsreq.com/2ZvwbG0bl1NvZF1KLTjo" } } }
  • 32. 31 Context Subscription - HTTP Binding § Create Subscription § POST {apiEndPoint}/subscriptions/ à 201 Created § Update Subscription § PATCH {apiEndPoint}/subscriptions/{subscriptionId} à 204 No Content. 404 if not found § Remove Subscription § DELETE {apiEndPoint}/subscriptions/{subscriptionId} à 204 No Content. 404 if not found. § List Subscriptions § GET {apiEndPoint}/subscriptions/ § Returns JSON Array § Retrieve Subscription by id § GET {apiEndPoint}/subscriptions/{subscriptionId} § Returns JSON Object § Note: In Orion the API endpoint is : /v2
  • 34. 33 Context Source Registration - Description § You can register Context Sources capable of providing Context Information concerning § A particular Entity id / Set of Entities / Any Entity § An Entity Type / Set of Entity Types § A particular set of Entity Attributes i.e. Properties or Relationships / Any Attribute (of an Entity or any Entity) § Additionally it can be provided § A geographical area associated to the Context Source i.e. an area for which the Context Source has Context Information § Ex: a Context Source capable of providing Context Information for a whole Smart City § (A time scope. To be refined in the final NGSI-LD specification) § The Orion Broker implementation can even forward requests to Context Sources when querying entities
  • 35. 34 Context Source Registration - Representation { "id": "urn:ngsi-ld:ContextSourceRegistration:csr1a3456", "type": "ContextSourceRegistration", "information": [ { "entities": [ { "id": "urn:ngsi-ld:Vehicle:A456", "type": "Vehicle" } ], "properties": ["brandName","speed"], "relationships": ["isParked"] } ], "endpoint": "http://my.csource.org:1026", "location": { "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }, "@context": [ "http://uri.etsi.org/ngsi-ld/coreContext.jsonld", "http://example.org/cim/commonTerms.jsonld", "http://example.org/cim/vehicle.jsonld", "http://example.org/cim/parking.jsonld" ] } { "id”: "csr1a3456" "dataProvided": { "entities": [ { "id": "urn:ngsi-ld:Vehicle:A456", "type": "Vehicle" } ], "attrs": [ "brandName", "speed", "isParked" ] }, "expression": { "geometry": "polygon", "georel": "within", "coords": "0.0,100.0;0.0,100;1.0,101.0;1.0,100.0;0.0,100.0" }, "provider": { "http": { "url": "http://contextsource.example.org" }, "legacyForwarding": true } }
  • 36. 35 Context Source Registration - HTTP Binding § Create Context Source Registration § POST {apiEndPoint}/registrations/ à 201 Created § Update Context Source Registration § PATCH {apiEndPoint}/registrations/{registrationId} à 204 No Content. 404 if not found. § Remove Context Source Registration § DELETE {apiEndPoint}/registrations/{registrationId} à 204 No Content. 404 if not found. § Query Context Source Registrations § GET {apiEndPoint}/registrations/?<Same as Query Entities> § Returns JSON Array of ContextSourceRegistrations § Retrieve Context Source Registration § GET {apiEndPoint}/registrations/{registrationId} § Returns JSON Object § Note: In Orion the API endpoint is : /v2
  • 38. 37 FIWARE Context Broker (Orion) MongoDB
  • 39. 38 Remarks – Orion § MongoDB as persistent data store § Implements the “NGSIv2 flavour”. In the future NGSI-LD § Multitenant (Fiware-Service HTTP header) àMultiple Mongo Databases. § Battle-tested. Deployed in various smart city projects. § Can play the role of Central Broker or Distribution Broker. Federated. § Source code § https://github.com/fiware/context.Orion § How to run $ wget https://raw.githubusercontent.com/Fiware/context.Orion/master/docker/docker- compose.yml $ docker-compose up $ curl localhost:1026/version
  • 40. 39 Other implementations § Aeron Broker (a.k.a. IoT Broker) § https://github.com/Aeronbroker/Aeron § Distribution broker § Experimental § OMA NGSI10/9 compliant § IoT Discovery § https://github.com/Aeronbroker/NEConfMan § Registry for distribution brokers § Experimental § OMA NGSI9 compliant
  • 42. 41 NGSI-LD implementation Roadmap § Short term. Quick win. Planned June 2018. § A plugin (proxy-wrapper) on top of the Orion Context Broker § NGSI-LD Wrapper implemented in Scala / Scalatra. Drop existing Java /Jersey one. § Automatic mapping between the NGSIv2 representation and the NGSI-LD representation § docker-compose to make the two services working together seamlessly § Medium term. Planned December 2018. § Native implementation, i.e. a new release of the Orion Context Broker. § Converge the NGSIv2 representation with the NGSI-LD representation § Target: Design for backwards and forwards compatibility § Longer term. Planned Q1 2019 § Full @context, namespace support. Advanced Queries. § Historical data support (through the QuantumLeap plugin)
  • 43. 42 Related content § Open API specification (NGSIv2. NGSI-LD coming soon) § https://bit.ly/2I9ZWfe § Orion in HA Mode § https://fiware-orion.readthedocs.io/en/master/admin/extra/ha/index.html § Tutorials (NGSIv2 flavour. NGSI-LD coming soon) § https://github.com/Fiware?utf8=%E2%9C%93&q=tutorials&type=&language= § Generating historical data § http://fiwaretourguide.readthedocs.io/en/latest/generating-historical-context-information-sth-comet/how-to- generate-the-history-of-Context-Information-using-STH-Comet/ (old API. MongoDB based) § http://fiwaretourguide.readthedocs.io/en/latest/storing-data-cygnus-mysql/how-to-store-data-cygnus-mysql/ § https://github.com/smartsdk/ngsi-timeseries-api (NGSIv2 aligned, CrateDB, Grafana Ready!) § Harmonized Data Models (NGSIv2 flavour. Soon NGSI-LD) § https://schema.fiware.org
  • 44. Thank you! http://fiware.org Follow @FIWARE on Twitter José Manuel Cantera Fonseca FIWARE Foundation Senior Expert Josemanuel.cantera@fiware.org