diff --git a/NGSI-LD Entity Relationships.postman_collection.json b/NGSI-LD Entity Relationships.postman_collection.json index 8753769..3b7448f 100644 --- a/NGSI-LD Entity Relationships.postman_collection.json +++ b/NGSI-LD Entity Relationships.postman_collection.json @@ -17,7 +17,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" } ], @@ -26,10 +26,10 @@ "raw": "[\n {\n \"id\": \"urn:ngsi-ld:TemperatureSensor:001\",\n \"type\": \"TemperatureSensor\",\n \"description\" : {\"type\": \"Property\", \"value\": \"Temperature Gauge 1\"},\n \"category\": {\"type\": \"Property\", \"value\": \"sensor\"},\n \"controlledProperty\" : {\"type\": \"Property\", \"value\": \"temperature\"},\n \"temperature\": {\"type\": \"Property\", \"value\": 20, \"unitCode\": \"CEL\"}\n },\n {\n \"id\": \"urn:ngsi-ld:TemperatureSensor:002\",\n \"type\": \"TemperatureSensor\",\n \"description\" : {\"type\": \"Property\", \"value\": \"Temperature Gauge 2\"},\n \"category\": {\"type\": \"Property\", \"value\": \"sensor\"},\n \"controlledProperty\" : {\"type\": \"Property\", \"value\": \"temperature\"},\n \"temperature\": {\"type\": \"Property\", \"value\": 21, \"unitCode\": \"CEL\"}\n },\n {\n \"id\": \"urn:ngsi-ld:TemperatureSensor:003\",\n \"type\": \"TemperatureSensor\",\n \"description\" : {\"type\": \"Property\", \"value\": \"Temperature Gauge 3\"},\n \"category\": {\"type\": \"Property\", \"value\": \"sensor\"},\n \"controlledProperty\" : {\"type\": \"Property\", \"value\": \"temperature\"},\n \"temperature\": {\"type\": \"Property\", \"value\": 27, \"unitCode\": \"CEL\"}\n }\n]" }, "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entityOperations/upsert", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entityOperations/upsert", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -53,7 +53,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" } ], @@ -62,10 +62,10 @@ "raw": "[\n {\n \"id\": \"urn:ngsi-ld:FillingLevelSensor:001\",\n \"type\": \"FillingLevelSensor\",\n \"description\" : {\"type\": \"Property\", \"value\": \"Filling Level Sensor 1\"},\n \"category\": {\"type\": \"Property\", \"value\": \"sensor\"},\n \"controlledProperty\" : {\"type\": \"Property\", \"value\": \"fillingLevel\"},\n \"fillingLevel\": {\"type\": \"Property\", \"value\": 1, \"unitCode\": \"C62\"}\n },\n {\n \"id\": \"urn:ngsi-ld:FillingLevelSensor:002\",\n \"type\": \"FillingLevelSensor\",\n \"description\" : {\"type\": \"Property\", \"value\": \"Filling Level Sensor 2\"},\n \"category\": {\"type\": \"Property\", \"value\": \"sensor\"},\n \"controlledProperty\" : {\"type\": \"Property\", \"value\": \"fillingLevel\"},\n \"fillingLevel\": {\"type\": \"Property\", \"value\": 0.9, \"unitCode\": \"C62\"}\n },\n {\n \"id\": \"urn:ngsi-ld:FillingLevelSensor:003\",\n \"type\": \"FillingLevelSensor\",\n \"description\" : {\"type\": \"Property\", \"value\": \"Filling Gauge 3\"},\n \"category\": {\"type\": \"Property\", \"value\": \"sensor\"},\n \"controlledProperty\" : {\"type\": \"Property\", \"value\": \"fillingLevel\"},\n \"fillingLevel\": {\"type\": \"Property\", \"value\": 0.8, \"unitCode\": \"C62\"}\n }\n]" }, "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entityOperations/upsert", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entityOperations/upsert", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -85,15 +85,15 @@ "header": [ { "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" } ], "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entities/?type=TemperatureSensor,FillingLevelSensor&options=keyValues", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entities/?type=TemperatureSensor,FillingLevelSensor&options=keyValues", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -127,7 +127,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" } ], @@ -136,10 +136,10 @@ "raw": "[\n {\n \"id\": \"urn:ngsi-ld:TemperatureSensor:001\",\n \"type\": \"TemperatureSensor\",\n \"controllingAsset\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Building:farm001\"\n }\n },\n {\n \"id\": \"urn:ngsi-ld:TemperatureSensor:002\",\n \"type\": \"TemperatureSensor\",\n \"controllingAsset\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Building:barn002\"\n }\n },\n {\n \"id\": \"urn:ngsi-ld:FillingLevelSensor:003\",\n \"type\": \"FillingLevelSensor\",\n \"controllingAsset\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Building:farm002\"\n }\n },\n {\n \"id\": \"urn:ngsi-ld:FillingLevelSensor:001\",\n \"type\": \"FillingLevelSensor\",\n \"controllingAsset\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Building:farm001\"\n }\n },\n {\n \"id\": \"urn:ngsi-ld:FillingLevelSensor:002\",\n \"type\": \"FillingLevelSensor\",\n \"controllingAsset\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Building:barn002\"\n }\n },\n {\n \"id\": \"urn:ngsi-ld:TemperatureSensor:003\",\n \"type\": \"TemperatureSensor\",\n \"controllingAsset\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Building:farm002\"\n }\n }\n]" }, "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entityOperations/update?options=update", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entityOperations/update?options=update", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -165,7 +165,7 @@ "header": [ { "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" } ], @@ -206,7 +206,7 @@ "header": [ { "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" }, { @@ -257,15 +257,15 @@ "header": [ { "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" } ], "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entities?q=controllingAsset==\"urn:ngsi-ld:Building:farm001\"&options=keyValues&attrs=controllingAsset", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entities?q=controllingAsset==\"urn:ngsi-ld:Building:farm001\"&options=keyValues&attrs=controllingAsset", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -302,7 +302,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" } ], @@ -311,10 +311,10 @@ "raw": "{\n \"id\": \"urn:ngsi-ld:Task:001\",\n \"type\": \"Task\",\n \"worker\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Person:001\"\n },\n \"field\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:PartField:002\"\n },\n \"product\": {\n \"type\": \"Relationship\",\n \"object\": \"urn:ngsi-ld:Herbicide:001\"\n },\n \"description\": {\n \"type\": \"Property\",\n \"value\": \"Spray the North Field with Agent Orange\"\n },\n \"status\": {\n \"type\": \"Property\",\n \"value\": \"scheduled\"\n },\n \"dueDate\": {\n \"type\": \"Property\",\n \"value\": \"2021-07-16\"\n }\n}" }, "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entities/", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entities/", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -334,7 +334,7 @@ "header": [ { "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" }, { @@ -345,10 +345,10 @@ } ], "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entities/?q=field==\"urn:ngsi-ld:PartField:002\"&options=keyValues&attrs=worker&type=Task", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entities/?q=field==\"urn:ngsi-ld:PartField:002\"&options=keyValues&attrs=worker&type=Task", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -386,7 +386,7 @@ "header": [ { "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" }, { @@ -397,10 +397,10 @@ } ], "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entities/?q=product==\"urn:ngsi-ld:Herbicide:001\"&options=keyValues&attrs=field&type=Task", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entities/?q=product==\"urn:ngsi-ld:Herbicide:001\"&options=keyValues&attrs=field&type=Task", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -438,7 +438,7 @@ "header": [ { "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" }, { @@ -449,10 +449,10 @@ } ], "url": { - "raw": "http://{{orion}}/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001?attrs=temperature", + "raw": "http://{{context-broker}}/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001?attrs=temperature", "protocol": "http", "host": [ - "{{orion}}" + "{{context-broker}}" ], "path": [ "ngsi-ld", @@ -494,12 +494,16 @@ ], "variable": [ { - "key": "orion", + "key": "context-broker", "value": "localhost:1026" }, { "key": "ngsi-context.jsonld", "value": "http://context/ngsi-context.jsonld" + }, + { + "key": "user-context.jsonld", + "value": "http://context/ngsi-context.jsonld" } ] } \ No newline at end of file diff --git a/README.ja.md b/README.ja.md index f851009..926488c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -223,7 +223,7 @@ git checkout NGSI-LD ```console curl -X POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ -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"' \ -H 'Accept: application/ld+json' \ --data-raw '[ { @@ -259,7 +259,7 @@ curl -X POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ ```console curl -iX POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ --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' \ --data-raw '[ { @@ -300,7 +300,7 @@ curl -iX POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ ```console curl -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=TemperatureSensor,FillingLevelSensor&options=keyValues' \ --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"' ``` #### レスポンス: @@ -308,7 +308,6 @@ curl -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=TemperatureSensor,F ```json [ { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:TemperatureSensor:001", "type": "TemperatureSensor", "description": "Temperature Gauge 1", @@ -317,7 +316,6 @@ curl -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=TemperatureSensor,F "temperature": 20 }, { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:TemperatureSensor:002", "type": "TemperatureSensor", "description": "Temperature Gauge 2", @@ -355,7 +353,7 @@ URN は、標準形式に従います: `urn:ngsi-ld::` curl -G -iX POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ -d 'options=update' \ -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 '[ { "id": "urn:ngsi-ld:TemperatureSensor:001", @@ -398,7 +396,7 @@ curl -G -iX POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ ```console curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor001' \ -d 'options=keyValues' \ --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"' ``` #### レスポンス: @@ -407,7 +405,10 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Temperatu ```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:TemperatureSensor:001", "type": "TemperatureSensor", "description": "Temperature Gauge 1", @@ -435,7 +436,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Temperatu curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001' \ -d 'options=keyValues' \ -d 'attrs=controlledAsset' \ --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' ``` @@ -465,7 +466,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'q=controlledAsset==%22urn:ngsi-ld:Building:farm001%22' \ -d 'attrs=controlledAsset' \ -d 'options=keyValues' \ --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"' ``` このリクエストは、URN `urn:ngsi-ld:Building:farm001` に関連付けられている、すべての **Device** エンティティの `id` を @@ -476,12 +477,10 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ ```json [ { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:TemperatureSensor:001", "type": "TemperatureSensor", }, { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:FillingLevelSensor:001", "type": "FillingLevelSensor", } @@ -500,7 +499,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'options=keyValues' \ -d 'count=true' \ -d 'limit=0' \ --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"' ``` 影響を受けるエンティティの数を示す HTTP ヘッダをレスポンスの一部として返します: @@ -532,7 +531,7 @@ NGSILD-Results-Count: 2 ```console curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/entities/' \ -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 '{ "id": "urn:ngsi-ld:Task:001", "type": "Task", @@ -563,7 +562,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'options=keyValues' \ -d 'attrs=worker' \ -d 'type=Task' \ --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' ``` @@ -590,7 +589,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'options=keyValues' \ -d 'attrs=field' \ -d 'type=Task' \ --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' ``` @@ -627,7 +626,7 @@ _Properties-of-Properties_ および _Relationships of Properties_ はメタデ ```console curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001' \ -d 'attrs=temperature' \ --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' ``` diff --git a/README.md b/README.md index acb7bb7..e7ea023 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ properties such as `category` have been added as properties to each device. ```console curl -X POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ -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"' \ -H 'Accept: application/ld+json' \ --data-raw '[ { @@ -260,7 +260,7 @@ Similarly, we can create a series of **FillingLevelSensors** entities by using t ```console curl -iX POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \ --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' \ --data-raw '[ { @@ -302,7 +302,7 @@ return the context data of the devices ```console curl -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=TemperatureSensor,FillingLevelSensor&options=keyValues' \ --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"' ``` #### Response: @@ -310,7 +310,6 @@ curl -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=TemperatureSensor,F ```json [ { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:TemperatureSensor:001", "type": "TemperatureSensor", "description": "Temperature Gauge 1", @@ -319,7 +318,6 @@ curl -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=TemperatureSensor,F "temperature": 20 }, { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:TemperatureSensor:002", "type": "TemperatureSensor", "description": "Temperature Gauge 2", @@ -355,7 +353,7 @@ The following request associates six devices to `urn:ngsi-ld:Building:farm001`, ```console curl -L 'http://localhost:1026/ngsi-ld/v1/entityOperations/update?options=update' \ -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"' \ -d '[ { "id": "urn:ngsi-ld:TemperatureSensor:001", @@ -416,7 +414,7 @@ Now when the devcie information is requested again, the response has changed and ```console curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001' \ -d 'options=keyValues' \ --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"' ``` #### Response: @@ -425,7 +423,7 @@ The updated response including the `controlledAsset` attribute is shown below: ```json { - "@context": "http://context/ngsi-context.jsonld", + "id": "urn:ngsi-ld:TemperatureSensor:001", "type": "TemperatureSensor", "description": "Temperature Gauge 1", @@ -449,7 +447,7 @@ entity by using the `options=keyValues` setting curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001' \ -d 'options=keyValues' \ -d 'attrs=controlledAsset' \ --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' ``` @@ -477,7 +475,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'q=controlledAsset==%22urn:ngsi-ld:Building:farm001%22' \ -d 'attrs=controlledAsset' \ -d 'options=keyValues' \ --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"' ``` This request is asking for the `id` of all **Device** entities associated to the URN `urn:ngsi-ld:Building:farm001`, the @@ -488,12 +486,10 @@ response is a JSON array as shown. ```json [ { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:TemperatureSensor:001", "type": "TemperatureSensor" }, { - "@context": "http://context/ngsi-context.jsonld", "id": "urn:ngsi-ld:FillingLevelSensor:001", "type": "FillingLevelSensor" } @@ -512,7 +508,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'options=keyValues' \ -d 'count=true' \ -d 'limit=0' \ --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"' ``` Returns an HTTP Header as part of the response which indicates the number of affected entities: @@ -542,7 +538,7 @@ properties (such as `description` and `status`) ```console curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/entities/' \ -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 '{ "id": "urn:ngsi-ld:Task:001", "type": "Task", @@ -570,7 +566,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'options=keyValues' \ -d 'attrs=worker' \ -d 'type=Task' \ --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' ``` @@ -596,7 +592,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities' \ -d 'options=keyValues' \ -d 'attrs=field' \ -d 'type=Task' \ --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' ``` @@ -630,7 +626,7 @@ can be retrieved with a GET request: ```console curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Building:farm001' \ -d 'attrs=temperature' \ --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' ``` diff --git a/data-models/ngsi-context.jsonld b/data-models/ngsi-context.jsonld index 8c9c658..952032a 100644 --- a/data-models/ngsi-context.jsonld +++ b/data-models/ngsi-context.jsonld @@ -1,138 +1,6 @@ { - "@context": { - "type": "@type", - "id": "@id", - "ngsi-ld": "https://uri.etsi.org/ngsi-ld/", - "fiware": "https://uri.fiware.org/ns/dataModels#", - "schema": "https://schema.org/", - "tutorial": "https://ngsi-ld-tutorials.readthedocs.io/en/latest/datamodels.html#", - "Building": "fiware:Building", - "Device": "fiware:Device", - "Animal": "fiware:Animal", - "Female": "schema:Female", - "FillingLevelSensor": "tutorial:FillingLevelSensor", - "Herbicide": "tutorial:Product", - "HVAC": "https://w3id.org/saref#HVAC", - "Male": "schema:Male", - "PartField": "tutorial:PartField", - "Person": "fiware:Person", - "SoilSensor": "tutorial:SoilSensor", - "TemperatureSensor": "tutorial:TemperatureSensor", - "Task": "fiware:Activity", - "Tractor": "tutorial:Tractor", - "Water": "tutorial:Water", - "actuator": "https://w3id.org/saref#actuator", - "additionalName": "schema:additionalName", - "address": "schema:address", - "airPollution": "https://w3id.org/saref#airPollution", - "atmosphericPressure": "https://w3id.org/saref#atmosphericPressure", - "barn": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn", - "batteryLevel": "fiware:batteryLevel", - "category": "fiware:category", - "configuration": "fiware:configuration", - "conservatory": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dconservatory", - "containedInPlace": "fiware:containedInPlace", - "controlledAsset": "fiware:controlledAsset", - "controlledProperty": "fiware:controlledProperty", - "cowshed": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dcowshed", - "dataProvider": "fiware:dataProvider", - "dateCreated": "fiware:dateCreated", - "dateFirstUsed": "fiware:dateFirstUsed", - "dateInstalled": "fiware:dateInstalled", - "dateLastCalibration": "fiware:dateLastCalibration", - "dateLastValueReported": "fiware:dateLastValueReported", - "dateManufactured": "fiware:dateManufactured", - "dateModified": "fiware:dateModified", - "depth": "https://w3id.org/saref#depth", - "description": "ngsi-ld:description", - "deviceState": "fiware:deviceState", - "digester": "https://wiki.openstreetmap.org/wiki/Tag:building%3Ddigester", - "eatingActivity": "https://w3id.org/saref#eatingActivity", - "email": "schema:email", - "endgun": "https://w3id.org/saref#endgun", - "familyName": "schema:familyName", - "farm": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm", - "farm_auxiliary": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm_auxiliary", - "faxNumber": "schema:faxNumber", - "filling": "https://w3id.org/saref#fillingLevel", - "firmwareVersion": "fiware:firmwareVersion", - "floorsAboveGround": "fiware:floorsAboveGround", - "floorsBelowGround": "fiware:floorsBelowGround", - "gender": "schema:gender", - "givenName": "schema:givenName", - "greenhouse": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dgreenhouse", - "hangar": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dhangar", - "hardwareVersion": "fiware:hardwareVersion", - "honorificPrefix": "schema:honorificPrefix", - "honorificSuffix": "schema:honorificSuffix", - "humidity": "https://w3id.org/saref#humidity", - "hut": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dhut", - "implement": "https://w3id.org/saref#implement", - "ipAddress": "fiware:ipAddress", - "irrSection": "https://w3id.org/saref#irrSection", - "irrSystem": "https://w3id.org/saref#irrSystem", - "isicV4": "schema:isicV4", - "jobTitle": "schema:jobTitle", - "location": "https://w3id.org/saref#location", - "macAddress": "fiware:macAddress", - "mcc": "fiware:mcc", - "meter": "https://w3id.org/saref#meter", - "milking": "https://w3id.org/saref#milking", - "mnc": "fiware:mnc", - "motion": "https://w3id.org/saref#motion", - "movementActivity": "https://w3id.org/saref#movementActivity", - "multimedia": "https://w3id.org/saref#multimedia", - "name": "schema:name", - "network": "https://w3id.org/saref#network", - "observedAt": "ngsi-ld:observedAt", - "occupancy": "https://w3id.org/saref#occupancy", - "occupier": "fiware:occupier", - "openingHours": "fiware:openingHours", - "osVersion": "fiware:osVersion", - "owner": "fiware:owner", - "precipitation": "https://w3id.org/saref#precipitation", - "pressure": "https://w3id.org/saref#pressure", - "providedBy": "fiware:providedBy", - "provider": "fiware:provider", - "refDeviceModel": "fiware:refDeviceModel", - "refMap": "fiware:refMap", - "rssi": "fiware:rssi", - "sensor": "https://w3id.org/saref#sensor", - "serialNumber": "fiware:serialNumber", - "service": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dservice", - "shed": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dshed", - "softwareVersion": "fiware:softwareVersion", - "soilMoisture": "https://w3id.org/saref#soilMoisture", - "solarRadiation": "https://w3id.org/saref#solarRadiation", - "source": "fiware:source", - "stable": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dstable", - "sty": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dsty", - "supportedProtocol": "fiware:supportedProtocol", - "taxID": "schema:taxID", - "telephone": "schema:telephone", - "temperature": "https://w3id.org/saref#temperature", - "transformer_tower": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dtransformer_tower", - "unitCode": "ngsi-ld:unitCode", - "value": "fiware:value", - "vatID": "schema:vatID", - "waterConsumption": "https://w3id.org/saref#waterConsumption", - "water_tower": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dwater_tower", - "weatherConditions": "https://w3id.org/saref#weatherConditions", - "weight": "https://w3id.org/saref#weight", - "windDirection": "https://w3id.org/saref#windDirection", - "windSpeed": "https://w3id.org/saref#windSpeed", - "status": "https://saref.etsi.org/core/status", - "state": "https://saref.etsi.org/core/hasState", - "heartRate": "https://purl.bioontology.org/ontology/MESH/D006339", - "product": "fiware:refObject", - "worker": "fiware:refAgent", - "field": "fiware:refTarget", - - "on": "https://w3id.org/saref#on", - "off": "https://w3id.org/saref#off", - "verified": "fiware:verified", - "species": "fiware:species", - "sex": "fiware:sex", - "legalID": "fiware:legalID" - } -} + "@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/data-models/user-context.jsonld b/data-models/user-context.jsonld new file mode 100644 index 0000000..8c9c658 --- /dev/null +++ b/data-models/user-context.jsonld @@ -0,0 +1,138 @@ +{ + "@context": { + "type": "@type", + "id": "@id", + "ngsi-ld": "https://uri.etsi.org/ngsi-ld/", + "fiware": "https://uri.fiware.org/ns/dataModels#", + "schema": "https://schema.org/", + "tutorial": "https://ngsi-ld-tutorials.readthedocs.io/en/latest/datamodels.html#", + "Building": "fiware:Building", + "Device": "fiware:Device", + "Animal": "fiware:Animal", + "Female": "schema:Female", + "FillingLevelSensor": "tutorial:FillingLevelSensor", + "Herbicide": "tutorial:Product", + "HVAC": "https://w3id.org/saref#HVAC", + "Male": "schema:Male", + "PartField": "tutorial:PartField", + "Person": "fiware:Person", + "SoilSensor": "tutorial:SoilSensor", + "TemperatureSensor": "tutorial:TemperatureSensor", + "Task": "fiware:Activity", + "Tractor": "tutorial:Tractor", + "Water": "tutorial:Water", + "actuator": "https://w3id.org/saref#actuator", + "additionalName": "schema:additionalName", + "address": "schema:address", + "airPollution": "https://w3id.org/saref#airPollution", + "atmosphericPressure": "https://w3id.org/saref#atmosphericPressure", + "barn": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dbarn", + "batteryLevel": "fiware:batteryLevel", + "category": "fiware:category", + "configuration": "fiware:configuration", + "conservatory": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dconservatory", + "containedInPlace": "fiware:containedInPlace", + "controlledAsset": "fiware:controlledAsset", + "controlledProperty": "fiware:controlledProperty", + "cowshed": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dcowshed", + "dataProvider": "fiware:dataProvider", + "dateCreated": "fiware:dateCreated", + "dateFirstUsed": "fiware:dateFirstUsed", + "dateInstalled": "fiware:dateInstalled", + "dateLastCalibration": "fiware:dateLastCalibration", + "dateLastValueReported": "fiware:dateLastValueReported", + "dateManufactured": "fiware:dateManufactured", + "dateModified": "fiware:dateModified", + "depth": "https://w3id.org/saref#depth", + "description": "ngsi-ld:description", + "deviceState": "fiware:deviceState", + "digester": "https://wiki.openstreetmap.org/wiki/Tag:building%3Ddigester", + "eatingActivity": "https://w3id.org/saref#eatingActivity", + "email": "schema:email", + "endgun": "https://w3id.org/saref#endgun", + "familyName": "schema:familyName", + "farm": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm", + "farm_auxiliary": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dfarm_auxiliary", + "faxNumber": "schema:faxNumber", + "filling": "https://w3id.org/saref#fillingLevel", + "firmwareVersion": "fiware:firmwareVersion", + "floorsAboveGround": "fiware:floorsAboveGround", + "floorsBelowGround": "fiware:floorsBelowGround", + "gender": "schema:gender", + "givenName": "schema:givenName", + "greenhouse": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dgreenhouse", + "hangar": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dhangar", + "hardwareVersion": "fiware:hardwareVersion", + "honorificPrefix": "schema:honorificPrefix", + "honorificSuffix": "schema:honorificSuffix", + "humidity": "https://w3id.org/saref#humidity", + "hut": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dhut", + "implement": "https://w3id.org/saref#implement", + "ipAddress": "fiware:ipAddress", + "irrSection": "https://w3id.org/saref#irrSection", + "irrSystem": "https://w3id.org/saref#irrSystem", + "isicV4": "schema:isicV4", + "jobTitle": "schema:jobTitle", + "location": "https://w3id.org/saref#location", + "macAddress": "fiware:macAddress", + "mcc": "fiware:mcc", + "meter": "https://w3id.org/saref#meter", + "milking": "https://w3id.org/saref#milking", + "mnc": "fiware:mnc", + "motion": "https://w3id.org/saref#motion", + "movementActivity": "https://w3id.org/saref#movementActivity", + "multimedia": "https://w3id.org/saref#multimedia", + "name": "schema:name", + "network": "https://w3id.org/saref#network", + "observedAt": "ngsi-ld:observedAt", + "occupancy": "https://w3id.org/saref#occupancy", + "occupier": "fiware:occupier", + "openingHours": "fiware:openingHours", + "osVersion": "fiware:osVersion", + "owner": "fiware:owner", + "precipitation": "https://w3id.org/saref#precipitation", + "pressure": "https://w3id.org/saref#pressure", + "providedBy": "fiware:providedBy", + "provider": "fiware:provider", + "refDeviceModel": "fiware:refDeviceModel", + "refMap": "fiware:refMap", + "rssi": "fiware:rssi", + "sensor": "https://w3id.org/saref#sensor", + "serialNumber": "fiware:serialNumber", + "service": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dservice", + "shed": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dshed", + "softwareVersion": "fiware:softwareVersion", + "soilMoisture": "https://w3id.org/saref#soilMoisture", + "solarRadiation": "https://w3id.org/saref#solarRadiation", + "source": "fiware:source", + "stable": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dstable", + "sty": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dsty", + "supportedProtocol": "fiware:supportedProtocol", + "taxID": "schema:taxID", + "telephone": "schema:telephone", + "temperature": "https://w3id.org/saref#temperature", + "transformer_tower": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dtransformer_tower", + "unitCode": "ngsi-ld:unitCode", + "value": "fiware:value", + "vatID": "schema:vatID", + "waterConsumption": "https://w3id.org/saref#waterConsumption", + "water_tower": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dwater_tower", + "weatherConditions": "https://w3id.org/saref#weatherConditions", + "weight": "https://w3id.org/saref#weight", + "windDirection": "https://w3id.org/saref#windDirection", + "windSpeed": "https://w3id.org/saref#windSpeed", + "status": "https://saref.etsi.org/core/status", + "state": "https://saref.etsi.org/core/hasState", + "heartRate": "https://purl.bioontology.org/ontology/MESH/D006339", + "product": "fiware:refObject", + "worker": "fiware:refAgent", + "field": "fiware:refTarget", + + "on": "https://w3id.org/saref#on", + "off": "https://w3id.org/saref#off", + "verified": "fiware:verified", + "species": "fiware:species", + "sex": "fiware:sex", + "legalID": "fiware:legalID" + } +} diff --git a/services b/services index 850d427..fe6c178 100755 --- a/services +++ b/services @@ -10,7 +10,7 @@ set -e SCORPIO="http://scorpio:9090/scorpio/" ORION="http://orion:1026/version" STELLIO="http://localhost:8080/actuator/health" -CONTEXT="http://context/ngsi-context.jsonld" +CONTEXT="http://context/user-context.jsonld" CORE_CONTEXT="https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld" dockerCmd="docker compose"