NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query...
Transcript of NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query...
![Page 1: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/1.jpg)
Co-funded by the Horizon 2020 Framework Programme of the European Union
Co-funded by the Horizon 2020 Framework Programme of the European Union
NGSI V2 API
![Page 2: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/2.jpg)
Co-funded by the Horizon 2020 Framework Programme of the European Union
Orion Context Broker
![Page 3: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/3.jpg)
Co-funded by the Horizon 2020 Framework Programme of the European Union
Context Broker Operations
![Page 4: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/4.jpg)
4
FIWARE NGSI
![Page 5: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/5.jpg)
5
Context Data
![Page 6: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/6.jpg)
6
MIME Types The API response payloads in this specification
are based on application/json and (for attribute value type operation) text/plainMIME types. Clients issuing HTTP requests with accept types different than those will get a 406 Not Acceptable error.
![Page 7: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/7.jpg)
7
Entity Representation The entity id is specified by the object's id property,
whose value is a string containing the entity id. The entity type is specified by the object's type
property, whose value is a string containing the entity's type name.
Entity attributes are specified by additional properties, whose names are the name of the attribute and whose representation is described in the "JSON Attribute Representation" section below. Obviously, id and typeare not allowed to be used as attribute names.
![Page 8: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/8.jpg)
8
Entity Representation
![Page 9: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/9.jpg)
9
JSON Attribute Representation The attribute value is specified by the value property,
whose value may be any JSON datatype. The attribute NGSI type is specified by the type
property, whose value is a string containing the NGSI type.
The attribute metadata is specified by the metadataproperty. Its value is another JSON object which contains a property per metadata element defined (the name of the property is the name of the metadata element)
![Page 10: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/10.jpg)
10
JSON Attribute Representation
![Page 11: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/11.jpg)
11
Simplified Entity Representation keyValues mode. This mode represents the
entity attributes by their values only, leaving out the information about type and metadata. See example below.
![Page 12: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/12.jpg)
12
Simplified Entity Representation values mode. This mode represents the entity
as an array of attribute values.
![Page 13: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/13.jpg)
13
Special Attribute Types DateTime: identifies dates, in ISO8601 format.
These attributes can be used with the query operators greater-than, less-than, greater-or-equal, less-or-equal and range. For instance (only the referred entity attribute is shown):
![Page 14: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/14.jpg)
14
Virtual Attributes inside of options:
dateCreated (type:DateTime) ISO 8601. dateModified (type:DateTime) ISO 8601.
Like regular attributes, the can be used in attrs, q filters and order by.
![Page 15: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/15.jpg)
Common Operations
![Page 16: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/16.jpg)
Common Operations
![Page 17: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/17.jpg)
Follow the steps at
https://codeshare.io/5X8egM
![Page 18: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/18.jpg)
Check Health
![Page 19: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/19.jpg)
Create Entities
![Page 20: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/20.jpg)
Add Entity
![Page 21: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/21.jpg)
Get Entity
![Page 22: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/22.jpg)
Update Entities
![Page 23: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/23.jpg)
Update Entity
![Page 24: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/24.jpg)
Update Entity
![Page 25: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/25.jpg)
Update Entity – text/plain
![Page 26: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/26.jpg)
Create Room
![Page 27: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/27.jpg)
Metadata
![Page 28: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/28.jpg)
Update Room
![Page 29: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/29.jpg)
Query Room
![Page 30: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/30.jpg)
Query Room
![Page 31: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/31.jpg)
Query Room
![Page 32: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/32.jpg)
Filter Room
![Page 33: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/33.jpg)
Filter Room
![Page 34: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/34.jpg)
Exercise Create the entities using the global
instance.
![Page 35: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/35.jpg)
Hands on – Create Entities
![Page 36: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/36.jpg)
![Page 37: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/37.jpg)
Hands on – Update Entities
![Page 38: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/38.jpg)
Exercise Updates Locked attribute of Frontdoor
entity using a valid input. Queries the entity and check the result.
![Page 39: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/39.jpg)
Query Language
![Page 40: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/40.jpg)
40
Query Language inside of options:
dateCreated (type:DateTime) ISO 8601. dateModified (type:DateTime) ISO 8601.
Like regular attributes, the can be used in attrs, q filters and order by.
![Page 41: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/41.jpg)
41
Query Filters
![Page 42: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/42.jpg)
42
Query Filters
![Page 43: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/43.jpg)
43
![Page 44: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/44.jpg)
Hands on – Query Entities
![Page 45: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/45.jpg)
Exercise Obtain all attributes of Bedroom1 entity. Obtain only the Temperature attribute of
Kitchen entity. Obtain all attributes of Kitchen and
Bedroom2 entities in one query. Obtain all attributes of entities that match
the pattern Bedroom.*
![Page 46: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/46.jpg)
Exercise - Finally Find out whether the doors are closed
using the pattern .*door and the Closedattribute
![Page 47: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/47.jpg)
Suscriptions
![Page 48: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/48.jpg)
Hands on – Update Entities
![Page 49: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/49.jpg)
Exercise Updates the Temperature attribute of
Beedroom1 and Bedroom2 entities using that input with a single update operation.
Queries the entities and check the result.
![Page 50: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/50.jpg)
Hands on – Create Entities (Again)
![Page 51: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/51.jpg)
Exercise
![Page 52: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/52.jpg)
Hands on – List Entity Types
![Page 53: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/53.jpg)
Exercise Lists all entity types Provides detailed information of type
Door
![Page 54: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/54.jpg)
Geo Localization
![Page 55: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/55.jpg)
Geo-location
![Page 56: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/56.jpg)
More geo-relationships Apart from near, the following georel can
be used georel=coveredBy georel=intersects georel=equals georel=disjoint
![Page 57: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/57.jpg)
Example Let consider the next elementos:
![Page 58: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/58.jpg)
Example Let´s consider a query whose scope is the
internal area to the square defined by coordinates (0,0) , (0,6) , (6,6) and (6,0)
![Page 59: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/59.jpg)
The result of the query isA and B
![Page 60: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/60.jpg)
Example Let´s consider a query whose scope is the
internal area to the rectangle defined by coordinates (3,3) , (3,8) , (11,8) and (11,3)
![Page 61: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/61.jpg)
The result of the query isB and C
![Page 62: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/62.jpg)
Example if we consider the query to the external
area to that rectangle, the result of the query would be A. To specify that, we refer to the area external to the polygon we include the inverted element set to “true”
![Page 63: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/63.jpg)
![Page 64: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/64.jpg)
Example Let´s consider a query whose scope is the
internal area to the triangle defined by coordinates (0,0), (0,6), (6,0).
![Page 65: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/65.jpg)
![Page 66: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/66.jpg)
Example However, if we consider the query to the
external area to that triangle (using the inverted element set to “true”), the result of the query would be B and C.
![Page 67: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/67.jpg)
![Page 68: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/68.jpg)
Real Use Case Three entities (representing the cities of
Madrid, Alcobendas and Leganes) have been created in Orion Context Broker.
The coordinates for Madrid are (40.418889, -3.691944); the coordinates for Alcobendas are (40.533333, -3.633333) and the coordinates for Leganes are (40.316667, -3.75).
![Page 69: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/69.jpg)
Real Use Case Let's consider a query whose scope is
inside a radius of 13.5 km (13500 meters) centred in Madrid.
![Page 70: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/70.jpg)
Geo-location- Max distance
![Page 71: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/71.jpg)
The query is:
![Page 72: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/72.jpg)
Geo-location- Inverted
![Page 73: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/73.jpg)
Geo-location- Min distance
![Page 74: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/74.jpg)
Hands on – Geo Location
![Page 75: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/75.jpg)
Batch Operations
![Page 76: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/76.jpg)
Batch Operations
![Page 77: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/77.jpg)
Pagination
![Page 78: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/78.jpg)
Elements limit: Number of elements per page (default:
20, max: 1000) offset: Number of elements to skip (default: 0) count (optional): Returns total elements
(default: not return)
![Page 79: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/79.jpg)
Example
GET <orion_host>:1026/v2/entities?limit=5 GET <orion_host>:1026/v2/entities?offset=5&limit=5 GET <orion_host>:1026/v2/entities?offset=10&limit=5 GET <orion_host>:1026/v2/entities?offset=15&limit=5
![Page 80: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/80.jpg)
Considerations: By default, results are ordered by entity
creation date This behavior can be overridden using
orderBy URI parameter Example: get the first 10 entities ordered
by temp in ascending order, then humidity in descending order
GET <orion_host>:1026/v2/entities?limit=20&offset=0&orderBy=temp,!humidity
![Page 81: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/81.jpg)
Considerations (Continues..) dateCreated and dateModified can be
used to ordering by entity creation and modification date, respectively
![Page 82: NGSI V2 API - CUDI. Context... · inverted element set to “true”), the result of the query would be . B. and . C. ... Presentación de PowerPoint Author: Erik Valdivieso Díaz](https://reader036.fdocuments.us/reader036/viewer/2022081613/5fb9d3f9fe680d4ccc276121/html5/thumbnails/82.jpg)
The end