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