diff --git a/NGSI-LD IoT Agent JSON.postman_collection.json b/NGSI-LD IoT Agent JSON.postman_collection.json index f30f095..74f395a 100644 --- a/NGSI-LD IoT Agent JSON.postman_collection.json +++ b/NGSI-LD IoT Agent JSON.postman_collection.json @@ -160,7 +160,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -242,7 +242,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -325,7 +325,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -504,7 +504,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -551,7 +551,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -594,7 +594,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" }, { @@ -667,7 +667,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -714,7 +714,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -757,7 +757,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" }, { @@ -829,7 +829,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -876,7 +876,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" } ], @@ -919,7 +919,7 @@ }, { "key": "Link", - "value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", + "value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"", "type": "text" }, { @@ -1483,8 +1483,8 @@ "value": "localhost:3001" }, { - "key": "ngsi-context.jsonld", - "value": "http://context/ngsi-context.jsonld" + "key": "user-context.jsonld", + "value": "http://context/user-context.jsonld" }, { "key": "scorpio", diff --git a/README.ja.md b/README.ja.md index fe4c327..f5b45da 100644 --- a/README.ja.md +++ b/README.ja.md @@ -534,10 +534,10 @@ Agent は最初に Context Broker がレスポンスしている URL を認識 ```console curl -iX POST 'http://localhost:4041/iot/services' \ --H 'fiware-service: openiot' \ --H 'fiware-servicepath: /' \ --H 'Content-Type: application/json' \ ---data-raw '{ + -H 'fiware-service: openiot' \ + -H 'fiware-servicepath: /' \ + -H 'Content-Type: application/json' \ + --data-raw '{ "services": [ { "apikey": "4jggokgpepnvsb2uv4s40d59ov", @@ -704,9 +704,9 @@ Context Broker からエンティティのデータを取得することで、 ```console curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:temperature001' \ - -H 'fiware-service: openiot' \ - -H 'fiware-servicepath: /' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'NGSILD-Tenant: openiot' \ + -H 'Accept: application/ld+json' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ -d 'attrs=temperature' ``` @@ -714,7 +714,10 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:te ```json { - "@context": "http://context/ngsi-context.jsonld", + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ], "id": "urn:ngsi-ld:Device:temperature001", "type": "Device", "temperature": { @@ -753,9 +756,9 @@ curl -iX POST 'http://localhost:7896/iot/json?k=4jggokgpepnvsb2uv4s40d59ov&i=mot ```console curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \ --H 'NGSILD-Tenant: openiot' \ --H 'NGSILD-Path: /' \ --H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' + -H 'NGSILD-Tenant: openiot' \ + -H 'Accept: application/ld+json' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' ``` #### レスポンス: @@ -763,7 +766,10 @@ curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \ ```json [ { - "@context": "http://context/ngsi-context.jsonld", + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ], "id": "urn:ngsi-ld:Device:motion003", "type": "Device", "c": { @@ -863,7 +869,7 @@ Irrigation system をオンにするコマンドの結果は、Context Broker ```console curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001' \ -H 'NGSILD-Tenant: openiot' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ -H 'Accept: application/json' ``` @@ -1032,7 +1038,7 @@ IoT Agent を IoT デバイスに接続すると、Orion Context Broker にコ curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001/attrs/on' \ -H 'NGSILD-Tenant: openiot' \ -H 'Content-Type: application/json' \ --H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ +-H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ --data-raw '{ "type": "Property", @@ -1057,7 +1063,7 @@ curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:w curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:tractor001/attrs/start' \ -H 'NGSILD-Tenant: openiot' \ -H 'Content-Type: application/json' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ --data-raw '{ "type": "Property", @@ -1078,7 +1084,7 @@ curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:t curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:filling001/attrs/add' \ -H 'NGSILD-Tenant: openiot' \ -H 'Content-Type: application/json' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ --data-raw '{ "type": "Property", diff --git a/README.md b/README.md index bc1d366..2bfda9a 100644 --- a/README.md +++ b/README.md @@ -701,9 +701,9 @@ add the `fiware-service` and `fiware-service-path` headers. ```console curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:temperature001' \ - -H 'fiware-service: openiot' \ - -H 'fiware-servicepath: /' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'NGSILD-Tenant: openiot' \ + -H 'Accept: application/ld+json' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ -d 'attrs=temperature' ``` @@ -711,7 +711,10 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:te ```json { - "@context": "http://context/ngsi-context.jsonld", + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ], "id": "urn:ngsi-ld:Device:temperature001", "type": "Device", "temperature": { @@ -752,9 +755,9 @@ based on the knowledge of the service group ```console curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \ --H 'NGSILD-Tenant: openiot' \ --H 'NGSILD-Path: /' \ --H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' + -H 'NGSILD-Tenant: openiot' \ + -H 'Accept: application/ld+json' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' ``` #### Response: @@ -762,7 +765,10 @@ curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \ ```json [ { - "@context": "http://context/ngsi-context.jsonld", + "@context": [ + "http://context/ngsi-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld" + ], "id": "urn:ngsi-ld:Device:motion003", "type": "Device", "c": { @@ -863,7 +869,7 @@ The result of the command to turn on the irrigation system can be read by queryi ```console curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001' \ -H 'NGSILD-Tenant: openiot' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ -H 'Accept: application/json' ``` @@ -909,10 +915,10 @@ both `attributes` and `command` attributes in the body of the request. ```console curl -L -X POST 'http://localhost:4041/iot/devices' \ --H 'fiware-service: openiot' \ --H 'fiware-servicepath: /' \ --H 'Content-Type: application/json' \ ---data-raw '{ + -H 'fiware-service: openiot' \ + -H 'fiware-servicepath: /' \ + -H 'Content-Type: application/json' \ + --data-raw '{ "devices": [ { "device_id": "filling001", @@ -968,7 +974,7 @@ curl -L -X POST 'http://localhost:4041/iot/devices' \ -H 'fiware-service: openiot' \ -H 'fiware-servicepath: /' \ -H 'Content-Type: application/json' \ ---data-raw '{ + --data-raw '{ "devices": [ { "device_id": "tractor001", @@ -1025,7 +1031,7 @@ To invoke the `on` command, the `on` attribute must be updated in the context. curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001/attrs/on' \ -H 'NGSILD-Tenant: openiot' \ -H 'Content-Type: application/json' \ --H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ +-H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ --data-raw '{ "type": "Property", @@ -1048,7 +1054,7 @@ To invoke the `start` command, the `start` attribute must be updated in the cont curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:tractor001/attrs/start' \ -H 'NGSILD-Tenant: openiot' \ -H 'Content-Type: application/json' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ --data-raw '{ "type": "Property", @@ -1067,7 +1073,7 @@ Change the state of the **Fillling System**, the `add` attribute must be updated curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:filling001/attrs/add' \ -H 'NGSILD-Tenant: openiot' \ -H 'Content-Type: application/json' \ - -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ + -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ --data-raw '{ "type": "Property", diff --git a/data-models/user-context.jsonld b/data-models/user-context.jsonld new file mode 100644 index 0000000..952032a --- /dev/null +++ b/data-models/user-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": [ + "http://context/user-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld" + ] +} \ No newline at end of file diff --git a/docker-compose/common.yml b/docker-compose/common.yml index a62d6e5..2b00dec 100644 --- a/docker-compose/common.yml +++ b/docker-compose/common.yml @@ -34,7 +34,7 @@ services: target: /usr/local/apache2/conf/mime.types read_only: true healthcheck: - test: (wget --server-response --spider --quiet http://ld-context/ngsi-context.jsonld 2>&1 | awk 'NR==1{print $$2}'| grep -q -e "200") || exit 1 + test: (wget --server-response --spider --quiet http://context/user-context.jsonld 2>&1 | awk 'NR==1{print $$2}'| grep -q -e "200") || exit 1 # Databases mongo-db: @@ -91,7 +91,7 @@ services: - IOTA_DEFAULT_RESOURCE=/iot/json - IOTA_CB_NGSI_VERSION=ld # use NGSI-LD when sending updates for active attributes - - IOTA_JSON_LD_CONTEXT=http://context/ngsi-context.jsonld + - IOTA_JSON_LD_CONTEXT=http://context/user-context.jsonld - IOTA_FALLBACK_TENANT=openiot - IOTA_MULTI_CORE=true healthcheck: diff --git a/import-data b/import-data index 2247f37..29b0033 100755 --- a/import-data +++ b/import-data @@ -98,7 +98,7 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOper echo -e "Registering Farmer and Devices as data sources.\n" curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/csourceRegistrations/' \ --H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \ +-H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \ -H 'Content-Type: application/json' \ -d '{ "type": "ContextSourceRegistration", @@ -120,7 +120,7 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/csourceReg curl -s -o /dev/null -X POST 'http://farmer/ngsi-ld/v1/csourceRegistrations/' \ --H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \ +-H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \ -H 'Content-Type: application/json' \ -d '{ "type": "ContextSourceRegistration",