Skip to content

Commit 9940eea

Browse files
author
Fernando López Aguilar
authored
Merge pull request #41 from stellio-hub/fix/602-linked-data-relationships-data-models
fix: misc fixes and alignments in 602
2 parents c87e8da + f74de20 commit 9940eea

8 files changed

Lines changed: 88 additions & 127 deletions

features/602.ngsild.RelationshipsAndDataModels_Stellio.feature

Lines changed: 51 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Feature: test tutorial 602 Linked Data: Relationships and Data Models (Stellio)
77
git-clone: https://github.com/FIWARE/tutorials.Relationships-Linked-Data.git
88
git-directory: /tmp/tutorials.Relationships-Linked-Data
99

10-
shell-commands: git checkout NGSI-v2; ./services create; ./services stellio
10+
shell-commands: git checkout NGSI-v2; ./services stellio
1111
clean-shell-commands: ./services stop
1212

1313
# Overall Note: The tutorial does not say anything out the response code expected.
@@ -18,103 +18,70 @@ Feature: test tutorial 602 Linked Data: Relationships and Data Models (Stellio)
1818
Given I set the tutorial 602
1919

2020

21-
#
22-
# Request 1
23-
# Note: The expected body in the Tutorial has the following differences with respect to the current Stellio version:
24-
# 1) attribute '@context' expected 'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld'
25-
# current 'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld'. In this respect
26-
# the text itself of the tutorial shall be corrected
27-
# 2) attribute 'name' expected first, instead it is second after attribute 'https://schema.org/address'
28-
#
2921
Scenario: [1] DISPLAY ALL entities of a given type (BUILDINGS)
30-
When I send GET HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities"
31-
And With header 'NA$NA'
32-
And With parameters "type$https://uri.fiware.org/ns/data-models#Building$options$keyValues"
22+
When I prepare a GET HTTP request for "obtaining an entity data" to "http://localhost:8080/ngsi-ld/v1/entities"
23+
And I set header Accept to application/ld+json
24+
And the params equal to "type=https://uri.fiware.org/ns/data-models#Building"
25+
And the params equal to "options=keyValues"
26+
And I perform the request
3327
Then I receive from Stellio "200" response code with the body equal to "response602-01.json"
3428

3529

36-
#
37-
# Request 2
38-
# Note: The expected body in the Tutorial has the following differences with respect to the current Stellio version:
39-
# 1) attribute 'name' expected first, instead it is last
40-
#
4130
Scenario: [2] DISPLAY ALL entities of a given type (PRODUCT)
42-
When I send GET HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities"
43-
And With header 'Link$<https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
44-
And With parameters "type$https://fiware.github.io/tutorials.Step-by-Step/schema/Product$options$keyValues"
31+
When I prepare a GET HTTP request for "obtaining entities data" to "http://localhost:8080/ngsi-ld/v1/entities"
32+
And I set header Link to <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
33+
And the params equal to "type=https://fiware.github.io/tutorials.Step-by-Step/schema/Product"
34+
And the params equal to "options=keyValues"
35+
And I perform the request
4536
Then I receive from Stellio "200" response code with the body equal to "response602-02.json"
4637

4738

48-
#
49-
# Request 3
50-
# Note: The expected body in the Tutorial has the following differences with respect to the current Stellio version:
51-
# 1) attribute 'name' expected first, instead it is second after 'maxCapacity' attribute
52-
#
5339
Scenario: [3] DISPLAY ALL entities of a given type (SHELF)
54-
When I send GET HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities"
55-
And With header 'Link$<https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
56-
And With parameters "type$Shelf$options$keyValues"
40+
When I prepare a GET HTTP request for "obtaining entities data" to "http://localhost:8080/ngsi-ld/v1/entities"
41+
And I set header Link to <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
42+
And the params equal to "type=Shelf"
43+
And the params equal to "options=keyValues"
44+
And I perform the request
5745
Then I receive from Stellio "200" response code with the body equal to "response602-03.json"
5846

5947

60-
#
61-
# Request 4
62-
# Note: The expected body in the Tutorial has the following differences with respect to the current Stellio version:
63-
# 1) attributes order completely mixed-up. Expected: name, maxCapacity, location, Current: location, maxCapacity, name
64-
#
6548
Scenario: [4] OBTAIN SHELF INFORMATION
66-
When I send GET HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001/"
67-
And With header 'Link$<https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
68-
And With parameters "options$keyValues"
49+
When I prepare a GET HTTP request for "obtaining an entity data" to "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001"
50+
And I set header Link to <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
51+
And the params equal to "options=keyValues"
52+
And I perform the request
6953
Then I receive from Stellio "200" response code with the body equal to "response602-04.json"
7054

7155

7256
#
7357
# Request 5
7458
#
7559
Scenario Outline: [5] ADDING 1-1 RELATIONSHIPS
76-
When I send POST HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001/attrs"
77-
# And With the post header "fiware-servicepath": " /"
78-
And With the post header "NA": "NA"
79-
And With the body request described in an Stellio file "<file>"
80-
Then I receive a HTTP response with the following Stellio data
81-
| Status-Code | Location | Connection | fiware-correlator |
82-
| 204 | <location> | Keep-Alive | Any |
60+
When I prepare a POST HTTP request for "creating an entity" to "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001/attrs"
61+
And I set header Content-Type to application/ld+json
62+
And I set the body request as described in <file>
63+
And I perform the request
64+
Then I receive a HTTP response with the following Stellio data
65+
| Status-Code | Location |
66+
| 204 | <location> |
8367

8468
Examples:
8569
| file | location |
8670
| request602-05.json | Any |
8771

8872

89-
#
90-
# Request 6
91-
# Note: The expected body in the Tutorial has the following differences with respect to the current Stellio version:
92-
# 1) attribute '@context'
93-
# expected 'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld'
94-
# current 'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld'
95-
# 2) expected attributes: name, locatedIn, maxCapacity, numberOfItems, stocks, location,
96-
# current attributes: location, maxCapacity, name
97-
# 3) order of attributes of locatedIn is mixedup.
98-
# expected: type, object, installedBy, requestedBy, statusOfWork
99-
# current: object, type, requestedBy, installedBy, statusOfWork
100-
# 4) attributes requestedBy, installedBy, statusOfWork miss the indication of the schema (https://fiware.github.io/tutorials.Step-by-Step/schema/)
101-
#
10273
Scenario: [6] OBTAIN THE UPDATED SHELF
10374
When I send GET HTTP request to "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001"
10475
Then I receive a HTTP "200" response code from Stellio with the body equal to "response602-06.json"
10576

10677

107-
#
108-
# Request 7
109-
# Note: The expected body in the Tutorial has the following differences with respect to the current Stellio version:
110-
# 1) wrong value for attribute '@context.
111-
# expected: 'https://fiware.github.io/tutorials.Step-by-Step/datamodels-context.jsonld'
112-
# current: 'https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld'
113-
#
11478
Scenario: [7] FIND THE STORE IN WHICH A SPECIFIC SHELF IS LOCATED
115-
When I send GET HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001/"
116-
And With header 'Link$<https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
117-
And With parameters "attrs$locatedIn$options$keyValues"
79+
When I prepare a GET HTTP request for "obtaining an entity data" to "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Shelf:unit001"
80+
And I set header Link to <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
81+
And I set header Accept to application/ld+json
82+
And the params equal to "attrs=locatedIn"
83+
And the params equal to "options=keyValues"
84+
And I perform the request
11885
Then I receive from Stellio "200" response code with the body equal to "response602-07.json"
11986

12087

@@ -132,12 +99,13 @@ Feature: test tutorial 602 Linked Data: Relationships and Data Models (Stellio)
13299
# Request 9
133100
#
134101
Scenario Outline: [9] ADDING 1-MANY RELATIONSHIP
135-
When I send POST HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Building:store001/attrs"
136-
And With the post header "NA": "NA"
137-
And With the body request described in an Stellio file "<file>"
138-
Then I receive a HTTP response with the following Stellio data
139-
| Status-Code | Location | Connection | fiware-correlator |
140-
| 204 | <location> | Keep-Alive | Any |
102+
When I prepare a POST HTTP request for "adding new attribute" to "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:Building:store001/attrs"
103+
And I set header Content-Type to application/ld+json
104+
And I set the body request as described in <file>
105+
And I perform the request
106+
Then I receive a HTTP response with the following Stellio data
107+
| Status-Code | Location |
108+
| 204 | <location> |
141109

142110
Examples:
143111
| file | location |
@@ -158,12 +126,13 @@ Feature: test tutorial 602 Linked Data: Relationships and Data Models (Stellio)
158126
# Request 11
159127
#
160128
Scenario Outline: [11] CREATING COMPLEX RELATIONSHIPS
161-
When I send POST HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities/"
162-
And With the post header "NA": "NA"
163-
And With the body request described in an Stellio file "<file>"
164-
Then I receive a HTTP response with the following Stellio data
165-
| Status-Code | Location | Connection | fiware-correlator |
166-
| 201 | <location> | Keep-Alive | Any |
129+
When I prepare a POST HTTP request for "creating an entity" to "http://localhost:8080/ngsi-ld/v1/entities/"
130+
And I set header Content-Type to application/ld+json
131+
And I set the body request as described in <file>
132+
And I perform the request
133+
Then I receive a HTTP response with the following Stellio data
134+
| Status-Code | Location |
135+
| 201 | <location> |
167136

168137
Examples:
169138
| file | location |
@@ -190,17 +159,9 @@ Feature: test tutorial 602 Linked Data: Relationships and Data Models (Stellio)
190159
Then I receive from Stellio "200" response code with the body equal to "response602-13.json"
191160

192161

193-
#
194-
# Request 14
195-
# Note: The expected body in the Tutorial has the following differences with respect to the current Stellio version:
196-
# 1) wrong value for attribute '@context.
197-
# expected: 'https://fiware.github.io/tutorials.Step-by-Step/datamodels-context.jsonld'
198-
# current: 'https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld'
199-
# 2) expected attributes order: type, orderDate, orderedProduct, requestedBy, requestedFor, stockCount
200-
# current attributes order: type, requestedFor, requestedBy, orderedProduct, stockCount, orderDate
201-
#
202162
Scenario: [14] OBTAIN STOCK ORDER
203-
When I send GET HTTP request to Stellio at "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:StockOrder:001"
204-
And With header 'NA$NA'
205-
And With parameters "options$keyValues"
163+
When I prepare a GET HTTP request for "obtaining an entity data" to "http://localhost:8080/ngsi-ld/v1/entities/urn:ngsi-ld:StockOrder:001"
164+
And I set header Accept to application/ld+json
165+
And the params equal to "options=keyValues"
166+
And I perform the request
206167
Then I receive from Stellio "200" response code with the body equal to "response602-14.json"

features/data/602.LD-RelationshipsAndDataModels/response602-01.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[
22
{
3-
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld",
3+
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld",
44
"id": "urn:ngsi-ld:Building:store001",
55
"type": "https://uri.fiware.org/ns/data-models#Building",
66
"https://uri.fiware.org/ns/data-models#category": {
7-
"vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dcommercial"
7+
"vocab": "openstreetmap:commercial"
88
},
99
"https://schema.org/address": {
10-
"streetAddress": "Bornholmer Straße 65",
11-
"addressRegion": "Berlin",
12-
"addressLocality": "Prenzlauer Berg",
13-
"postalCode": "10439"
10+
"https://schema.org/streetAddress": "Bornholmer Straße 65",
11+
"https://schema.org/addressRegion": "Berlin",
12+
"https://schema.org/addressLocality": "Prenzlauer Berg",
13+
"https://schema.org/postalCode": "10439"
1414
},
1515
"location": {
1616
"type": "Point",
@@ -22,17 +22,17 @@
2222
"https://schema.org/name": "Bösebrücke Einkauf"
2323
},
2424
{
25-
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld",
25+
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld",
2626
"id": "urn:ngsi-ld:Building:store002",
2727
"type": "https://uri.fiware.org/ns/data-models#Building",
2828
"https://uri.fiware.org/ns/data-models#category": {
29-
"vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dcommercial"
29+
"vocab": "openstreetmap:commercial"
3030
},
3131
"https://schema.org/address": {
32-
"streetAddress": "Friedrichstraße 44",
33-
"addressRegion": "Berlin",
34-
"addressLocality": "Kreuzberg",
35-
"postalCode": "10969"
32+
"https://schema.org/streetAddress": "Friedrichstraße 44",
33+
"https://schema.org/addressRegion": "Berlin",
34+
"https://schema.org/addressLocality": "Kreuzberg",
35+
"https://schema.org/postalCode": "10969"
3636
},
3737
"location": {
3838
"type": "Point",
@@ -44,17 +44,17 @@
4444
"https://schema.org/name": "Checkpoint Markt"
4545
},
4646
{
47-
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld",
47+
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld",
4848
"id": "urn:ngsi-ld:Building:store003",
4949
"type": "https://uri.fiware.org/ns/data-models#Building",
5050
"https://uri.fiware.org/ns/data-models#category": {
51-
"vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dcommercial"
51+
"vocab": "openstreetmap:commercial"
5252
},
5353
"https://schema.org/address": {
54-
"streetAddress": "Mühlenstrasse 10",
55-
"addressRegion": "Berlin",
56-
"addressLocality": "Friedrichshain",
57-
"postalCode": "10243"
54+
"https://schema.org/streetAddress": "Mühlenstrasse 10",
55+
"https://schema.org/addressRegion": "Berlin",
56+
"https://schema.org/addressLocality": "Friedrichshain",
57+
"https://schema.org/postalCode": "10243"
5858
},
5959
"location": {
6060
"type": "Point",
@@ -66,17 +66,17 @@
6666
"https://schema.org/name": "East Side Galleria"
6767
},
6868
{
69-
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld",
69+
"@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld",
7070
"id": "urn:ngsi-ld:Building:store004",
7171
"type": "https://uri.fiware.org/ns/data-models#Building",
7272
"https://uri.fiware.org/ns/data-models#category": {
73-
"vocab": "https://wiki.openstreetmap.org/wiki/Tag:building%3Dcommercial"
73+
"vocab": "openstreetmap:commercial"
7474
},
7575
"https://schema.org/address": {
76-
"streetAddress": "Panoramastraße 1A",
77-
"addressRegion": "Berlin",
78-
"addressLocality": "Mitte",
79-
"postalCode": "10178"
76+
"https://schema.org/streetAddress": "Panoramastraße 1A",
77+
"https://schema.org/addressRegion": "Berlin",
78+
"https://schema.org/addressLocality": "Mitte",
79+
"https://schema.org/postalCode": "10178"
8080
},
8181
"location": {
8282
"type": "Point",

features/data/602.LD-RelationshipsAndDataModels/response602-03.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"location": {
88
"type": "Point",
99
"coordinates": [
10-
13.398611,
10+
13.3986112,
1111
52.554699
1212
]
1313
}
@@ -20,7 +20,7 @@
2020
"location": {
2121
"type": "Point",
2222
"coordinates": [
23-
13.398722,
23+
13.3987221,
2424
52.554664
2525
]
2626
}
@@ -33,7 +33,7 @@
3333
"location": {
3434
"type": "Point",
3535
"coordinates": [
36-
13.398722,
36+
13.3987221,
3737
52.554664
3838
]
3939
}
@@ -72,7 +72,7 @@
7272
"location": {
7373
"type": "Point",
7474
"coordinates": [
75-
13.444711,
75+
13.4447112,
7676
52.503199
7777
]
7878
}
@@ -85,7 +85,7 @@
8585
"location": {
8686
"type": "Point",
8787
"coordinates": [
88-
13.444722,
88+
13.4447221,
8989
52.503164
9090
]
9191
}
@@ -98,7 +98,7 @@
9898
"location": {
9999
"type": "Point",
100100
"coordinates": [
101-
13.444722,
101+
13.4447221,
102102
52.503164
103103
]
104104
}
@@ -124,8 +124,8 @@
124124
"location": {
125125
"type": "Point",
126126
"coordinates": [
127-
13.409411,
128-
52.520803
127+
13.4094111,
128+
52.5208028
129129
]
130130
}
131131
}

features/data/602.LD-RelationshipsAndDataModels/response602-04.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"maxCapacity": 50,
66
"location": {
77
"type": "Point",
8-
"coordinates": [13.398611, 52.554699]
8+
"coordinates": [13.3986112, 52.554699]
99
}
1010
}

features/data/602.LD-RelationshipsAndDataModels/response602-06-AsTutorial.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"type": "GeoProperty",
3939
"value": {
4040
"type": "Point",
41-
"coordinates": [13.398611, 52.554699]
41+
"coordinates": [13.3986112, 52.554699]
4242
}
4343
}
4444
}

features/data/602.LD-RelationshipsAndDataModels/response602-06.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "GeoProperty",
66
"value": {
77
"type": "Point",
8-
"coordinates": [13.398611, 52.554699]
8+
"coordinates": [13.3986112, 52.554699]
99
}
1010
},
1111
"https://fiware.github.io/tutorials.Step-by-Step/schema/maxCapacity": {

0 commit comments

Comments
 (0)