Skip to content

Commit 3170912

Browse files
committed
Use user-context
1 parent da00bf1 commit 3170912

6 files changed

Lines changed: 69 additions & 51 deletions

File tree

NGSI-LD IoT Agent JSON.postman_collection.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
},
161161
{
162162
"key": "Link",
163-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
163+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
164164
"type": "text"
165165
}
166166
],
@@ -242,7 +242,7 @@
242242
},
243243
{
244244
"key": "Link",
245-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
245+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
246246
"type": "text"
247247
}
248248
],
@@ -325,7 +325,7 @@
325325
},
326326
{
327327
"key": "Link",
328-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
328+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
329329
"type": "text"
330330
}
331331
],
@@ -504,7 +504,7 @@
504504
},
505505
{
506506
"key": "Link",
507-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
507+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
508508
"type": "text"
509509
}
510510
],
@@ -551,7 +551,7 @@
551551
},
552552
{
553553
"key": "Link",
554-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
554+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
555555
"type": "text"
556556
}
557557
],
@@ -594,7 +594,7 @@
594594
},
595595
{
596596
"key": "Link",
597-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
597+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
598598
"type": "text"
599599
},
600600
{
@@ -667,7 +667,7 @@
667667
},
668668
{
669669
"key": "Link",
670-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
670+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
671671
"type": "text"
672672
}
673673
],
@@ -714,7 +714,7 @@
714714
},
715715
{
716716
"key": "Link",
717-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
717+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
718718
"type": "text"
719719
}
720720
],
@@ -757,7 +757,7 @@
757757
},
758758
{
759759
"key": "Link",
760-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
760+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
761761
"type": "text"
762762
},
763763
{
@@ -829,7 +829,7 @@
829829
},
830830
{
831831
"key": "Link",
832-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
832+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
833833
"type": "text"
834834
}
835835
],
@@ -876,7 +876,7 @@
876876
},
877877
{
878878
"key": "Link",
879-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
879+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
880880
"type": "text"
881881
}
882882
],
@@ -919,7 +919,7 @@
919919
},
920920
{
921921
"key": "Link",
922-
"value": "<{{ngsi-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
922+
"value": "<{{user-context.jsonld}}>; rel=\"http://www.w3.org/ns/json-ld#context\"; type=\"application/ld+json\"",
923923
"type": "text"
924924
},
925925
{
@@ -1483,8 +1483,8 @@
14831483
"value": "localhost:3001"
14841484
},
14851485
{
1486-
"key": "ngsi-context.jsonld",
1487-
"value": "http://context/ngsi-context.jsonld"
1486+
"key": "user-context.jsonld",
1487+
"value": "http://context/user-context.jsonld"
14881488
},
14891489
{
14901490
"key": "scorpio",

README.ja.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ Agent は最初に Context Broker がレスポンスしている URL を認識
534534

535535
```console
536536
curl -iX POST 'http://localhost:4041/iot/services' \
537-
-H 'fiware-service: openiot' \
538-
-H 'fiware-servicepath: /' \
539-
-H 'Content-Type: application/json' \
540-
--data-raw '{
537+
-H 'fiware-service: openiot' \
538+
-H 'fiware-servicepath: /' \
539+
-H 'Content-Type: application/json' \
540+
--data-raw '{
541541
"services": [
542542
{
543543
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
@@ -704,17 +704,20 @@ Context Broker からエンティティのデータを取得することで、
704704

705705
```console
706706
curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:temperature001' \
707-
-H 'fiware-service: openiot' \
708-
-H 'fiware-servicepath: /' \
709-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
707+
-H 'NGSILD-Tenant: openiot' \
708+
-H 'Accept: application/ld+json' \
709+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
710710
-d 'attrs=temperature'
711711
```
712712

713713
#### レスポンス:
714714

715715
```json
716716
{
717-
"@context": "http://context/ngsi-context.jsonld",
717+
"@context": [
718+
"http://context/ngsi-context.jsonld",
719+
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
720+
],
718721
"id": "urn:ngsi-ld:Device:temperature001",
719722
"type": "Device",
720723
"temperature": {
@@ -753,17 +756,20 @@ curl -iX POST 'http://localhost:7896/iot/json?k=4jggokgpepnvsb2uv4s40d59ov&i=mot
753756

754757
```console
755758
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \
756-
-H 'NGSILD-Tenant: openiot' \
757-
-H 'NGSILD-Path: /' \
758-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
759+
-H 'NGSILD-Tenant: openiot' \
760+
-H 'Accept: application/ld+json' \
761+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
759762
```
760763

761764
#### レスポンス:
762765

763766
```json
764767
[
765768
{
766-
"@context": "http://context/ngsi-context.jsonld",
769+
"@context": [
770+
"http://context/ngsi-context.jsonld",
771+
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
772+
],
767773
"id": "urn:ngsi-ld:Device:motion003",
768774
"type": "Device",
769775
"c": {
@@ -863,7 +869,7 @@ Irrigation system をオンにするコマンドの結果は、Context Broker
863869
```console
864870
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001' \
865871
-H 'NGSILD-Tenant: openiot' \
866-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
872+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
867873
-H 'Accept: application/json'
868874
```
869875

@@ -1032,7 +1038,7 @@ IoT Agent を IoT デバイスに接続すると、Orion Context Broker にコ
10321038
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001/attrs/on' \
10331039
-H 'NGSILD-Tenant: openiot' \
10341040
-H 'Content-Type: application/json' \
1035-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
1041+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10361042
--data-raw '{
10371043

10381044
"type": "Property",
@@ -1057,7 +1063,7 @@ curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:w
10571063
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:tractor001/attrs/start' \
10581064
-H 'NGSILD-Tenant: openiot' \
10591065
-H 'Content-Type: application/json' \
1060-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
1066+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10611067
--data-raw '{
10621068

10631069
"type": "Property",
@@ -1078,7 +1084,7 @@ curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:t
10781084
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:filling001/attrs/add' \
10791085
-H 'NGSILD-Tenant: openiot' \
10801086
-H 'Content-Type: application/json' \
1081-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
1087+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10821088
--data-raw '{
10831089

10841090
"type": "Property",

README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -701,17 +701,20 @@ add the `fiware-service` and `fiware-service-path` headers.
701701

702702
```console
703703
curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:temperature001' \
704-
-H 'fiware-service: openiot' \
705-
-H 'fiware-servicepath: /' \
706-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
704+
-H 'NGSILD-Tenant: openiot' \
705+
-H 'Accept: application/ld+json' \
706+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
707707
-d 'attrs=temperature'
708708
```
709709

710710
#### Response:
711711

712712
```json
713713
{
714-
"@context": "http://context/ngsi-context.jsonld",
714+
"@context": [
715+
"http://context/ngsi-context.jsonld",
716+
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
717+
],
715718
"id": "urn:ngsi-ld:Device:temperature001",
716719
"type": "Device",
717720
"temperature": {
@@ -752,17 +755,20 @@ based on the knowledge of the service group
752755

753756
```console
754757
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \
755-
-H 'NGSILD-Tenant: openiot' \
756-
-H 'NGSILD-Path: /' \
757-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
758+
-H 'NGSILD-Tenant: openiot' \
759+
-H 'Accept: application/ld+json' \
760+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
758761
```
759762

760763
#### Response:
761764

762765
```json
763766
[
764767
{
765-
"@context": "http://context/ngsi-context.jsonld",
768+
"@context": [
769+
"http://context/ngsi-context.jsonld",
770+
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
771+
],
766772
"id": "urn:ngsi-ld:Device:motion003",
767773
"type": "Device",
768774
"c": {
@@ -863,7 +869,7 @@ The result of the command to turn on the irrigation system can be read by queryi
863869
```console
864870
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001' \
865871
-H 'NGSILD-Tenant: openiot' \
866-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
872+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
867873
-H 'Accept: application/json'
868874
```
869875

@@ -909,10 +915,10 @@ both `attributes` and `command` attributes in the body of the request.
909915

910916
```console
911917
curl -L -X POST 'http://localhost:4041/iot/devices' \
912-
-H 'fiware-service: openiot' \
913-
-H 'fiware-servicepath: /' \
914-
-H 'Content-Type: application/json' \
915-
--data-raw '{
918+
-H 'fiware-service: openiot' \
919+
-H 'fiware-servicepath: /' \
920+
-H 'Content-Type: application/json' \
921+
--data-raw '{
916922
"devices": [
917923
{
918924
"device_id": "filling001",
@@ -968,7 +974,7 @@ curl -L -X POST 'http://localhost:4041/iot/devices' \
968974
-H 'fiware-service: openiot' \
969975
-H 'fiware-servicepath: /' \
970976
-H 'Content-Type: application/json' \
971-
--data-raw '{
977+
--data-raw '{
972978
"devices": [
973979
{
974980
"device_id": "tractor001",
@@ -1025,7 +1031,7 @@ To invoke the `on` command, the `on` attribute must be updated in the context.
10251031
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001/attrs/on' \
10261032
-H 'NGSILD-Tenant: openiot' \
10271033
-H 'Content-Type: application/json' \
1028-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
1034+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10291035
--data-raw '{
10301036
10311037
"type": "Property",
@@ -1048,7 +1054,7 @@ To invoke the `start` command, the `start` attribute must be updated in the cont
10481054
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:tractor001/attrs/start' \
10491055
-H 'NGSILD-Tenant: openiot' \
10501056
-H 'Content-Type: application/json' \
1051-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
1057+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10521058
--data-raw '{
10531059
10541060
"type": "Property",
@@ -1067,7 +1073,7 @@ Change the state of the **Fillling System**, the `add` attribute must be updated
10671073
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:filling001/attrs/add' \
10681074
-H 'NGSILD-Tenant: openiot' \
10691075
-H 'Content-Type: application/json' \
1070-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
1076+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10711077
--data-raw '{
10721078
10731079
"type": "Property",

data-models/user-context.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": [
3+
"http://context/user-context.jsonld",
4+
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld"
5+
]
6+
}

docker-compose/common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
target: /usr/local/apache2/conf/mime.types
3535
read_only: true
3636
healthcheck:
37-
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
37+
test: (wget --server-response --spider --quiet http://context/user-context.jsonld 2>&1 | awk 'NR==1{print $$2}'| grep -q -e "200") || exit 1
3838

3939
# Databases
4040
mongo-db:
@@ -91,7 +91,7 @@ services:
9191
- IOTA_DEFAULT_RESOURCE=/iot/json
9292

9393
- IOTA_CB_NGSI_VERSION=ld # use NGSI-LD when sending updates for active attributes
94-
- IOTA_JSON_LD_CONTEXT=http://context/ngsi-context.jsonld
94+
- IOTA_JSON_LD_CONTEXT=http://context/user-context.jsonld
9595
- IOTA_FALLBACK_TENANT=openiot
9696
- IOTA_MULTI_CORE=true
9797
healthcheck:

import-data

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/entityOper
9898
echo -e "Registering Farmer and Devices as data sources.\n"
9999

100100
curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/csourceRegistrations/' \
101-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
101+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
102102
-H 'Content-Type: application/json' \
103103
-d '{
104104
"type": "ContextSourceRegistration",
@@ -120,7 +120,7 @@ curl -s -o /dev/null -X POST 'http://'"${CONTEXT_BROKER}"'/ngsi-ld/v1/csourceReg
120120

121121

122122
curl -s -o /dev/null -X POST 'http://farmer/ngsi-ld/v1/csourceRegistrations/' \
123-
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
123+
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json' \
124124
-H 'Content-Type: application/json' \
125125
-d '{
126126
"type": "ContextSourceRegistration",

0 commit comments

Comments
 (0)