{"info":{"_postman_id":"05e4b8a2-b7fd-4689-afd4-efb71cc2f17e","name":"FIWARE Entity Relationships","description":"This tutorial builds on the data created in the previous [store finder example](http://fiware.github.io/tutorials.Getting-Started/) and creates and associates a series of related data entities to create a simple stock management system.\n\nThe `docker-compose` file for this tutorial can be found on GitHub: \n\n![GitHub](https://fiware.github.io/tutorials.Entity-Relationships/icon/GitHub-Mark-32px.png) [FIWARE 102: Batch Commands and Entity Relationships](https://github.com/Fiware/tutorials.Entity-Relationships)\n\n# Data Entities\n\nWithin the FIWARE platform, an entity represents the state of a physical or conceptural object which exists in the real world.\n\n## Entities within a stock management system\n\nFor a simple stock management system, we will only need four types of entity. The relationship between our entities is defined as shown:\n\n![](https://fiware.github.io/tutorials.Entity-Relationships/img/entities.png)\n\n* A **Store** is a real world bricks and mortar building. Stores would have properties such as:\n  + A name of the store e.g. \"Checkpoint Markt\"\n  + An address \"Friedrichstraße 44, 10969 Kreuzberg, Berlin\"\n  + A phyiscal location  e.g. *52.5075 N, 13.3903 E*\n* A **Shelf** is a real world device to hold objects which we wish to sell. Each shelf would have properties such as:\n  + A name of the shelf e.g. \"Wall Unit\"\n  + A phyiscal location  e.g. *52.5075 N, 13.3903 E*\n  + A maximum capacity\n  + An association to the store in which the shelf is present\n* A **Product** is defined as something that we sell - it is conceptural object. Products would have properties such as:\n  + A name of the product e.g. \"Vodka\"\n  + A price e.g. 13.99 Euros\n  + A size e.g. Small\n* An **Inventory Item** is another conceptural entity, used to assocate products, stores, shelves and physical objects. It would have properties such as:\n  + An assocation to the product being sold\n  + An association to the store in which the product is being sold\n  + An association to the shelf where the product is being displayed\n  + A stock count of the quantity of the product available in the warehouse\n  + A stock count of the quantity of the product available on the shelf\n\n\nAs you can see, each of the entities defined above contain some properties which are liable to change. A product could change its price, stock could be sold and the shelf count of stock could be reduced and so on.\n\n\n# Architecture\n\nThis application will only make use of one FIWARE component - the [Orion Context Broker](https://catalogue.fiware.org/enablers/publishsubscribe-context-broker-orion-context-broker). Usage of the Orion Context Broker is sufficient for an application to qualify as *“Powered by FIWARE”*.\n\nCurrently, the Orion Context Broker relies on open source [MongoDB](https://www.mongodb.com/) technology to keep persistence of the context data it holds. Therefore, the architecture will consist of two elements:\n\n* The Orion Context Broker server which will receive requests using NGSI\n* The underlying MongoDB database associated to the Orion Context Broker server\n\nSince all interactions between the two elements are initiated by HTTP requests, the entities can be containerized and run from exposed ports. \n\n![](https://fiware.github.io/tutorials.Entity-Relationships/img/architecture.png)\n\nThe necessary configuration information can be seen in the services section of the associated `docker-compose.yml`  file:\n\n```yaml\n  orion:\n    image: fiware/orion:latest\n    hostname: orion\n    container_name: orion\n    depends_on:\n      - context-db\n    networks:\n        - default\n    expose:\n        - \"1026\"\n    ports:\n        - \"1026:1026\"\n    command: -dbhost context-db -logLevel DEBUG\n```\n\n```yaml\n  context-db:\n    image: mongo:3.6\n    hostname: context-db\n    container_name: context-db\n    expose:\n        - \"27017\"\n    ports:\n        - \"27017:27017\"\n    networks:\n        - default\n    command: --bind_ip_all --smallfiles\n```\n\nBoth containers are residing on the same network - the Orion Context Broker is listening on Port `1026` \nand MongoDB is listening on the default port `271071`. Both containers are also exposing the same ports\nexternally - this is purely for the tutorial access - so that cUrl or Postman can access them without\nbeing part of the same network. The command line initialization should be self explanatory.\n\n# Prerequisites\n\n## Docker\n\nTo keep things simple both components will be run using [Docker](https://www.docker.com). **Docker** is a container technology which allows to different components isolated into their respective environments. \n\n* To install Docker on Windows follow the instructions [here](https://docs.docker.com/docker-for-windows/)\n* To install Docker on Mac follow the instructions [here](https://docs.docker.com/docker-for-mac/)\n* To install Docker on Linux follow the instructions [here](https://docs.docker.com/install/)\n\n**Docker Compose** is a tool for defining and running multi-container Docker applications. A [YAML file](https://raw.githubusercontent.com/Fiware/tutorials.Entity-Relationships/master/docker-compose.yml) is used configure the required\nservices for the application. This means all container sevices can be brought up in a single commmand. Docker Compose is installed by default as part of Docker for Windows and  Docker for Mac, however Linux users will need to follow the instructions found [here](https://docs.docker.com/compose/install/)\n\n## Cygwin \n\nWe will start up our services using a simple bash script. Windows users should download [cygwin](www.cygwin.com) to provide a command line functionality similar to a Linux distribution on Windows. \n\n\n# Start Up\n\nAll services can be initialised from the command line by running the bash script provided within the repository:\n\n```bash\n./services start\n```","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item":[{"name":"Re-create two Stores (optional)","id":"97eded23-bad2-4687-9288-8c26a84f5c24","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"actionType\": \"APPEND\",\n  \"entities\": [\n    {\n    \t\"type\": \"Store\",\n    \t\"id\": \"urn:ngsi-ld:Store:001\",\n    \t\"address\": {\n        \"type\": \"PostalAddress\",\n        \"value\": {\n            \"streetAddress\": \"Bornholmer Straße 65\",\n            \"addressRegion\": \"Berlin\",\n            \"addressLocality\": \"Prenzlauer Berg\",\n            \"postalCode\": \"10439\"\n\t        }\n\t    },\n\t    \"location\": {\n\t        \"type\": \"geo:json\",\n\t        \"value\": {\n\t           \"type\": \"Point\",\n\t           \"coordinates\": [13.3986, 52.5547]\n\t        }\n\t    },\n    \t\"name\": {\n        \t\"type\": \"Text\",\n        \t\"value\": \"Bösebrücke Einkauf\"\n    \t}\n    },\n    {\n    \t\"type\": \"Store\",\n        \"id\": \"urn:ngsi-ld:Store:002\",\n\t    \"address\": {\n\t        \"type\": \"PostalAddress\",\n\t        \"value\": {\n\t            \"streetAddress\": \"Friedrichstraße 44\",\n\t            \"addressRegion\": \"Berlin\",\n\t            \"addressLocality\": \"Kreuzberg\",\n\t            \"postalCode\": \"10969\"\n\t        }\n\t    },\n\t    \"location\": {\n\t        \"type\": \"geo:json\",\n\t        \"value\": {\n\t             \"type\": \"Point\",\n\t             \"coordinates\": [13.3903, 52.5075]\n\t        }\n\t    },\n\t    \"name\": {\n\t        \"type\": \"Text\",\n\t        \"value\": \"Checkpoint Markt\"\n\t    }\n    }\n  ]\n}"},"url":"http://{{orion}}/v2/op/update","description":"This example uses the convenience batch processing endpoint to re-create the two **Store** entities from the previous tutorial.\n\nBatch processing uses the `/v2/op/update` endpoint with a payload with two attributes - `actionType=APPEND` means we will overwrite existing entities if they exist whereas the  `entities` attribute holds an array of entities we wish to update.\n\nAs you can see each **Store** entity in the payload has been given a unique `id` (according to the NGSI-LD [draft recommendation](https://docbox.etsi.org/ISG/CIM/Open/ISG_CIM_NGSI-LD_API_Draft_for_public_review.pdf)) and assigned `type=Store`."},"response":[],"_postman_id":"97eded23-bad2-4687-9288-8c26a84f5c24"},{"name":"Create Four Products","id":"6d6afb86-b234-4881-a45d-b594c95407f4","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"actionType\":\"APPEND\",\n  \"entities\":[\n    {\n      \"id\":\"urn:ngsi-ld:Product:001\", \"type\":\"Product\",\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Beer\"\n      },\n      \"size\":{\n        \"type\":\"Text\", \"value\": \"S\"\n      },\n      \"price\":{\n        \"type\":\"Integer\", \"value\": 99\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Product:002\", \"type\":\"Product\",\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Red Wine\"\n      },\n      \"size\":{\n        \"type\":\"Text\", \"value\": \"M\"\n      },\n      \"price\":{\n        \"type\":\"Integer\", \"value\": 1099\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Product:003\", \"type\":\"Product\",\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"White Wine\"\n      },\n      \"size\":{\n        \"type\":\"Text\", \"value\": \"M\"\n      },\n      \"price\":{\n        \"type\":\"Integer\", \"value\": 1499\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Product:004\", \"type\":\"Product\",\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Vodka\"\n      },\n      \"size\":{\n        \"type\":\"Text\", \"value\": \"XL\"\n      },\n      \"price\":{\n        \"type\":\"Integer\", \"value\": 5000\n      }\n    }\n  ]\n}"},"url":"http://{{orion}}/v2/op/update","description":"This example uses the convenience batch processing endpoint to create a series of available products.\n\nBatch processing uses the `/v2/op/update` endpoint with a payload with two attributes - `actionType=APPEND` means we will overwrite existing entities if they exist whereas the `entities` attribute holds an array of entities we wish to update.\n\nEach product has a unique `id` following the NGSI-LD  [draft recommendation](https://docbox.etsi.org/ISG/CIM/Open/ISG_CIM_NGSI-LD_API_Draft_for_public_review.pdf)  and has been assigned `type=Product`."},"response":[],"_postman_id":"6d6afb86-b234-4881-a45d-b594c95407f4"},{"name":"Create Five Shelf Units","id":"6f8a51e3-5ae2-4e85-8292-f4fd5d8877b0","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"actionType\":\"APPEND\",\n  \"entities\":[\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit001\", \"type\":\"Shelf\",\n      \"location\":{\n        \"type\":\"geo:json\", \"value\":{ \"type\":\"Point\",\"coordinates\":[13.3986112, 52.554699]}\n      },\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Corner Unit\"\n      },\n      \"maxCapacity\":{\n        \"type\":\"Integer\", \"value\":50\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit002\", \"type\":\"Shelf\",\n      \"location\":{\n        \"type\":\"geo:json\",\"value\":{\"type\":\"Point\",\"coordinates\":[13.3987221, 52.5546640]}\n      },\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Wall Unit 1\"\n      },\n      \"maxCapacity\":{\n        \"type\":\"Integer\", \"value\":100\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit003\", \"type\":\"Shelf\",\n      \"location\":{\n        \"type\":\"geo:json\", \"value\":{\"type\":\"Point\",\"coordinates\":[13.3987221, 52.5546640]}\n      },\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Wall Unit 2\"\n      },\n      \"maxCapacity\":{\n        \"type\":\"Integer\", \"value\":100\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit004\", \"type\":\"Shelf\",\n      \"location\":{\n        \"type\":\"geo:json\", \"value\":{\"type\":\"Point\",\"coordinates\":[13.390311, 52.507522]}\n      },\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Corner Unit\"\n      },\n      \"maxCapacity\":{\n        \"type\":\"Integer\", \"value\":50\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit005\", \"type\":\"Shelf\",\n      \"location\":{\n        \"type\":\"geo:json\",\"value\":{\"type\":\"Point\",\"coordinates\":[13.390309, 52.50751]}\n      },\n      \"name\":{\n        \"type\":\"Text\", \"value\":\"Long Wall Unit\"\n      },\n      \"maxCapacity\":{\n        \"type\":\"Integer\", \"value\":200\n      }\n    }\n  ]\n}"},"url":"http://{{orion}}/v2/op/update","description":"This example uses the convenience batch processing endpoint to create the five shelf entities.\n\nBatch processing uses the `/v2/op/update` endpoint with a payload with two attributes - `actionType=APPEND` means we will overwrite existing entities if they exist whereas the  `entities` attribute holds an array of entities we wish to update.\n\nTo differenciate **Shelf** Entities from **Store** Entities, each shelf has been assigned `type=Shelf`. The `id` of each **Shelf** Entity follows the NGSI-LD  [draft recommendation](https://docbox.etsi.org/ISG/CIM/Open/ISG_CIM_NGSI-LD_API_Draft_for_public_review.pdf) and is therefore unique.\n\nReal-world properties such as `name` and `location` have been addded as properties to each shelf."},"response":[],"_postman_id":"6f8a51e3-5ae2-4e85-8292-f4fd5d8877b0"},{"name":"Obtain Shelf Information","id":"68ea01ec-7f2d-43e3-81c8-2e14f65cc36a","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":{"raw":"http://{{orion}}/v2/entities/urn:ngsi-ld:Shelf:unit001/?options=keyValues","protocol":"http","host":["{{orion}}"],"path":["v2","entities","urn:ngsi-ld:Shelf:unit001",""],"query":[{"key":"type","value":"Shelf","description":"Entity type","disabled":true},{"key":"options","value":"keyValues","description":"* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values  `attrs`  for an ordered list of attributes only"}]},"description":"This example returns the context data of the *Shelf* entity with the `id=urn:ngsi-ld:Shelf:unit001`.\n\nThere are currently three additional property attributes present `location`, `maxCapacity` and `name`"},"response":[],"_postman_id":"68ea01ec-7f2d-43e3-81c8-2e14f65cc36a"},{"name":"Adding a Foreign Key Relationship","id":"d65c3b44-38b6-40ae-9b25-0fd208785b7e","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"actionType\":\"APPEND\",\n  \"entities\":[\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit001\", \"type\":\"Shelf\",\n      \"refStore\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:001\"\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit002\", \"type\":\"Shelf\",\n      \"refStore\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:001\"\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit003\", \"type\":\"Shelf\",\n      \"refStore\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:001\"\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit004\", \"type\":\"Shelf\",\n      \"refStore\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:002\"\n      }\n    },\n    {\n      \"id\":\"urn:ngsi-ld:Shelf:unit005\", \"type\":\"Shelf\",\n      \"refStore\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:002\"\n      }\n    }\n  ]\n}"},"url":"http://{{orion}}/v2/op/update","description":"This example uses batch processing to amend the existing the **Shelf** entities to add a `refStore` relationship to each shelf. According to the FIWARE Data Modelling Guidelines on [linked data](http://fiware-datamodels.readthedocs.io/en/latest/guidelines/index.html#modelling-linked-data), when an entity attribute is used as a link to other entities  it should be named with the prefix `ref` plus the name of the target (linked) entity type. \n\nBatch processing uses the `/v2/op/update` endpoint with a payload with two attributes - `actionType=APPEND` means we will overwrite existing entities if they exist whereas the  `entities` attribute holds an array of entities we wish to update.\n\nThe value corresponds to a URN associated to an existing **Store** entity within the context."},"response":[],"_postman_id":"d65c3b44-38b6-40ae-9b25-0fd208785b7e"},{"name":"Obtain Updated Shelf Information","id":"4010848f-f739-4d07-8870-700ce2641477","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":{"raw":"http://{{orion}}/v2/entities/urn:ngsi-ld:Shelf:unit001/?options=keyValues","protocol":"http","host":["{{orion}}"],"path":["v2","entities","urn:ngsi-ld:Shelf:unit001",""],"query":[{"key":"type","value":"Shelf","description":"Entity type","disabled":true},{"key":"options","value":"keyValues","description":"* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values  `attrs`  for an ordered list of attributes only"}]},"description":"This example returns the context data of the `Shelf` entity with the `id=urn:ngsi-ld:Shelf:unit001`.\n\nThe response now includes a new relationship property `refStore`, which has been added in the previous step."},"response":[],"_postman_id":"4010848f-f739-4d07-8870-700ce2641477"},{"name":"Obtain a Foreign Key URN","id":"e808d05c-9e42-4429-b8da-bc1c35e230c5","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":{"raw":"http://{{orion}}/v2/entities/urn:ngsi-ld:Shelf:unit001/?options=values&attrs=refStore","protocol":"http","host":["{{orion}}"],"path":["v2","entities","urn:ngsi-ld:Shelf:unit001",""],"query":[{"key":"type","value":"Shelf","description":"Entity type","disabled":true},{"key":"options","value":"values","description":"* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values  `attrs`  for an ordered list of attributes only"},{"key":"attrs","value":"refStore","description":"Ordered list of attribute names to display"}]},"description":"This example returns the `refStore` value associated with a given `Shelf` unit. \n\nIf the `id` and `type` of a data entity are known, a specific field can be requested by combining the `options=values` parameter and the `attrs` parameter. \n\nThe URN returned has a standard format: `urn:ngsi-ld:<entity-type>:<entity-id>`, which has been used as the `id` of the **Store** entity itself (based on the NGSI-LD [draft recommendation](https://docbox.etsi.org/ISG/CIM/Open/ISG_CIM_NGSI-LD_API_Draft_for_public_review.pdf)), therefore it is a simple matter to request more information about the linked store by making a query to the `/entities` endpoint.\n\n```\nhttp://{{orion}}/v2/entities/urn:ngsi-ld:Store:001?options=keyValues\n```"},"response":[],"_postman_id":"e808d05c-9e42-4429-b8da-bc1c35e230c5"},{"name":"Obtain all Shelf Units found within a Store","id":"4495d116-6f78-4b7d-bb5d-3e34059e16c8","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":{"raw":"http://{{orion}}/v2/entities/?q=refStore==urn:ngsi-ld:Store:001&type=Shelf&options=values&attrs=name","protocol":"http","host":["{{orion}}"],"path":["v2","entities",""],"query":[{"key":"q","value":"refStore==urn:ngsi-ld:Store:001"},{"key":"type","value":"Shelf","description":"Entity type"},{"key":"options","value":"values","description":"* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values  `attrs`  for an ordered list of attributes only"},{"key":"attrs","value":"name","description":"Ordered list of attribute names to display"}]},"description":"This example returns the `name` of all `Shelf` entities associated with the `shop1`.\n\nThe value of the query parameter `q` holds a URN of the form `urn:ngsi-ld:<entity-type>:<entity-id>` which corresponds to the the Relationship URN in order to filter the information returned."},"response":[],"_postman_id":"4495d116-6f78-4b7d-bb5d-3e34059e16c8"},{"name":"Putting a Product onto  a shelf","id":"a0246746-38d8-4794-91e0-9a9d7a7acf34","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"id\": \"urn:ngsi-ld:InventoryItem:001\", \"type\": \"InventoryItem\",\n    \"refStore\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:001\"\n    },\n    \"refShelf\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Shelf:unit001\"\n    },\n    \"refProduct\": { \n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Product:001\"\n    },\n    \"stockCount\":{\n        \"type\":\"Integer\", \"value\": 10000\n    },\n    \"shelfCount\":{\n        \"type\":\"Integer\", \"value\": 50\n    }\n}"},"url":"http://{{orion}}/v2/entities/","description":"The **InventoryItem** entity exists to associate data from other entities.  It has a foreign key relationship to the **Store**, **Shelf** and **Product** entities and therefore requires relationship attributes called `refStore`, `refShelf` and `refProduct`.\n\nAssigning a product to a shelf is simply a  create an entity holding the relationship information and any other additional properties (such as `stockCount` and `shelfCount`)."},"response":[],"_postman_id":"a0246746-38d8-4794-91e0-9a9d7a7acf34"},{"name":"Find all stores in which a product is sold","id":"c6995610-613a-4ec7-a39d-13fc922d7b6e","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":{"raw":"http://{{orion}}/v2/entities/?q=refProduct==urn:ngsi-ld:Product:001&options=values&attrs=refStore&type=InventoryItem","protocol":"http","host":["{{orion}}"],"path":["v2","entities",""],"query":[{"key":"q","value":"refProduct==urn:ngsi-ld:Product:001"},{"key":"options","value":"values","description":"* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values  `attrs`  for an ordered list of attributes only\n"},{"key":"attrs","value":"refStore","description":"Ordered list of attribute names to display"},{"key":"type","value":"InventoryItem","description":"Entity type"}]},"description":"This example returns the URN of all stores in which the product `id=urn:ngsi-ld:Product:001` is sold. The URN returned has a standard format: `urn:ngsi-ld:<entity-type>:<entity-id>`.\n\nBecause we have based the `id` of the **Store** entity on the NGSI-LD [draft recommendation](https://docbox.etsi.org/ISG/CIM/Open/ISG_CIM_NGSI-LD_API_Draft_for_public_review.pdf)), therefore it is a simple matter to request more information about the linked store by making a query to the `/entities` endpoint.\n\n```\nhttp://{{orion}}/v2/entities/urn:ngsi-ld:Store:001?options=keyValues\n```\n\nSince there is no direct relationship between product and store, a query must be made to find all entities which have both `refProduct` and `refStore` attributes.\n\nIn  our current context the `type` parameter is optional since only one type of entity contains the fields requested in the request"},"response":[],"_postman_id":"c6995610-613a-4ec7-a39d-13fc922d7b6e"},{"name":"Find all Entities related to a Store","id":"8395a892-e980-44d0-8848-d2245cdf8c1c","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":"{\n  \"actionType\": \"APPEND\",\n  \"entities\": [\n    {\n    \"id\": \"7770\",\n    \"type\": \"Shelf\",\n    \"store\": { \n      \"type\": \"Relationship\",\n      \"value\": \"urn:ngsi-ld:Store:store1\"\n    },\n    \"location\": {\n        \"type\": \"geo:json\",\n        \"value\": {\n           \"type\": \"Point\",\n           \"coordinates\": [13.3986112, 52.554699]\n        }\n    },\n    \"name\": {\n        \"type\": \"Text\",\n        \"value\": \"Corner Unit\"\n    },\n    \"maxCapacity\": {\n        \"type\": \"Integer\",\n        \"value\": 50\n    }\n},\n\n {\n      \"id\": \"7771\",\n      \"type\": \"Shelf\",\n      \"store\": {\n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:store1\"\n      },\n      \"location\": {\n        \"type\": \"geo:json\",\n        \"value\": {\n          \"type\": \"Point\",\n          \"coordinates\": [\n            13.3987221,\n            52.5546640\n          ]\n        }\n      },\n      \"name\": {\n        \"type\": \"Text\",\n        \"value\": \"Wall Unit 1\"\n      },\n      \"maxCapacity\": {\n        \"type\": \"Integer\",\n        \"value\": 100\n      }\n    },\n    \n    {\n      \"id\": \"7772\",\n      \"type\": \"Shelf\",\n      \"store\": {\n        \"type\": \"Relationship\",\n        \"value\": \"urn:ngsi-ld:Store:store1\"\n      },\n      \"location\": {\n        \"type\": \"geo:json\",\n        \"value\": {\n          \"type\": \"Point\",\n          \"coordinates\": [\n            13.3987221,\n            52.5546640\n          ]\n        }\n      },\n      \"name\": {\n        \"type\": \"Text\",\n        \"value\": \"Wall Unit 2\"\n      },\n      \"maxCapacity\": {\n        \"type\": \"Integer\",\n        \"value\": 100\n      }\n    }\n    \n    \n\n\n\n\n  ]\n}"},"url":{"raw":"http://{{orion}}/v2/entities/?q=refStore==urn:ngsi-ld:Store:001&options=count&attrs=type","protocol":"http","host":["{{orion}}"],"path":["v2","entities",""],"query":[{"key":"q","value":"refStore==urn:ngsi-ld:Store:001"},{"key":"options","value":"count","description":"* `keyValues` option in order to get a more compact and brief representation, including just attribute values\n* `values` option combined with a list of attribute values  `attrs`  for an ordered list of attributes only"},{"key":"attrs","value":"type","description":"Ordered list of attribute names to display"}]},"description":"This example returns the key of all entities directly associated with the `urn:ngsi-ld:Store:001`.\n\nThe response lists a series of Shelf and InventoryItem entities - there are no products since there is no direct relationship between product and store.\n\nIf this request returns an empty array, the entity has no associates."},"response":[],"_postman_id":"8395a892-e980-44d0-8848-d2245cdf8c1c"}],"event":[{"listen":"prerequest","script":{"id":"f1d42f27-1cae-4144-b06e-237fad09b51b","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"028325fa-d62b-4d7a-afbf-5b138040015a","type":"text/javascript","exec":[""]}}],"variable":[{"id":"73b7c194-97af-4388-81ee-6dce0839c507","key":"orion","value":"localhost:1026","type":"string"}]}