comparison flys-artifacts/doc/conf/meta-data.xml @ 1190:f514894ec2fd

merged flys-artifacts/2.5
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:17 +0200
parents be8b5c06a1f8
children 91d038c7aae5
comparison
equal deleted inserted replaced
917:b48c36076e17 1190:f514894ec2fd
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage">
3 <datacage>
4 <dc:macro name="load-system">
5 <dc:context connection="system">
6 <dc:statement>
7 SELECT id AS river_id, name as river_name FROM rivers
8 WHERE lower(name) LIKE lower(${river})
9 </dc:statement>
10 <dc:elements>
11 <river>
12 <dc:attribute name="name" value="${river_name}"/>
13 <dc:attribute name="db-id" value="${river_id}"/>
14 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
15 <discharge-table-nn>
16 <discharge-table-gauge>
17 <dc:context>
18 <dc:statement>
19 SELECT id AS gauge_id,
20 name AS gauge_name
21 FROM gauges WHERE river_id = ${river_id}
22 </dc:statement>
23 <dc:elements>
24 <gauge>
25 <dc:attribute name="name" value="${gauge_name}"/>
26 <dc:attribute name="db-id" value="${gauge_id}"/>
27 <dc:context>
28 <dc:statement>
29 SELECT description AS gauge_desc,
30 d.id AS discharge_id,
31 ti.start_time AS g_start,
32 ti.stop_time AS g_stop
33 FROM discharge_tables d JOIN time_intervals ti
34 ON d.time_interval_id = ti.id
35 WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
36 </dc:statement>
37 <dc:elements>
38 <historical>
39 <dc:attribute name="name" value="${gauge_desc}"/>
40 <dc:attribute name="from" value="${g_start}"/>
41 <dc:attribute name="to" value="${g_stop}"/>
42 <dc:attribute name="db-id" value="${discharge_id}"/></historical>
43 </dc:elements>
44 </dc:context>
45 </gauge>
46 </dc:elements>
47 </dc:context>
48 </discharge-table-gauge>
49 <fixations>
50 <dc:attribute name="id" value="fixations-${river_id}"/>
51 <dc:context>
52 <dc:statement>
53 SELECT id AS fix_id,
54 description AS fix_description
55 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
56 </dc:statement>
57 <dc:elements>
58 <fixation>
59 <dc:attribute name="name" value="${fix_description}"/>
60 <dc:attribute name="db-id" value="${fix_id}"/>
61 <columns>
62 <dc:context>
63 <dc:statement>
64 SELECT id AS fix_column_id,
65 name AS fix_column_name
66 FROM wst_columns WHERE wst_id = ${fix_id}
67 ORDER by position
68 </dc:statement>
69 <dc:elements>
70 <column>
71 <dc:attribute name="name" value="${fix_column_name}"/>
72 <dc:attribute name="db-id" value="${fix_column_id}"/></column>
73 </dc:elements>
74 </dc:context>
75 </columns>
76 </fixation>
77 </dc:elements>
78 </dc:context>
79 </fixations>
80 <flood-protections>
81 <dc:attribute name="id" value="flood-protections-${river_id}"/>
82 <dc:context>
83 <dc:statement>
84 SELECT id AS prot_id,
85 description AS prot_description
86 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
87 </dc:statement>
88 <dc:elements>
89 <flood-protection>
90 <dc:attribute name="name" value="${prot_description}"/>
91 <dc:attribute name="db-id" value="${prot_id}"/>
92 <columns>
93 <dc:context>
94 <dc:statement>
95 SELECT id AS prot_column_id,
96 name AS prot_column_name
97 FROM wst_columns WHERE wst_id = ${prot_id}
98 ORDER by position
99 </dc:statement>
100 <dc:elements>
101 <column>
102 <dc:attribute name="name" value="${prot_column_name}"/>
103 <dc:attribute name="db-id" value="${prot_column_id}"/></column>
104 </dc:elements>
105 </dc:context>
106 </columns>
107 </flood-protection>
108 </dc:elements>
109 </dc:context>
110 </flood-protections>
111 <flood-water-marks>
112 <dc:attribute name="id" value="flood-water-marks-${river_id}"/>
113 <dc:context>
114 <dc:statement>
115 SELECT id AS fw_id,
116 description AS fw_description
117 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
118 </dc:statement>
119 <dc:elements>
120 <flood-water-mark>
121 <dc:attribute name="name" value="${fw_description}"/>
122 <dc:attribute name="db-id" value="${fw_id}"/>
123 <columns>
124 <dc:context>
125 <dc:statement>
126 SELECT id AS fw_column_id,
127 name AS fw_column_name
128 FROM wst_columns WHERE wst_id = ${fw_id}
129 ORDER by position
130 </dc:statement>
131 <dc:elements>
132 <column>
133 <dc:attribute name="name" value="${fw_column_name}"/>
134 <dc:attribute name="db-id" value="${fw_column_id}"/></column>
135 </dc:elements>
136 </dc:context>
137 </columns>
138 </flood-water-mark>
139 </dc:elements>
140 </dc:context>
141 </flood-water-marks>
142 <water-levels>
143 <dc:attribute name="id" value="water-levels-${river_id}"/>
144 <dc:context>
145 <dc:statement>
146 SELECT id AS wl_id,
147 description AS wl_description
148 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
149 </dc:statement>
150 <dc:elements>
151 <water-level>
152 <dc:attribute name="name" value="${wl_description}"/>
153 <dc:attribute name="db-id" value="${wl_id}"/>
154 <columns>
155 <dc:context>
156 <dc:statement>
157 SELECT id AS wl_column_id,
158 name AS wl_column_name
159 FROM wst_columns WHERE wst_id = ${wl_id}
160 ORDER by position
161 </dc:statement>
162 <dc:elements>
163 <column>
164 <dc:attribute name="name" value="${wl_column_name}"/>
165 <dc:attribute name="db-id" value="${wl_column_id}"/></column>
166 </dc:elements>
167 </dc:context>
168 </columns>
169 </water-level>
170 </dc:elements>
171 </dc:context>
172 </water-levels>
173 <extra-longitudinal-sections>
174 <dc:attribute name="id" value="extra-longitudinal-sections-${river_id}"/>
175 <dc:context>
176 <dc:statement>
177 SELECT id AS els_id,
178 description AS els_description
179 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
180 </dc:statement>
181 <dc:elements>
182 <extra-longitudinal-section>
183 <dc:attribute name="name" value="${els_description}"/>
184 <dc:attribute name="db-id" value="${els_id}"/>
185 <columns>
186 <dc:context>
187 <dc:statement>
188 SELECT id AS els_column_id,
189 name AS els_column_name
190 FROM wst_columns WHERE wst_id = ${els_id}
191 ORDER by position
192 </dc:statement>
193 <dc:elements>
194 <column>
195 <dc:attribute name="name" value="${els_column_name}"/>
196 <dc:attribute name="db-id" value="${els_column_id}"/></column>
197 </dc:elements>
198 </dc:context>
199 </columns>
200 </extra-longitudinal-section>
201 </dc:elements>
202 </dc:context>
203 </extra-longitudinal-sections>
204 </discharge-table-nn>
205 </dc:if>
206 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
207 <computed-discharge-curve>
208 <mainvalue>
209 <dc:attribute name="factory" value="mainvalue"/>
210 <dc:attribute name="db-ids" value="${river_id}"/>
211 </mainvalue>
212 </computed-discharge-curve>
213 </dc:if>
214 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
215 <longitudinal-section>
216 <dc:call-macro name="longitudinal_section-recommended"/>
217 <fixations><dc:attribute name="ref" value="fixations-${river_id}"/></fixations>
218 <flood-protections><dc:attribute name="ref" value="flood-protections-${river_id}"/></flood-protections>
219 <flood-water-marks><dc:attribute name="ref" value="flood-water-marks-${river_id}"/></flood-water-marks>
220 <water-levels><dc:attribute name="ref" value="water-levels-${river_id}"/></water-levels>
221 <extra-longitudinal-sections><dc:attribute name="ref" value="extra-longitudinal-sections-${river_id}"/></extra-longitudinal-sections>
222 </longitudinal-section>
223 <dc:macro name="longitudinal_section-recommended">
224 <annotation>
225 <dc:attribute name="factory" value="annotations"/>
226 <dc:attribute name="ids" value="${river_id}"/>
227 </annotation>
228 </dc:macro>
229 </dc:if>
230 <dc:if test="dc:contains($artifact-outs, 'floodmap')">
231 <floodmap>
232 <dc:choose>
233 <dc:when test="dc:contains($parameters, 'recommended')">
234 <dc:call-macro name="flood-map-recommended"/>
235 </dc:when>
236 <dc:when test="dc:contains($parameters, 'dem')">
237 <dc:call-macro name="flood-map-dem"/>
238 </dc:when>
239 <dc:otherwise>
240 <dc:call-macro name="flood-map-complete"/>
241 </dc:otherwise>
242 </dc:choose>
243 </floodmap>
244 <dc:macro name="flood-map-recommended">
245 <dc:comment>
246 FIXME: Following two macros look identical to me.
247 </dc:comment>
248 <kilometrage>
249 <riveraxis>
250 <dc:attribute name="factory" value="riveraxis"/>
251 <dc:attribute name="ids" value="${river_id}"/>
252 </riveraxis>
253 </kilometrage>
254 <rastermap>
255 <background>
256 <dc:attribute name="factory" value="wmsbackground"/>
257 <dc:attribute name="ids" value="${river_id}"/>
258 </background>
259 </rastermap>
260 </dc:macro>
261 <dc:macro name="flood-map-dem">
262 <dems>
263 <dc:context>
264 <dc:statement>
265 SELECT id AS dem_id,
266 lower AS dem_lower,
267 upper AS dem_upper
268 FROM dem WHERE river_id = ${river_id}
269 </dc:statement>
270 <dc:elements>
271 <dem>
272 <dc:attribute name="factory" value="demfactory"/>
273 <dc:attribute name="ids" value="${dem_id}"/>
274 <dc:attribute name="description" value="${dem_lower}-${dem_upper}"/>
275 </dem>
276 </dc:elements>
277 </dc:context>
278 </dems>
279 </dc:macro>
280 <dc:macro name="flood-map-complete">
281 <kilometrage>
282 <riveraxis>
283 <dc:attribute name="factory" value="riveraxis"/>
284 <dc:attribute name="ids" value="${river_id}"/>
285 </riveraxis>
286 </kilometrage>
287 <rastermap>
288 <background>
289 <dc:attribute name="factory" value="wmsbackground"/>
290 <dc:attribute name="ids" value="${river_id}"/>
291 </background>
292 </rastermap>
293 <dc:call-macro name="flood-map-dem"/>
294 </dc:macro>
295 </dc:if>
296 </river>
297 </dc:elements>
298 </dc:context>
299 </dc:macro>
300
301 <dc:choose>
302 <dc:comment>
303 User specific part
304 ------------------
305 </dc:comment>
306 <dc:when test="dc:contains($parameters, 'user-id')">
307 <old_calculations>
308 <dc:context connection="user">
309 <dc:statement>SELECT u.id AS user_id, c.id AS collection_id
310 FROM collections c JOIN users u ON c.user_id = u.id
311 WHERE u.gid = CAST(${user-id} AS uuid)
312 ORDER BY c.creation DESC
313 </dc:statement>
314 <dc:elements>
315 <dc:context>
316 <dc:statement>SELECT id AS a_id, state AS a_state, gid AS a_gid, creation AS a_creation
317 FROM master_artifacts m
318 WHERE collection_id = ${collection_id} AND gid &lt;&gt; CAST(${artifact-id} AS uuid)
319 AND EXISTS (
320 SELECT id FROM artifact_data WHERE artifact_id = m.id AND k = 'river' AND v = ${river})
321 </dc:statement>
322 <dc:elements>
323 <dc:choose>
324 <dc:when test="dc:contains($artifact-outs, 'longitudinal_section')">
325 <dc:context>
326 <dc:statement>SELECT id AS out_id FROM outs WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
327 </dc:statement>
328 <dc:elements>
329 <dc:context>
330 <dc:statement>SELECT name AS facet_name, num as facet_num, description AS facet_description
331 FROM facets WHERE out_id = ${out_id} ORDER BY num ASC, name DESC
332 </dc:statement>
333 <longitudinal_section_columns>
334 <dc:attribute name="description" value="${river} ${a_creation}"/>
335 <dc:elements>
336 <dc:element name="${facet_name}">
337 <dc:attribute name="description" value="${facet_description}"/>
338 <dc:attribute name="ids" value="${facet_num}"/>
339 <dc:attribute name="factory" value="winfo"/>
340 <dc:attribute name="artifact-id" value="${a_gid}"/>
341 <dc:attribute name="out" value="longitudinal_section"/>
342 </dc:element>
343 </dc:elements>
344 </longitudinal_section_columns>
345 </dc:context>
346 </dc:elements>
347 </dc:context>
348 </dc:when>
349 </dc:choose>
350 </dc:elements>
351 </dc:context>
352 </dc:elements>
353 </dc:context>
354 </old_calculations>
355 <dc:comment>
356 System specific part
357 --------------------
358 </dc:comment>
359 <dc:call-macro name="load-system"/>
360 </dc:when>
361 <dc:comment>
362 System specific part only
363 -------------------------
364 </dc:comment>
365 <dc:otherwise>
366 <dc:call-macro name="load-system"/>
367 </dc:otherwise>
368 </dc:choose>
369 </datacage>
370 </dc:template>

http://dive4elements.wald.intevation.org