Skip to content

Commit 0573835

Browse files
committed
Update requests
- use `pick` - use `format`
1 parent 0aeacfd commit 0573835

2 files changed

Lines changed: 68 additions & 48 deletions

File tree

README.ja.md

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ curl -L -X GET \
368368
#### 1️⃣ リクエスト:
369369

370370
```console
371-
curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow002' \
371+
curl -G -X GET \
372+
'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow002' \
372373
-H 'NGSILD-Tenant: openiot' \
373374
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
374375
-d 'lastN=3'
@@ -498,11 +499,12 @@ Mintaka 実装によって暗示されるため、他の Context Broker と連
498499
#### 2️⃣ リクエスト:
499500

500501
```console
501-
curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
502+
curl -G -X GET \
503+
'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
502504
-H 'NGSILD-Tenant: openiot' \
503505
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
504506
-d 'lastN=3' \
505-
-d 'attrs=heartRate'
507+
-d 'pick=id,type,heartRate'
506508
```
507509

508510
#### レスポンス:
@@ -558,19 +560,20 @@ curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow00
558560

559561
### エンティティの簡略化されたテンポラル表現
560562

561-
`options=keyValues` パラメータがエンティティを単純なキーと値のペアに減らすのとほぼ同じ方法で、同等の
562-
`options=temporalValues` は各属性を一連のタプルに減らします。エントリごとに1つの値と1つのタイムスタンプです。
563+
`format=simplified` パラメータがエンティティを単純なキーと値のペアに減らすのとほぼ同じ方法で、同等の
564+
`format=temporalValues` は各属性を一連のタプルに減らします。エントリごとに1つの値と1つのタイムスタンプです。
563565

564566
簡略化された時間表現は、次のように `options` パラメータを追加することでリクエストできます:
565567

566568
#### 3️⃣ リクエスト:
567569

568570
```console
569-
curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
571+
curl -G -X GET \
572+
'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
570573
-H 'NGSILD-Tenant: openiot' \
571574
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
572575
-d 'lastN=3' \
573-
-d 'options=temporalValues'
576+
-d 'format=temporalValues'
574577
```
575578

576579
#### レスポンス:
@@ -616,7 +619,8 @@ curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow00
616619
を使用する必要があります。
617620

618621
```console
619-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
622+
curl -G -X GET \
623+
'http://localhost:8080/temporal/entities/' \
620624
-H 'NGSILD-Tenant: openiot' \
621625
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
622626
-d 'type=Animal' \
@@ -625,7 +629,7 @@ curl -G -X GET 'http://localhost:8080/temporal/entities/' \
625629
-d 'q=sex==%22male%22' \
626630
-d 'timeproperty=modifiedAt' \
627631
-d 'options=count' \
628-
-d 'attrs=sex,heartRate' \
632+
-d 'pick=id,type,sex,heartRate' \
629633
-d 'timerel=before' \
630634
-d 'timeAt=<current_time>' \
631635
@@ -747,24 +751,25 @@ UTC 形式で表された日時です。秒とミリ秒はオプションです
747751
]
748752
```
749753

750-
同等の簡略化された形式は、`options=temporalValues` を設定することで取得できます。
754+
同等の簡略化された形式は、`format=temporalValues` を設定することで取得できます。
751755

752756
#### 5️⃣ リクエスト:
753757

754758
次のクエリは、群れ内の雄牛に関するデータを要求しています。`sex` 属性は変更されないため、`timeproperty=modifiedAt`
755759
を使用する必要があります。
756760

757761
```console
758-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
762+
curl -G -X GET \
763+
'http://localhost:8080/temporal/entities/' \
759764
-H 'NGSILD-Tenant: openiot' \
760765
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
761766
-d 'type=Animal' \
762767
-d 'pageSize=2' \
763768
-d 'lastN=3' \
764769
-d 'q=sex==%22male%22' \
765770
-d 'timeproperty=modifiedAt' \
766-
-d 'options=temporalValues' \
767-
-d 'attrs=sex,heartRate' \
771+
-d 'format=temporalValues' \
772+
-d 'pick=id,type,sex,heartRate' \
768773
-d 'timerel=before' \
769774
-d 'timeAt=<current_time>' \
770775
@@ -831,8 +836,9 @@ curl -G -I -X GET 'http://localhost:8080/temporal/entities/' \
831836
-d 'lastN=3' \
832837
-d 'q=sex==%22male%22' \
833838
-d 'timeproperty=modifiedAt' \
834-
-d 'options=temporalValues,count' \
835-
-d 'attrs=sex,heartRate' \
839+
-d 'format=temporalValues' \
840+
-d 'options=count' \
841+
-d 'pick=id,type,sex,heartRate' \
836842
-d 'timerel=before' \
837843
-d 'timeAt=<current_time>'
838844
```
@@ -868,16 +874,18 @@ connection: keep-alive
868874
#### 7️⃣ リクエスト:
869875

870876
```console
871-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
877+
curl -G -X GET \
878+
'http://localhost:8080/temporal/entities/' \
872879
-H 'NGSILD-Tenant: openiot' \
873880
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
874881
-d 'type=Animal' \
875882
-d 'pageSize=2' \
876883
-d 'lastN=3' \
877884
-d 'q=sex==%22male%22' \
878885
-d 'timeproperty=modifiedAt' \
879-
-d 'options=temporalValues,count' \
880-
-d 'attrs=sex,heartRate' \
886+
-d 'format=temporalValues' \
887+
-d 'options=count' \
888+
-d 'pick=id,type,sex,heartRate' \
881889
-d 'timerel=before' \
882890
-d 'timeAt=<current_time>' \
883891
-d 'pageAnchor=urn:ngsi-ld:Animal:pig001' \
@@ -1034,13 +1042,14 @@ curl -L -X GET \
10341042
#### 9️⃣ リクエスト:
10351043

10361044
```console
1037-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
1045+
curl -G -X GET \
1046+
'http://localhost:8080/temporal/entities/' \
10381047
-H 'NGSILD-Tenant: openiot' \
10391048
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10401049
-d 'type=Device' \
10411050
-d 'q=d==%22FORAGING%22' \
1042-
-d 'attrs=heartRate,controlledAsset' \
1043-
-d 'options=temporalValues' \
1051+
-d 'pick=id,type,heartRate,controlledAsset' \
1052+
-d 'format=temporalValues' \
10441053
-d 'timerel=before' \
10451054
-d 'timeAt=<current_time>' \
10461055
-d 'pageSize=2' \
@@ -1107,15 +1116,16 @@ curl -G -X GET 'http://localhost:8080/temporal/entities/' \
11071116
#### 9️⃣ リクエスト:
11081117

11091118
```console
1110-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
1119+
curl -G -X GET \
1120+
'http://localhost:8080/temporal/entities/' \
11111121
-H 'NGSILD-Tenant: openiot' \
11121122
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
11131123
-d 'type=Device' \
11141124
-d 'georel=near%3BmaxDistance==800' \
11151125
-d 'geometry=Point' \
11161126
-d 'coordinates=%5B13.364,52.52%5D' \
1117-
-d 'attrs=heartRate,controlledAsset' \
1118-
-d 'options=temporalValues' \
1127+
-d 'pick=id,type,heartRate,controlledAsset' \
1128+
-d 'format=temporalValues' \
11191129
-d 'timerel=before' \
11201130
-d 'timeAt=<current_time>' \
11211131
-d 'pageSize=2' \

README.md

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ The `lastN` parameter restricts the result to N values.
361361
#### 1️⃣ Request:
362362

363363
```console
364-
curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow002' \
364+
curl -G -X GET \
365+
'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow002' \
365366
-H 'NGSILD-Tenant: openiot' \
366367
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
367368
-d 'lastN=3'
@@ -490,11 +491,12 @@ This example shows just the last 3 changes of `heartRate` from the entity `urn:n
490491
#### 2️⃣ Request:
491492

492493
```console
493-
curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
494+
curl -G -X GET \
495+
'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
494496
-H 'NGSILD-Tenant: openiot' \
495497
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
496498
-d 'lastN=3' \
497-
-d 'attrs=heartRate'
499+
-d 'pick=id,type,heartRate'
498500
```
499501

500502
#### Response:
@@ -548,19 +550,20 @@ The response is a single entity with a single attribute array holding values of
548550

549551
### Simplified temporal representation of an entity
550552

551-
In much the same manner as the `options=keyValues` parameter reduces entities to simple key-value pairs, the equivalent
552-
`options=temporalValues` reduces each attribute to a series of tuples - one value and one timestamp for each entry.
553+
In much the same manner as the `format=simplified` parameter reduces entities to simple key-value pairs, the equivalent
554+
`format=temporalValues` reduces each attribute to a series of tuples - one value and one timestamp for each entry.
553555

554556
The simplified temporal representation can be requested by adding the `options` parameter as shown:
555557

556558
#### 3️⃣ Request:
557559

558560
```console
559-
curl -G -X GET 'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
561+
curl -G -X GET \
562+
'http://localhost:8080/temporal/entities/urn:ngsi-ld:Animal:cow001' \
560563
-H 'NGSILD-Tenant: openiot' \
561564
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
562565
-d 'lastN=3' \
563-
-d 'options=temporalValues'
566+
-d 'format=temporalValues'
564567
```
565568

566569
#### Response:
@@ -605,7 +608,8 @@ The following query is requesting data about the bulls within the herd. Because
605608
`timeproperty=modifiedAt` must be used.
606609

607610
```console
608-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
611+
curl -G -X GET \
612+
'http://localhost:8080/temporal/entities/' \
609613
-H 'NGSILD-Tenant: openiot' \
610614
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
611615
-d 'type=Animal' \
@@ -614,7 +618,7 @@ curl -G -X GET 'http://localhost:8080/temporal/entities/' \
614618
-d 'q=sex==%22male%22' \
615619
-d 'timeproperty=modifiedAt' \
616620
-d 'options=count' \
617-
-d 'attrs=sex,heartRate' \
621+
-d 'pick=id,type,sex,heartRate' \
618622
-d 'timerel=before' \
619623
-d 'timeAt=<current_time>' \
620624
@@ -736,24 +740,25 @@ from an Array of one element down to an object because this is the format specif
736740
]
737741
```
738742

739-
The equivalent simplified format can be retrieved by setting `options=temporalValues`
743+
The equivalent simplified format can be retrieved by setting `format=temporalValues`
740744

741745
#### 5️⃣ Request:
742746

743747
The following query is requesting data about the bulls within the herd. Because the `sex` attribute is unchanging,
744748
`timeproperty=modifiedAt` must be used.
745749

746750
```console
747-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
751+
curl -G -X GET \
752+
'http://localhost:8080/temporal/entities/' \
748753
-H 'NGSILD-Tenant: openiot' \
749754
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
750755
-d 'type=Animal' \
751756
-d 'pageSize=2' \
752757
-d 'lastN=3' \
753758
-d 'q=sex==%22male%22' \
754759
-d 'timeproperty=modifiedAt' \
755-
-d 'options=temporalValues' \
756-
-d 'attrs=sex,heartRate' \
760+
-d 'format=temporalValues' \
761+
-d 'pick=id,type,sex,heartRate' \
757762
-d 'timerel=before' \
758763
-d 'timeAt=<current_time>' \
759764
@@ -818,8 +823,9 @@ curl -G -I -X GET 'http://localhost:8080/temporal/entities/' \
818823
-d 'lastN=3' \
819824
-d 'q=sex==%22male%22' \
820825
-d 'timeproperty=modifiedAt' \
821-
-d 'options=temporalValues,count' \
822-
-d 'attrs=sex,heartRate' \
826+
-d 'format=temporalValues' \
827+
-d 'options=count' \
828+
-d 'pick=id,type,sex,heartRate' \
823829
-d 'timerel=before' \
824830
-d 'timeAt=<current_time>'
825831
```
@@ -855,16 +861,18 @@ Making the same request with an additional `pageAnchor` parameter will retrieve
855861
#### 7️⃣ Request:
856862

857863
```console
858-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
864+
curl -G -X GET \
865+
'http://localhost:8080/temporal/entities/' \
859866
-H 'NGSILD-Tenant: openiot' \
860867
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
861868
-d 'type=Animal' \
862869
-d 'pageSize=2' \
863870
-d 'lastN=3' \
864871
-d 'q=sex==%22male%22' \
865872
-d 'timeproperty=modifiedAt' \
866-
-d 'options=temporalValues,count' \
867-
-d 'attrs=sex,heartRate' \
873+
-d 'format=temporalValues' \
874+
-d 'options=count' \
875+
-d 'pick=id,type,sex,heartRate' \
868876
-d 'timerel=before' \
869877
-d 'timeAt=<current_time>' \
870878
-d 'pageAnchor=urn:ngsi-ld:Animal:pig001' \
@@ -1019,13 +1027,14 @@ also returns the associated animal entity that wears it.
10191027
#### 9️⃣ Request:
10201028

10211029
```console
1022-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
1030+
curl -G -X GET \
1031+
'http://localhost:8080/temporal/entities/' \
10231032
-H 'NGSILD-Tenant: openiot' \
10241033
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10251034
-d 'type=Device' \
10261035
-d 'q=d==%22FORAGING%22' \
1027-
-d 'attrs=heartRate,controlledAsset' \
1028-
-d 'options=temporalValues' \
1036+
-d 'pick=id,type,heartRate,controlledAsset' \
1037+
-d 'format=temporalValues' \
10291038
-d 'timerel=before' \
10301039
-d 'timeAt=<current_time>' \
10311040
-d 'pageSize=2' \
@@ -1090,15 +1099,16 @@ from a fixed point, and also returns the associated animal entity that wears it.
10901099
#### 9️⃣ Request:
10911100

10921101
```console
1093-
curl -G -X GET 'http://localhost:8080/temporal/entities/' \
1102+
curl -G -X GET \
1103+
'http://localhost:8080/temporal/entities/' \
10941104
-H 'NGSILD-Tenant: openiot' \
10951105
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
10961106
-d 'type=Device' \
10971107
-d 'georel=near%3BmaxDistance==800' \
10981108
-d 'geometry=Point' \
10991109
-d 'coordinates=%5B13.364,52.52%5D' \
1100-
-d 'attrs=heartRate,controlledAsset' \
1101-
-d 'options=temporalValues' \
1110+
-d 'pick=id,type,heartRate,controlledAsset' \
1111+
-d 'format=temporalValues' \
11021112
-d 'timerel=before' \
11031113
-d 'timeAt=<current_time>' \
11041114
-d 'pageSize=2' \

0 commit comments

Comments
 (0)