]> git.openstreetmap.org Git - nominatim.git/blob - test/bdd/db/update/linked_places.feature
extratags should become null when empty
[nominatim.git] / test / bdd / db / update / linked_places.feature
1 @DB
2 Feature: Updates of linked places
3     Tests that linked places are correctly added and deleted.
4
5     Scenario: Linking is kept when boundary is updated
6         Given the 0.1 grid
7          | 10 |   | 11 |
8          |    | 1 |    |
9          | 13 |   | 12 |
10         Given the places
11             | osm | class | type | name |
12             | N1  | place | city | foo  |
13         And the places
14             | osm | class    | type           | name | admin | geometry |
15             | R1  | boundary | administrative | foo  | 8     | (10,11,12,13,10) |
16         When importing
17         Then placex contains
18          | object | linked_place_id |
19          | N1     | R1 |
20         When updating places
21          | osm | class    | type           | name | name+name:de | admin | geometry |
22          | R1  | boundary | administrative | foo  | Dingens      | 8     | (10,11,12,13,10) |
23         Then placex contains
24          | object | linked_place_id |
25          | N1     | R1 |
26
27
28     Scenario: Add linked place when linking relation is renamed
29         Given the 0.1 grid
30          | 10 |   | 11 |
31          |    | 1 |    |
32          | 13 |   | 12 |
33         Given the places
34             | osm | class | type | name |
35             | N1  | place | city | foo  |
36         And the places
37             | osm | class    | type           | name | admin | geometry |
38             | R1  | boundary | administrative | foo  | 8     | (10,11,12,13,10) |
39         When importing
40         Then placex contains
41          | object | linked_place_id |
42          | N1     | R1 |
43         When sending search query "foo"
44          | dups |
45          | 1    |
46         Then results contain
47          | osm |
48          | R1 |
49         When updating places
50          | osm | class    | type           | name   | admin | geometry |
51          | R1  | boundary | administrative | foobar | 8     | (10,11,12,13,10) |
52         Then placex contains
53          | object | linked_place_id |
54          | N1     | - |
55         When sending search query "foo"
56          | dups |
57          | 1    |
58         Then results contain
59          | osm |
60          | N1 |
61
62     Scenario: Add linked place when linking relation is removed
63         Given the 0.1 grid
64          | 10 |   | 11 |
65          |    | 1 |    |
66          | 13 |   | 12 |
67         Given the places
68             | osm | class | type | name |
69             | N1  | place | city | foo  |
70         And the places
71             | osm | class    | type           | name | admin | geometry |
72             | R1  | boundary | administrative | foo  | 8     | (10,11,12,13,10) |
73         When importing
74         And sending search query "foo"
75          | dups |
76          | 1    |
77         Then results contain
78          | osm |
79          | R1 |
80         When marking for delete R1
81         Then placex contains
82          | object | linked_place_id |
83          | N1     | - |
84         When sending search query "foo"
85          | dups |
86          | 1    |
87         Then results contain
88          | osm |
89          | N1 |
90
91     Scenario: Remove linked place when linking relation is added
92         Given the 0.1 grid
93          | 10 |   | 11 |
94          |    | 1 |    |
95          | 13 |   | 12 |
96         Given the places
97             | osm | class | type | name |
98             | N1  | place | city | foo  |
99         When importing
100         And sending search query "foo"
101          | dups |
102          | 1    |
103         Then results contain
104          | osm |
105          | N1 |
106         When updating places
107          | osm | class    | type           | name   | admin | geometry |
108          | R1  | boundary | administrative | foo    | 8     | (10,11,12,13,10) |
109         Then placex contains
110          | object | linked_place_id |
111          | N1     | R1 |
112         When sending search query "foo"
113          | dups |
114          | 1    |
115         Then results contain
116          | osm |
117          | R1 |
118
119     Scenario: Remove linked place when linking relation is renamed
120         Given the 0.1 grid
121          | 10 |   | 11 |
122          |    | 1 |    |
123          | 13 |   | 12 |
124         Given the places
125             | osm | class | type | name |
126             | N1  | place | city | foo  |
127         And the places
128          | osm | class    | type           | name   | admin | geometry |
129          | R1  | boundary | administrative | foobar | 8     | (10,11,12,13,10) |
130         When importing
131         And sending search query "foo"
132          | dups |
133          | 1    |
134         Then results contain
135          | osm |
136          | N1 |
137         When updating places
138          | osm | class    | type           | name   | admin | geometry |
139          | R1  | boundary | administrative | foo    | 8     | (10,11,12,13,10) |
140         Then placex contains
141          | object | linked_place_id |
142          | N1     | R1 |
143         When sending search query "foo"
144          | dups |
145          | 1    |
146         Then results contain
147          | osm |
148          | R1 |
149
150     Scenario: Update linking relation when linkee name is updated
151         Given the 0.1 grid
152          | 10 |   | 11 |
153          |    | 3 |    |
154          | 13 |   | 12 |
155         Given the places
156          | osm | class    | type           | name | admin | geometry |
157          | R1  | boundary | administrative | rel  | 8     | (10,11,12,13,10) |
158         And the places
159          | osm | class    | type        | name+name:de |
160          | N3  | place    | city        | pnt          |
161         And the relations
162          | id | members  |
163          | 1  | N3:label |
164         When importing
165         Then placex contains
166          | object | linked_place_id | name+_place_name:de |
167          | R1     | -               | pnt  |
168         And placex contains
169          | object | linked_place_id | name+name:de |
170          | N3     | R1              | pnt  |
171         When updating places
172          | osm | class    | type        | name+name:de |
173          | N3  | place    | city        | newname      |
174         Then placex contains
175          | object | linked_place_id | name+name:de |
176          | N3     | R1              | newname  |
177         And placex contains
178          | object | linked_place_id | name+_place_name:de |
179          | R1     | -               | newname  |
180
181     Scenario: Update linking relation when linkee name is deleted
182         Given the 0.1 grid
183          | 10 |   | 11 |
184          |    | 3 |    |
185          | 13 |   | 12 |
186         Given the places
187          | osm | class    | type           | name | admin | geometry |
188          | R1  | boundary | administrative | rel  | 8     | (10,11,12,13,10) |
189         And the places
190          | osm | class    | type           | name |
191          | N3  | place    | city           | pnt  |
192         And the relations
193          | id | members  |
194          | 1  | N3:label |
195         When importing
196         Then placex contains
197          | object | linked_place_id | name+_place_name | name+name |
198          | R1     | -               | pnt              | rel       |
199         And placex contains
200          | object | linked_place_id | name+name |
201          | N3     | R1              | pnt  |
202         When sending search query "pnt"
203         Then results contain
204           | osm |
205           | R1  |
206         When updating places
207          | osm | class    | type        | name+name:de |
208          | N3  | place    | city        | depnt        |
209         Then placex contains
210          | object | linked_place_id | name+name:de |
211          | N3     | R1              | depnt  |
212         And placex contains
213          | object | linked_place_id | name+_place_name:de | name+name |
214          | R1     | -               | depnt               | rel       |
215         When sending search query "pnt"
216         Then exactly 0 results are returned
217
218     Scenario: Updating linkee extratags keeps linker's extratags
219         Given the 0.1 grid
220          | 10 |   | 11 |
221          |    | 3 |    |
222          | 13 |   | 12 |
223         Given the named places
224          | osm | class    | type           | extra+wikidata | admin | geometry |
225          | R1  | boundary | administrative | 34             | 8     | (10,11,12,13,10) |
226         And the named places
227          | osm | class    | type           |
228          | N3  | place    | city           |
229         And the relations
230          | id | members  |
231          | 1  | N3:label |
232         When importing
233         Then placex contains
234          | object | extratags |
235          | R1     | 'wikidata' : '34', 'linked_place' : 'city' |
236         When updating places
237          | osm | class    | type        | name    | extra+oneway |
238          | N3  | place    | city        | newname | yes          |
239         Then placex contains
240          | object | extratags |
241          | R1     | 'wikidata' : '34', 'oneway' : 'yes', 'linked_place' : 'city' |
242
243     Scenario: Remove linked_place info when linkee is removed
244         Given the 0.1 grid
245          | 10 |   | 11 |
246          |    | 1 |    |
247          | 13 |   | 12 |
248         Given the places
249             | osm | class | type | name |
250             | N1  | place | city | foo  |
251         And the places
252             | osm | class    | type           | name | admin | geometry |
253             | R1  | boundary | administrative | foo  | 8     | (10,11,12,13,10) |
254         When importing
255         Then placex contains
256             | object | extratags |
257             | R1     | 'linked_place' : 'city' |
258         When marking for delete N1
259         Then placex contains
260             | object | extratags |
261             | R1     | - |
262
263     Scenario: Update linked_place info when linkee type changes
264         Given the 0.1 grid
265          | 10 |   | 11 |
266          |    | 1 |    |
267          | 13 |   | 12 |
268         Given the places
269             | osm | class | type | name |
270             | N1  | place | city | foo  |
271         And the places
272             | osm | class    | type           | name | admin | geometry |
273             | R1  | boundary | administrative | foo  | 8     | (10,11,12,13,10) |
274         When importing
275         Then placex contains
276             | object | extratags |
277             | R1     | 'linked_place' : 'city' |
278         When updating places
279             | osm | class | type | name |
280             | N1  | place | town | foo  |
281         Then placex contains
282             | object | extratags |
283             | R1     | 'linked_place' : 'town' |
284
285
286     Scenario: Keep linking and ranks when place type changes
287         Given the grid
288             | 1 |   |   | 2 |
289             |   |   | 9 |   |
290             | 4 |   |   | 3 |
291         And the places
292             | osm | class    | type           | name | admin | geometry    |
293             | R1  | boundary | administrative | foo  | 8     | (1,2,3,4,1) |
294         And the places
295             | osm | class | type | name | geometry |
296             | N1  | place | city | foo  | 9        |
297         When importing
298         Then placex contains
299             | object | linked_place_id | rank_address |
300             | N1     | R1              | 16           |
301             | R1     | -               | 16           |
302
303         When updating places
304             | osm | class | type | name | geometry |
305             | N1  | place | town | foo  | 9        |
306         Then placex contains
307             | object | linked_place_id | rank_address |
308             | N1     | R1              | 16           |
309             | R1     | -               | 16           |
310
311
312     Scenario: Invalidate surrounding place nodes when place type changes
313         Given the grid
314             | 1 |   |   | 2 |
315             |   | 8 | 9 |   |
316             | 4 |   |   | 3 |
317         And the places
318             | osm | class    | type           | name | admin | geometry    |
319             | R1  | boundary | administrative | foo  | 8     | (1,2,3,4,1) |
320         And the places
321             | osm | class | type | name | geometry |
322             | N1  | place | town | foo  | 9        |
323             | N2  | place | city | bar  | 8        |
324         And the relations
325          | id | members  |
326          | 1  | N1:label |
327         When importing
328         Then placex contains
329             | object | linked_place_id | rank_address |
330             | N1     | R1              | 16           |
331             | R1     | -               | 16           |
332             | N2     | -               | 18           |
333
334         When updating places
335             | osm | class | type   | name | geometry |
336             | N1  | place | suburb | foo  | 9        |
337         Then placex contains
338             | object | linked_place_id | rank_address |
339             | N1     | R1              | 20           |
340             | R1     | -               | 20           |
341             | N2     | -               | 16           |