Skip to content

Commit 309eb66

Browse files
committed
Update Requests to use pick and format
1 parent 53de436 commit 309eb66

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

README.ja.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ Link: <http://context/json-context.jsonld>; rel="http://www.w3.org/ns/json-ld#co
638638
#### 5️⃣ リクエスト:
639639

640640
```console
641-
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001' \
641+
curl -L -X GET \
642+
'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001' \
642643
-H 'Accept: application/ld+json' \
643644
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
644645
```
@@ -704,7 +705,7 @@ Core `@context` が含まれることは常に暗示されることに注意し
704705
提供されたデータへの参照が提供された場合、短い名前のデータを返し、データの特定の `type` にレスポンスを制限する
705706
ことが可能です。たとえば、以下のリクエストはコンテキスト・データ内のすべての `Building` エンティティのデータを
706707
返します。`type` パラメータを使用すると、レスポンスが `Building` エンティティのみに制限されます。
707-
`options=keyValues` クエリ・パラメータを使用すると、レスポンスが標準の JSON-LD になります。
708+
`format=simplified` クエリ・パラメータを使用すると、レスポンスが標準の JSON-LD になります。
708709

709710
#### 6️⃣ リクエスト:
710711

@@ -714,12 +715,12 @@ curl -G -X GET \
714715
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
715716
-H 'Accept: application/ld+json' \
716717
-d 'type=Building' \
717-
-d 'options=keyValues'
718+
-d 'format=simplified'
718719
```
719720

720721
#### レスポンス:
721722

722-
`options=keyValues` を使用しているため、レスポンスは JSON のみで構成され、属性定義 `type="Property"`
723+
`format=simplified` を使用しているため、レスポンスは JSON のみで構成され、属性定義 `type="Property"`
723724
やプロパティのプロパティ (_properties-of-properties_) 要素は含まれません。リクエストの `Link`
724725
ヘッダがレスポンスで返される `@context` として使用されていることがわかります。
725726

@@ -784,7 +785,7 @@ curl -G -X GET \
784785

785786
この例は、`name` 属性が _Big Red Barn_ のすべての `Building` エンティティを返します。フィルタリングは、
786787
`q` パラメータを使用して実行できます。文字列にスペースが含まれている場合、URL エンコードして二重引用符文字
787-
`"` = `%22` で保持できます。`options=keyValues` が送信されるため、これによりペイロードの構造に影響を与えるため、
788+
`"` = `%22` で保持できます。`format=simplified` が送信されるため、これによりペイロードの構造に影響を与えるため、
788789
別の `@context` ファイル - `json-context.jsonld` を提供する必要があります。
789790

790791
#### 7️⃣ リクエスト:
@@ -796,12 +797,12 @@ curl -G -X GET \
796797
-H 'Accept: application/ld+json' \
797798
-d 'type=Building' \
798799
-d 'q=name==%22Big%20Red%20Barn%22' \
799-
-d 'options=keyValues'
800+
-d 'format=simplified'
800801
```
801802

802803
#### レスポンス:
803804

804-
`Link` ヘッダと `options=keyValues` パラメータを使用すると、次のように、短い形式の Key-Value **JSON-LD**
805+
`Link` ヘッダと `format=simplified` パラメータを使用すると、次のように、短い形式の Key-Value **JSON-LD**
805806
へのレスポンスが減少します:
806807

807808
```json
@@ -872,7 +873,7 @@ curl -G -X GET \
872873
-H 'Accept: application/ld+json' \
873874
-d 'type=Geb%C3%A4ude' \
874875
-d 'q=name==%22Big%20Red%20Barn%22' \
875-
-d 'options=keyValues'
876+
-d 'format=simplified'
876877
```
877878

878879
#### レスポンス:
@@ -931,7 +932,7 @@ curl -G -X GET \
931932
-H 'Accept: application/ld+json' \
932933
-d 'type=Building' \
933934
-d 'q=category==%22barn%22,%22farm_auxiliary%22' \
934-
-d 'options=keyValues'\
935+
-d 'format=simplified'\
935936
-d 'expandValues=category'
936937
```
937938

@@ -981,17 +982,18 @@ curl -G -X GET \
981982
#### 1️⃣0️⃣ リクエスト:
982983

983984
```console
984-
curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \
985+
curl -G -X GET \
986+
'http://localhost:1026/ngsi-ld/v1/entities/' \
985987
-H 'Link: <http://context/json-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
986988
-H 'Accept: application/ld+json' \
987989
-d 'type=Building' \
988990
-d 'q=address%5BaddressLocality%5D==%22Tiergarten%22' \
989-
-d 'options=keyValues'
991+
-d 'format=simplified'
990992
```
991993

992994
#### レスポンス:
993995

994-
`Link` ヘッダと `options=keyValues` パラメータを使用すると、JSON-LD へのレスポンスが減少します。
996+
`Link` ヘッダと `format=simplified` パラメータを使用すると、JSON-LD へのレスポンスが減少します。
995997

996998
```json
997999
[
@@ -1067,12 +1069,12 @@ curl -G -X GET \
10671069
-H 'Accept: application/json' \
10681070
-d 'type=Building' \
10691071
-d 'q=address.verified==true' \
1070-
-d 'options=keyValues'
1072+
-d 'format=simplified'
10711073
```
10721074

10731075
#### レスポンス:
10741076

1075-
`options=keyValues` を Accept HTTP ヘッダ (`application/json`) と共に使用するため、レスポンスは属性 `type` と
1077+
`format=simplified` を Accept HTTP ヘッダ (`application/json`) と共に使用するため、レスポンスは属性 `type` と
10761078
`metadata` 要素を含まない JSON のみで構成されます。
10771079

10781080
```json
@@ -1142,12 +1144,12 @@ curl -G -X GET \
11421144
-d 'geometry=Point' \
11431145
-d 'coordinates=%5B13.3777,52.5162%5D' \
11441146
-d 'georel=near%3BmaxDistance==800' \
1145-
-d 'options=keyValues'
1147+
-d 'format=simplified'
11461148
```
11471149

11481150
#### レスポンス:
11491151

1150-
`options=keyValues` を Accept HTTP ヘッダ (`application/json`) と共に使用するため、レスポンスは属性 `type` と `metadata`
1152+
`format=simplified` を Accept HTTP ヘッダ (`application/json`) と共に使用するため、レスポンスは属性 `type` と `metadata`
11511153
要素を含まない JSON のみで構成されます。
11521154

11531155
```json

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ the resource in question. In the case of NGSI-LD, the metadata is a file in `app
646646
#### 5️⃣ Request:
647647

648648
```console
649-
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001' \
649+
curl -L -X GET \
650+
'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001' \
650651
-H 'Accept: application/ld+json' \
651652
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
652653
```
@@ -706,7 +707,7 @@ form `type="Building"` with the FQN `https://smartdatamodels.org/dataModel.Build
706707

707708
If a reference to the supplied data is supplied, it is possible to return short name data and limit responses to a
708709
specific `type` of data. For example, the request below returns the data of all `Building` entities within the context
709-
data. Use of the `type` parameter limits the response to `Building` entities only, use of the `options=keyValues` query
710+
data. Use of the `type` parameter limits the response to `Building` entities only, use of the `format=simplified` query
710711
parameter reduces the response down to standard JSON-LD.
711712

712713
#### 6️⃣ Request:
@@ -717,12 +718,12 @@ curl -G -X GET \
717718
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
718719
-H 'Accept: application/ld+json' \
719720
-d 'type=Building' \
720-
-d 'options=keyValues'
721+
-d 'format=simplified'
721722
```
722723

723724
#### Response:
724725

725-
Because of the use of the `options=keyValues`, the response consists of JSON only without the attribute definitions
726+
Because of the use of the `format=simplified`, the response consists of JSON only without the attribute definitions
726727
`type="Property"` or any _properties-of-properties_ elements. You can see that `Link` header from the request has been
727728
used as the `@context` returned in the response.
728729

@@ -779,7 +780,7 @@ used as the `@context` returned in the response.
779780

780781
This example returns all `Building` entities with the `name` attribute _Big Red Barn_. Filtering can be done using the
781782
`q` parameter - if a string has spaces in it, it can be URL encoded and held within double quote characters `"` = `%22`.
782-
Since `options=keyValues` is sent, this will effect the structure of the payload and we will need to supply a different
783+
Since `format=simplified` is sent, this will effect the structure of the payload and we will need to supply a different
783784
`@context` file - `json-context.jsonld`
784785

785786
#### 7️⃣ Request:
@@ -791,12 +792,12 @@ curl -G -X GET \
791792
-H 'Accept: application/ld+json' \
792793
-d 'type=Building' \
793794
-d 'q=name==%22Big%20Red%20Barn%22' \
794-
-d 'options=keyValues'
795+
-d 'format=simplified'
795796
```
796797

797798
#### Response:
798799

799-
The use of the `Link` header and the `options=keyValues` parameter reduces the response to short form key-values
800+
The use of the `Link` header and the `format=simplified` parameter reduces the response to short form key-values
800801
**JSON-LD** as shown:
801802

802803
```json
@@ -862,7 +863,7 @@ curl -G -X GET \
862863
-H 'Accept: application/ld+json' \
863864
-d 'type=Geb%C3%A4ude' \
864865
-d 'q=name==%22Big%20Red%20Barn%22' \
865-
-d 'options=keyValues'
866+
-d 'format=simplified'
866867
```
867868

868869
#### Response:
@@ -916,7 +917,7 @@ curl -G -X GET \
916917
-H 'Accept: application/ld+json' \
917918
-d 'type=Building' \
918919
-d 'q=category==%22barn%22,%22farm_auxiliary%22' \
919-
-d 'options=keyValues' \
920+
-d 'format=simplified' \
920921
-d 'expandValues=category'
921922
```
922923

@@ -961,17 +962,18 @@ Filtering can be done using the `q` parameter - sub-attributes are annotated usi
961962
#### 1️⃣0️⃣ Request:
962963

963964
```console
964-
curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/' \
965+
curl -G -X GET \
966+
'http://localhost:1026/ngsi-ld/v1/entities/' \
965967
-H 'Link: <http://context/json-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
966968
-H 'Accept: application/ld+json' \
967969
-d 'type=Building' \
968970
-d 'q=address%5BaddressLocality%5D==%22Tiergarten%22' \
969-
-d 'options=keyValues'
971+
-d 'format=simplified'
970972
```
971973

972974
#### Response:
973975

974-
Use of the `Link` header and the `options=keyValues` parameter reduces the response to JSON-LD.
976+
Use of the `Link` header and the `format=simplified` parameter reduces the response to JSON-LD.
975977

976978
```json
977979
[
@@ -1038,12 +1040,12 @@ curl -G -X GET \
10381040
-H 'Accept: application/json' \
10391041
-d 'type=Building' \
10401042
-d 'q=address.verified==true' \
1041-
-d 'options=keyValues'
1043+
-d 'format=simplified'
10421044
```
10431045

10441046
#### Response:
10451047

1046-
Because of the use of the `options=keyValues` together with the Accept HTTP header (`application/json`), the response
1048+
Because of the use of the `format=simplified` together with the Accept HTTP header (`application/json`), the response
10471049
consists of JSON only without the attribute `type` and `metadata` elements.
10481050

10491051
```json
@@ -1111,12 +1113,12 @@ curl -G -X GET \
11111113
-d 'geometry=Point' \
11121114
-d 'coordinates=%5B13.3777,52.5162%5D' \
11131115
-d 'georel=near%3BmaxDistance==800' \
1114-
-d 'options=keyValues'
1116+
-d 'format=simplified'
11151117
```
11161118

11171119
#### Response:
11181120

1119-
Because of the use of the `options=keyValues` together with the Accept HTTP header (`application/json`), the response
1121+
Because of the use of the `format=simplified` together with the Accept HTTP header (`application/json`), the response
11201122
consists of JSON only without the attribute `type` and `metadata` elements.
11211123

11221124
```json

0 commit comments

Comments
 (0)