comparison flys-artifacts/doc/conf/meta-data.xml @ 3468:f37e7e8907cb

merged flys-artifacts/2.8.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:39 +0200
parents fbeed0ded014
children 9eba1e2d821d
comparison
equal deleted inserted replaced
3387:5ffad8bde8ad 3468:f37e7e8907cb
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 <dc:comment>
12 Base-data macros (mostly data imported from wst-files)
13 </dc:comment>
14 <dc:macro name="basedata_0">
15 <dc:comment comment=" BASEDATA ---------------------------"/>
16 <basedata>
17 <dc:context>
18 <dc:statement>
19 SELECT id AS prot_id,
20 description AS prot_description
21 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
22 </dc:statement>
23 <dc:elements>
24 <basedata>
25 <dc:attribute name="name" value="${prot_description}"/>
26 <dc:context>
27 <dc:statement>
28 SELECT id AS prot_column_id,
29 name AS prot_column_name,
30 position AS prot_rel_pos
31 FROM wst_columns WHERE wst_id = ${prot_id}
32 ORDER by position
33 </dc:statement>
34 <dc:elements>
35 <column>
36 <dc:attribute name="name" value="${prot_column_name}"/>
37 <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/>
38 <dc:attribute name="factory" value="staticwkms"/>
39 </column>
40 </dc:elements>
41 </dc:context>
42 </basedata>
43 </dc:elements>
44 </dc:context>
45 </basedata>
46 </dc:macro>
47 <dc:macro name="basedata_0_wq">
48 <dc:comment comment=" BASEDATA ---------------------------"/>
49 <basedata>
50 <dc:context>
51 <dc:statement>
52 SELECT id AS prot_id,
53 description AS prot_description
54 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
55 </dc:statement>
56 <dc:elements>
57 <basedata>
58 <dc:attribute name="name" value="${prot_description}"/>
59 <dc:context>
60 <dc:statement>
61 SELECT id AS prot_column_id,
62 name AS prot_column_name,
63 position AS prot_rel_pos
64 FROM wst_columns WHERE wst_id = ${prot_id}
65 ORDER by position
66 </dc:statement>
67 <dc:elements>
68 <column>
69 <dc:attribute name="name" value="${prot_column_name}"/>
70 <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/>
71 <dc:attribute name="factory" value="wqinterpol"/>
72 </column>
73 </dc:elements>
74 </dc:context>
75 </basedata>
76 </dc:elements>
77 </dc:context>
78 </basedata>
79 </dc:macro>
80
81 <dc:macro name="basedata_1_additionals">
82 <dc:comment comment=".ZUS -------------------------------"/>
83 <additionals>
84 <dc:context>
85 <dc:statement>
86 SELECT id AS prot_id,
87 description AS prot_description
88 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
89 </dc:statement>
90 <dc:elements>
91 <additional>
92 <dc:attribute name="name" value="${prot_description}"/>
93 <dc:context>
94 <dc:statement>
95 SELECT id AS prot_column_id,
96 name AS prot_column_name,
97 position AS prot_rel_pos
98 FROM wst_columns WHERE wst_id = ${prot_id}
99 ORDER by position
100 </dc:statement>
101 <dc:elements>
102 <column>
103 <dc:attribute name="name" value="${prot_column_name}"/>
104 <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
105 <dc:attribute name="factory" value="staticwkms"/>
106 </column>
107 </dc:elements>
108 </dc:context>
109 </additional>
110 </dc:elements>
111 </dc:context>
112 </additionals>
113 </dc:macro>
114
115 <dc:macro name="basedata_1_additionals-relative_point">
116 <dc:comment comment=".ZUS -------------------------------"/>
117 <additionals>
118 <dc:context>
119 <dc:statement>
120 SELECT id AS prot_id,
121 description AS prot_description
122 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
123 </dc:statement>
124 <dc:elements>
125 <relativepoint>
126 <dc:attribute name="name" value="${prot_description}"/>
127 <dc:context>
128 <dc:statement>
129 SELECT id AS prot_column_id,
130 name AS prot_column_name,
131 position AS prot_rel_pos
132 FROM wst_columns WHERE wst_id = ${prot_id}
133 ORDER by position
134 </dc:statement>
135 <dc:elements>
136 <column>
137 <dc:attribute name="name" value="${prot_column_name}"/>
138 <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
139 <dc:attribute name="factory" value="staticwkms"/>
140 </column>
141 </dc:elements>
142 </dc:context>
143 </relativepoint>
144 </dc:elements>
145 </dc:context>
146 </additionals>
147 </dc:macro>
148
149 <dc:macro name="basedata_2_fixations_wst">
150 <fixations>
151 <dc:context>
152 <dc:statement>
153 SELECT id AS prot_id,
154 description AS prot_description
155 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
156 </dc:statement>
157 <dc:elements>
158 <fixation>
159 <dc:attribute name="name" value="${prot_description}"/>
160 <!--dc:attribute name="ids" value="fixations-wstv-A-${prot_id}"/-->
161 <dc:context>
162 <dc:statement>
163 SELECT id AS prot_column_id,
164 name AS prot_column_name,
165 position AS prot_rel_pos
166 FROM wst_columns WHERE wst_id = ${prot_id}
167 ORDER by position
168 </dc:statement>
169 <dc:elements>
170 <column>
171 <dc:attribute name="name" value="${prot_column_name}"/>
172 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
173 <dc:attribute name="factory" value="wqinterpol"/>
174 </column>
175 </dc:elements>
176 </dc:context>
177 </fixation>
178 </dc:elements>
179 </dc:context>
180 </fixations>
181 </dc:macro>
182
183 <dc:macro name="basedata_2_fixations_wqkms">
184 <fixations>
185 <dc:context>
186 <dc:statement>
187 SELECT id AS prot_id,
188 description AS prot_description
189 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
190 </dc:statement>
191 <dc:elements>
192 <fixation>
193 <dc:attribute name="name" value="${prot_description}"/>
194 <dc:context>
195 <dc:statement>
196 SELECT id AS prot_column_id,
197 name AS prot_column_name,
198 position AS prot_rel_pos
199 FROM wst_columns WHERE wst_id = ${prot_id}
200 ORDER by position
201 </dc:statement>
202 <dc:elements>
203 <column>
204 <dc:attribute name="name" value="${prot_column_name}"/>
205 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
206 <dc:attribute name="factory" value="wqinterpol"/>
207 </column>
208 </dc:elements>
209 </dc:context>
210 </fixation>
211 </dc:elements>
212 </dc:context>
213 </fixations>
214 </dc:macro>
215
216 <dc:macro name="basedata_2_fixations">
217 <fixations>
218 <dc:context>
219 <dc:statement>
220 SELECT id AS prot_id,
221 description AS prot_description
222 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
223 </dc:statement>
224 <dc:elements>
225 <fixation>
226 <dc:attribute name="name" value="${prot_description}"/>
227 <dc:context>
228 <dc:statement>
229 SELECT id AS prot_column_id,
230 name AS prot_column_name,
231 position AS prot_rel_pos
232 FROM wst_columns WHERE wst_id = ${prot_id}
233 ORDER by position
234 </dc:statement>
235 <dc:elements>
236 <column>
237 <dc:attribute name="name" value="${prot_column_name}"/>
238 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
239 <dc:attribute name="factory" value="staticwkms"/>
240 </column>
241 </dc:elements>
242 </dc:context>
243 </fixation>
244 </dc:elements>
245 </dc:context>
246 </fixations>
247 </dc:macro>
248
249 <dc:macro name="basedata_2_fixations_relative_point">
250 <fixations>
251 <dc:context>
252 <dc:statement>
253 SELECT id AS prot_id,
254 description AS prot_description
255 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
256 </dc:statement>
257 <dc:elements>
258 <relativepoint>
259 <dc:attribute name="name" value="${prot_description}"/>
260 <dc:context>
261 <dc:statement>
262 SELECT id AS prot_column_id,
263 name AS prot_column_name,
264 position AS prot_rel_pos
265 FROM wst_columns WHERE wst_id = ${prot_id}
266 ORDER by position
267 </dc:statement>
268 <dc:elements>
269 <column>
270 <dc:attribute name="name" value="${prot_column_name}"/>
271 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
272 <dc:attribute name="factory" value="staticwkms"/>
273 </column>
274 </dc:elements>
275 </dc:context>
276 </relativepoint>
277 </dc:elements>
278 </dc:context>
279 </fixations>
280 </dc:macro>
281
282 <dc:macro name="basedata_3_officials">
283 <dc:comment comment=".wst -------------------------------"/>
284 <officiallines>
285 <dc:context>
286 <dc:statement>
287 SELECT id AS prot_id,
288 description AS prot_description
289 FROM wsts WHERE kind = 3 AND river_id = ${river_id}
290 </dc:statement>
291 <dc:elements>
292 <official>
293 <dc:attribute name="name" value="${prot_description}"/>
294 <dc:context>
295 <dc:statement>
296 SELECT id AS prot_column_id,
297 name AS prot_column_name,
298 position AS prot_rel_pos
299 FROM wst_columns WHERE wst_id = ${prot_id}
300 ORDER by position
301 </dc:statement>
302 <dc:elements>
303 <column>
304 <dc:attribute name="name" value="${prot_column_name}"/>
305 <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
306 <dc:attribute name="factory" value="staticwkms"/>
307 </column>
308 </dc:elements>
309 </dc:context>
310 </official>
311 </dc:elements>
312 </dc:context>
313 </officiallines>
314 </dc:macro>
315
316 <dc:macro name="basedata_4_heightmarks-points-relative_points">
317 <heightmarks>
318 <dc:context>
319 <dc:statement>
320 SELECT id AS prot_id,
321 description AS prot_description
322 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
323 </dc:statement>
324 <dc:elements>
325 <relativepoint>
326 <dc:attribute name="name" value="${prot_description}"/>
327 <dc:context>
328 <dc:statement>
329 SELECT id AS prot_column_id,
330 name AS prot_column_name,
331 position AS prot_rel_pos
332 FROM wst_columns WHERE wst_id = ${prot_id}
333 ORDER by position
334 </dc:statement>
335 <dc:elements>
336 <column>
337 <dc:attribute name="name" value="${prot_column_name}"/>
338 <dc:attribute name="ids" value="heightmarks_points-wstv-${prot_rel_pos}-${prot_id}"/>
339 <dc:attribute name="factory" value="staticwkms"/>
340 </column>
341 </dc:elements>
342 </dc:context>
343 </relativepoint>
344 </dc:elements>
345 </dc:context>
346 </heightmarks>
347 </dc:macro>
348
349 <dc:macro name="basedata_4_heightmarks-points">
350 <heightmarks>
351 <dc:context>
352 <dc:statement>
353 SELECT id AS prot_id,
354 description AS prot_description
355 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
356 </dc:statement>
357 <dc:elements>
358 <heightmark>
359 <dc:attribute name="name" value="${prot_description}"/>
360 <dc:context>
361 <dc:statement>
362 SELECT id AS prot_column_id,
363 name AS prot_column_name,
364 position AS prot_rel_pos
365 FROM wst_columns WHERE wst_id = ${prot_id}
366 ORDER by position
367 </dc:statement>
368 <dc:elements>
369 <column>
370 <dc:attribute name="name" value="${prot_column_name}"/>
371 <dc:attribute name="ids" value="heightmarks_points-wstv-${prot_rel_pos}-${prot_id}"/>
372 <dc:attribute name="factory" value="staticwkms"/>
373 </column>
374 </dc:elements>
375 </dc:context>
376 </heightmark>
377 </dc:elements>
378 </dc:context>
379 </heightmarks>
380 </dc:macro>
381
382 <dc:macro name="basedata_4_heightmarks-wq">
383 <heightmarks>
384 <dc:context>
385 <dc:statement>
386 SELECT id AS prot_id,
387 description AS prot_description
388 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
389 </dc:statement>
390 <dc:elements>
391 <heightmark>
392 <dc:attribute name="name" value="${prot_description}"/>
393 <dc:context>
394 <dc:statement>
395 SELECT id AS prot_column_id,
396 name AS prot_column_name,
397 position AS prot_rel_pos
398 FROM wst_columns WHERE wst_id = ${prot_id}
399 ORDER by position
400 </dc:statement>
401 <dc:elements>
402 <column>
403 <dc:attribute name="name" value="${prot_column_name}"/>
404 <dc:attribute name="ids" value="heightmarks_annotations-wstv-${prot_rel_pos}-${prot_id}"/>
405 <dc:attribute name="factory" value="wqinterpol"/>
406 </column>
407 </dc:elements>
408 </dc:context>
409 </heightmark>
410 </dc:elements>
411 </dc:context>
412 </heightmarks>
413 </dc:macro>
414
415 <dc:macro name="basedata_5_flood-protections_relative_points">
416 <flood_protections>
417 <dc:attribute name="id" value="flood-protections-${river_id}"/>
418 <dc:context>
419 <dc:statement>
420 SELECT id AS prot_id,
421 description AS prot_description
422 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
423 </dc:statement>
424 <dc:elements>
425 <relativepoint>
426 <dc:attribute name="name" value="${prot_description}"/>
427 <dc:attribute name="db-id" value="${prot_id}"/>
428 <dc:attribute name="factory" value="staticwkms"/>
429 <columns>
430 <dc:context>
431 <dc:statement>
432 SELECT id AS prot_column_id,
433 name AS prot_column_name,
434 position AS prot_rel_pos
435 FROM wst_columns WHERE wst_id = ${prot_id}
436 ORDER by position
437 </dc:statement>
438 <dc:elements>
439 <column>
440 <dc:attribute name="name" value="${prot_column_name}"/>
441 <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/>
442 <dc:attribute name="factory" value="staticwkms"/>
443 </column>
444 </dc:elements>
445 </dc:context>
446 </columns>
447 </relativepoint>
448 </dc:elements>
449 </dc:context>
450 </flood_protections>
451 </dc:macro>
452
453 <dc:macro name="basedata_5_flood-protections">
454 <flood_protections>
455 <dc:attribute name="id" value="flood-protections-${river_id}"/>
456 <dc:context>
457 <dc:statement>
458 SELECT id AS prot_id,
459 description AS prot_description
460 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
461 </dc:statement>
462 <dc:elements>
463 <flood_protection>
464 <dc:attribute name="name" value="${prot_description}"/>
465 <dc:attribute name="db-id" value="${prot_id}"/>
466 <dc:attribute name="factory" value="staticwkms"/>
467 <columns>
468 <dc:context>
469 <dc:statement>
470 SELECT id AS prot_column_id,
471 name AS prot_column_name,
472 position AS prot_rel_pos
473 FROM wst_columns WHERE wst_id = ${prot_id}
474 ORDER by position
475 </dc:statement>
476 <dc:elements>
477 <column>
478 <dc:attribute name="name" value="${prot_column_name}"/>
479 <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/>
480 <dc:attribute name="factory" value="staticwkms"/>
481 </column>
482 </dc:elements>
483 </dc:context>
484 </columns>
485 </flood_protection>
486 </dc:elements>
487 </dc:context>
488 </flood_protections>
489 </dc:macro>
490
491 <dc:macro name="mainvalues">
492 <mainvalue>
493 <dc:attribute name="factory" value="mainvalue"/>
494 <dc:attribute name="ids" value="${river_id}"/>
495 </mainvalue>
496 </dc:macro>
497
498 <dc:macro name="annotations">
499 <annotation>
500 <dc:attribute name="factory" value="annotations"/>
501 <dc:attribute name="ids" value="${river_id}"/>
502 </annotation>
503 </dc:macro>
504
505 <dc:macro name="cross_sections">
506 <cross_sections>
507 <dc:attribute name="id" value="flood-protections-${river_id}"/>
508 <dc:context>
509 <dc:statement>
510 SELECT id AS prot_id,
511 description AS prot_description
512 FROM cross_sections WHERE river_id = ${river_id}
513 </dc:statement>
514 <dc:elements>
515 <cross_section>
516 <dc:attribute name="name" value="${prot_description}"/>
517 <dc:attribute name="ids" value="${prot_id}"/>
518 <dc:attribute name="factory" value="crosssections"/>
519 </cross_section>
520 </dc:elements>
521 </dc:context>
522 </cross_sections>
523 </dc:macro>
524
525 <dc:macro name="hyks">
526 <hyks>
527 <dc:attribute name="id" value="hyk-${river_id}"/>
528 <dc:context>
529 <dc:statement>
530 SELECT id AS hyk_id,
531 description AS hyk_description
532 FROM hyks WHERE river_id = ${river_id}
533 </dc:statement>
534 <dc:elements>
535 <hyk>
536 <dc:attribute name="name" value="${hyk_description}"/>
537 <dc:attribute name="ids" value="${hyk_id}"/>
538 <dc:attribute name="factory" value="hyk"/>
539 </hyk>
540 </dc:elements>
541 </dc:context>
542 </hyks>
543 </dc:macro>
544
545 <dc:comment>
546
547 + River-Node
548
549 </dc:comment>
550
551 <river>
552 <dc:attribute name="name" value="${river_name}"/>
553
554 <dc:choose>
555 <dc:when test="dc:contains($parameters, 'recommended')">
556 <dc:comment>
557 Recommendations (client shall load immediately).
558 </dc:comment>
559 <dc:if test="dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))">
560 <dc:call-macro name="annotations"/>
561 </dc:if>
562 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
563 <dc:call-macro name="cross_sections"/>
564 <dc:call-macro name="hyks"/>
565 </dc:if>
566 <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
567 <dc:call-macro name="annotations"/>
568 <dc:call-macro name="mainvalues"/>
569 </dc:if>
570 </dc:when>
571 <dc:otherwise>
572 <dc:comment>
573 Non - Recommendations.
574 </dc:comment>
575 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
576 <dc:call-macro name="basedata_0"/>
577 <dc:call-macro name="basedata_1_additionals"/>
578 <dc:call-macro name="basedata_2_fixations"/>
579 <dc:call-macro name="basedata_4_heightmarks-points"/>
580 <dc:call-macro name="cross_sections"/>
581 <dc:call-macro name="hyks"/>
582 </dc:if>
583 <dc:if test="dc:contains($artifact-outs, 'discharge_longitudinal_section')">
584 <dc:call-macro name="basedata_0"/>
585 <dc:call-macro name="basedata_1_additionals"/>
586 <dc:call-macro name="basedata_2_fixations"/>
587 <dc:call-macro name="basedata_3_officials"/>
588 <dc:call-macro name="basedata_4_heightmarks-points"/>
589 <dc:call-macro name="basedata_5_flood-protections"/>
590 </dc:if>
591 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
592 <dc:call-macro name="basedata_0_wq"/>
593 <dc:call-macro name="basedata_4_heightmarks-wq"/>
594 </dc:if>
595 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences'))">
596 <dc:call-macro name="basedata_0"/>
597 <dc:call-macro name="basedata_1_additionals"/>
598 <dc:comment comment=" FIXATIONS ---------------------------"/>
599 <dc:call-macro name="basedata_2_fixations"/>
600 <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
601 <dc:call-macro name="basedata_4_heightmarks-points"/>
602 <dc:comment comment=" AMTL LINIEN ---------------------------"/>
603 <dc:call-macro name="basedata_3_officials"/>
604 <dc:call-macro name="annotations"/>
605 </dc:if>
606 <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
607 <dc:call-macro name="annotations"/>
608 <!--dc:call-macro name="basedata_0"/-->
609 <dc:call-macro name="basedata_1_additionals-relative_point"/>
610 <dc:comment comment=" FIXATIONS ---------------------------"/>
611 <dc:call-macro name="basedata_2_fixations_relative_point"/>
612 <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
613 <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
614 <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
615 </dc:if>
616 <dc:comment comment="--- non-recommendations---"/>
617 </dc:otherwise>
618 </dc:choose>
619
620
621 <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
622
623 <!-- base data -->
624 <dc:call-macro name="basedata_0"/>
625
626 <!-- extra-longitudinal-sections -->
627 <dc:call-macro name="basedata_1_additionals"/>
628
629 <!-- fixations -->
630 <dc:call-macro name="basedata_2_fixations"/>
631
632 <!-- flood water marks-->
633 <dc:call-macro name="basedata_4_heightmarks-points"/>
634
635 <!-- flood protection -->
636 <dc:call-macro name="basedata_5_flood-protections"/>
637
638 </dc:if>
639 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and (dc:contains($parameters, 'recommended'))">
640 <!--dc:call-macro name="basedata_2_fixations_wst"/-->
641 </dc:if>
642
643 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and not (dc:contains($parameters, 'recommended'))">
644 <discharge_table_nn>
645 <discharge_table_gauge>
646 <dc:context>
647 <dc:statement>
648 SELECT id AS gauge_id,
649 name AS gauge_name
650 FROM gauges WHERE river_id = ${river_id}
651 </dc:statement>
652 <dc:elements>
653 <gauge>
654 <dc:attribute name="name" value="${gauge_name}"/>
655 <dc:attribute name="db-id" value="${gauge_id}"/>
656 <dc:attribute name="factory" value="gaugedischarge"/>
657 <dc:attribute name="from" value="${g_start}"/>
658 <dc:attribute name="to" value="${g_stop}"/>
659 <dc:attribute name="ids" value="${gauge_name}"/>
660 </gauge>
661 <!--
662 <gauge>
663 <dc:attribute name="name" value="${gauge_name}"/>
664 <dc:attribute name="db-id" value="${gauge_id}"/>
665 <dc:context>
666 <dc:statement>
667 SELECT description AS gauge_desc,
668 d.id AS discharge_id,
669 ti.start_time AS g_start,
670 ti.stop_time AS g_stop
671 FROM discharge_tables d JOIN time_intervals ti
672 ON d.time_interval_id = ti.id
673 WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
674 </dc:statement>
675 <dc:elements>
676 <historical>
677 <dc:attribute name="name" value="${gauge_desc}"/>
678 <dc:attribute name="factory" value="gaugedischarge"/>
679 <dc:attribute name="from" value="${g_start}"/>
680 <dc:attribute name="to" value="${g_stop}"/>
681 <dc:attribute name="ids" value="${discharge_id}-${g_start}-${g_stop}"/>
682 </historical>
683 </dc:elements>
684 </dc:context>
685 </gauge>
686 -->
687 </dc:elements>
688 </dc:context>
689 </discharge_table_gauge>
690
691 </discharge_table_nn>
692
693 <dc:call-macro name="basedata_2_fixations_wst"/>
694
695 <dc:call-macro name="basedata_5_flood-protections"/>
696
697 <!-- former waterlevels -->
698 <dc:call-macro name="basedata_0"/>
699
700 <dc:call-macro name="basedata_1_additionals"/>
701
702 <!-- former flood-water-marks -->
703 <dc:call-macro name="basedata_4_heightmarks-points"/>
704 </dc:if>
705 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')"><!-- or (dc:contains($artifact-outs, 'discharge_curve'))"-->
706 <!-- && parameter contains recommended/ation -->
707 <computed_discharge_curve>
708 <dc:call-macro name="mainvalues"/>
709 </computed_discharge_curve>
710 <dc:call-macro name="basedata_2_fixations_wst"/>
711 </dc:if>
712
713 <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
714 <dc:choose>
715 <dc:when test="dc:contains($parameters, 'recommended')">
716 <dc:call-macro name="mainvalues"/>
717 </dc:when>
718 <dc:otherwise>
719 <dc:call-macro name="mainvalues"/>
720 <dc:call-macro name="basedata_2_fixations_relative_point"/>
721 <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
722 <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
723 </dc:otherwise>
724 </dc:choose>
725 </dc:if>
726
727 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
728 <longitudinal_section>
729 <dc:call-macro name="annotations"/>
730 </longitudinal_section>
731 </dc:if>
732 <dc:if test="dc:contains($artifact-outs, 'map')">
733 <map>
734 <dc:choose>
735 <dc:when test="dc:contains($parameters, 'recommended')">
736 </dc:when>
737 <dc:otherwise>
738 <dc:call-macro name="flood-map-complete"/>
739 </dc:otherwise>
740 </dc:choose>
741 </map>
742 </dc:if>
743 <dc:if test="dc:contains($artifact-outs, 'floodmap')">
744 <floodmap>
745 <dc:choose>
746 <dc:when test="dc:contains($parameters, 'recommended')">
747 <dc:call-macro name="flood-map-recommended"/>
748 </dc:when>
749 <dc:when test="dc:contains($parameters, 'dem')">
750 <dc:call-macro name="flood-map-dem"/>
751 </dc:when>
752 <dc:otherwise>
753 <dc:call-macro name="flood-map-complete"/>
754 </dc:otherwise>
755 </dc:choose>
756 </floodmap>
757 <dc:macro name="flood-map-recommended">
758 <dc:comment>
759 FIXME: Following two macros look identical to me.
760 </dc:comment>
761 <kilometrage>
762 <riveraxis>
763 <dc:attribute name="factory" value="riveraxis"/>
764 <dc:attribute name="ids" value="${river_id}"/>
765 </riveraxis>
766 </kilometrage>
767 <rastermap>
768 <background>
769 <dc:attribute name="factory" value="wmsbackground"/>
770 <dc:attribute name="ids" value="${river_id}"/>
771 </background>
772 </rastermap>
773 </dc:macro>
774 <dc:macro name="flood-map-dem">
775 <dems>
776 <dc:context>
777 <dc:statement>
778 SELECT id AS dem_id,
779 lower AS dem_lower,
780 upper AS dem_upper
781 FROM dem WHERE river_id = ${river_id}
782 </dc:statement>
783 <dc:elements>
784 <dem>
785 <dc:attribute name="factory" value="demfactory"/>
786 <dc:attribute name="ids" value="${dem_id}"/>
787 <dc:attribute name="description" value="${dem_lower}-${dem_upper}"/>
788 </dem>
789 </dc:elements>
790 </dc:context>
791 </dems>
792 </dc:macro>
793 <dc:macro name="flood-map-km">
794 <dc:context>
795 <dc:statement>
796 SELECT count(*) as km_exists
797 FROM river_axes_km WHERE river_id = ${river_id}
798 </dc:statement>
799 <dc:elements>
800 <dc:if test="$km_exists>0">
801 <km>
802 <dc:attribute name="factory" value="wmskmfactory"/>
803 <dc:attribute name="ids" value="${river_id}"/>
804 </km>
805 </dc:if>
806 </dc:elements>
807 </dc:context>
808 </dc:macro>
809 <dc:macro name="flood-map-qps">
810 <dc:context>
811 <dc:statement>
812 SELECT count(*) as km_exists
813 FROM cross_section_tracks WHERE river_id = ${river_id}
814 </dc:statement>
815 <dc:elements>
816 <dc:if test="$km_exists>0">
817 <qps>
818 <dc:attribute name="factory" value="wmsqpsfactory"/>
819 <dc:attribute name="ids" value="${river_id}"/>
820 </qps>
821 </dc:if>
822 </dc:elements>
823 </dc:context>
824 </dc:macro>
825 <dc:macro name="flood-map-hws">
826 <dc:context>
827 <dc:statement>
828 SELECT count(*) as km_exists, name as name
829 FROM hws WHERE river_id = ${river_id} GROUP BY name
830 </dc:statement>
831 <dc:elements>
832 <dc:if test="$km_exists>0">
833 <hws>
834 <dc:attribute name="factory" value="wmshwsfactory"/>
835 <dc:attribute name="ids" value="${river_id};${name}"/>
836 <dc:attribute name="name" value="${name}"/>
837 </hws>
838 </dc:if>
839 </dc:elements>
840 </dc:context>
841 </dc:macro>
842 <dc:macro name="flood-map-hydr-boundaries">
843 <hydr_boundaries_lines>
844 <dc:call-macro name="flood-map-hydr-boundaries-lines"/>
845 </hydr_boundaries_lines>
846 <hydr_boundaries_polygons>
847 <dc:call-macro name="flood-map-hydr-boundaries-poly"/>
848 </hydr_boundaries_polygons>
849 </dc:macro>
850 <dc:macro name="flood-map-hydr-boundaries-lines">
851 <bfg>
852 <dc:context>
853 <dc:statement>
854 SELECT count(*) as km_exists, name as name
855 FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 1 GROUP BY name
856 </dc:statement>
857 <dc:elements>
858 <dc:if test="$km_exists>0">
859 <hydrboundary>
860 <dc:attribute name="factory" value="wmshydrboundariesfactory"/>
861 <dc:attribute name="ids" value="${river_id};${name}"/>
862 <dc:attribute name="name" value="${name}"/>
863 </hydrboundary>
864 </dc:if>
865 </dc:elements>
866 </dc:context>
867 </bfg>
868 <land>
869 <dc:context>
870 <dc:statement>
871 SELECT count(*) as km_exists, name as name
872 FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 2 GROUP BY name
873 </dc:statement>
874 <dc:elements>
875 <dc:if test="$km_exists>0">
876 <hydrboundary>
877 <dc:attribute name="factory" value="wmshydrboundariesfactory"/>
878 <dc:attribute name="ids" value="${river_id};${name}"/>
879 <dc:attribute name="name" value="${name}"/>
880 </hydrboundary>
881 </dc:if>
882 </dc:elements>
883 </dc:context>
884 </land>
885 </dc:macro>
886 <dc:macro name="flood-map-hydr-boundaries-poly">
887 <bfg>
888 <dc:context>
889 <dc:statement>
890 SELECT count(*) as km_exists, name as name
891 FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 1 GROUP BY name
892 </dc:statement>
893 <dc:elements>
894 <dc:if test="$km_exists>0">
895 <hws>
896 <dc:attribute name="factory" value="wmshydrboundariespolyfactory"/>
897 <dc:attribute name="ids" value="${river_id};${name}"/>
898 <dc:attribute name="name" value="${name}"/>
899 </hws>
900 </dc:if>
901 </dc:elements>
902 </dc:context>
903 </bfg>
904 <land>
905 <dc:context>
906 <dc:statement>
907 SELECT count(*) as km_exists, name as name
908 FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 2 GROUP BY name
909 </dc:statement>
910 <dc:elements>
911 <dc:if test="$km_exists>0">
912 <hws>
913 <dc:attribute name="factory" value="wmshydrboundariespolyfactory"/>
914 <dc:attribute name="ids" value="${river_id};${name}"/>
915 <dc:attribute name="name" value="${name}"/>
916 </hws>
917 </dc:if>
918 </dc:elements>
919 </dc:context>
920 </land>
921 </dc:macro>
922 <dc:macro name="flood-map-catchments">
923 <dc:context>
924 <dc:statement>
925 SELECT count(*) as km_exists, name as name
926 FROM catchment WHERE river_id = ${river_id} GROUP BY name
927 </dc:statement>
928 <dc:elements>
929 <dc:if test="$km_exists>0">
930 <catchment>
931 <dc:attribute name="factory" value="wmscatchmentfactory"/>
932 <dc:attribute name="ids" value="${river_id};${name}"/>
933 <dc:attribute name="name" value="${name}"/>
934 </catchment>
935 </dc:if>
936 </dc:elements>
937 </dc:context>
938 </dc:macro>
939 <dc:macro name="flood-map-floodplain">
940 <dc:context>
941 <dc:statement>
942 SELECT count(*) as km_exists
943 FROM floodplain WHERE river_id = ${river_id}
944 </dc:statement>
945 <dc:elements>
946 <dc:if test="$km_exists>0">
947 <floodplain>
948 <dc:attribute name="factory" value="wmsfloodplainfactory"/>
949 <dc:attribute name="ids" value="${river_id}"/>
950 </floodplain>
951 </dc:if>
952 </dc:elements>
953 </dc:context>
954 </dc:macro>
955 <dc:macro name="flood-map-lines">
956 <dc:context>
957 <dc:statement>
958 SELECT count(*) as km_exists, name as name
959 FROM lines WHERE river_id = ${river_id} GROUP BY name
960 </dc:statement>
961 <dc:elements>
962 <dc:if test="$km_exists>0">
963 <line>
964 <dc:attribute name="factory" value="wmslinefactory"/>
965 <dc:attribute name="ids" value="${river_id};${name}"/>
966 <dc:attribute name="name" value="${name}"/>
967 </line>
968 </dc:if>
969 </dc:elements>
970 </dc:context>
971 </dc:macro>
972 <dc:macro name="flood-map-buildings">
973 <dc:context>
974 <dc:statement>
975 SELECT count(*) as km_exists, name as name
976 FROM buildings WHERE river_id = ${river_id} GROUP BY name
977 </dc:statement>
978 <dc:elements>
979 <dc:if test="$km_exists>0">
980 <building>
981 <dc:attribute name="factory" value="wmsbuildingsfactory"/>
982 <dc:attribute name="ids" value="${river_id};${name}"/>
983 <dc:attribute name="name" value="${name}"/>
984 </building>
985 </dc:if>
986 </dc:elements>
987 </dc:context>
988 </dc:macro>
989 <dc:macro name="flood-map-fixpoints">
990 <dc:context>
991 <dc:statement>
992 SELECT count(*) as km_exists, name as name
993 FROM fixpoints WHERE river_id = ${river_id} GROUP BY name
994 </dc:statement>
995 <dc:elements>
996 <dc:if test="$km_exists>0">
997 <fixpoint>
998 <dc:attribute name="factory" value="wmsfixpointsfactory"/>
999 <dc:attribute name="ids" value="${river_id};${name}"/>
1000 <dc:attribute name="name" value="${name}"/>
1001 </fixpoint>
1002 </dc:if>
1003 </dc:elements>
1004 </dc:context>
1005 </dc:macro>
1006 <dc:macro name="flood-map-gaugelocations">
1007 <dc:context>
1008 <dc:statement>
1009 SELECT count(*) as km_exists, name as name
1010 FROM gauge_location WHERE river_id = ${river_id} GROUP BY name
1011 </dc:statement>
1012 <dc:elements>
1013 <dc:if test="$km_exists>0">
1014 <gaugelocation>
1015 <dc:attribute name="factory" value="wmsgaugelocationfactory"/>
1016 <dc:attribute name="ids" value="${river_id};${name}"/>
1017 <dc:attribute name="name" value="${name}"/>
1018 </gaugelocation>
1019 </dc:if>
1020 </dc:elements>
1021 </dc:context>
1022 </dc:macro>
1023 <dc:macro name="flood-map-uesk">
1024 <uesk>
1025 <calculations>
1026 <current>
1027 <bfg>
1028 <dc:context>
1029 <dc:statement>
1030 SELECT count(*) as uesg_exist, name as name
1031 FROM floodmaps
1032 WHERE river_id = ${river_id} AND kind = 111
1033 GROUP BY name, kind
1034 </dc:statement>
1035 <dc:elements>
1036 <dc:if test="$uesg_exist>0">
1037 <floodmaps>
1038 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
1039 <dc:attribute name="ids" value="${river_id};${name}"/>
1040 <dc:attribute name="name" value="${name}"/>
1041 </floodmaps>
1042 </dc:if>
1043 </dc:elements>
1044 </dc:context>
1045 </bfg>
1046 <land>
1047 <dc:context>
1048 <dc:statement>
1049 SELECT count(*) as uesg_exist, name as name
1050 FROM floodmaps
1051 WHERE river_id = ${river_id} AND kind = 112
1052 GROUP BY name, kind
1053 </dc:statement>
1054 <dc:elements>
1055 <dc:if test="$uesg_exist>0">
1056 <floodmaps>
1057 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
1058 <dc:attribute name="ids" value="${river_id};${name}"/>
1059 <dc:attribute name="name" value="${name}"/>
1060 </floodmaps>
1061 </dc:if>
1062 </dc:elements>
1063 </dc:context>
1064 </land>
1065 </current>
1066 <potentiel>
1067 <bfg>
1068 <dc:context>
1069 <dc:statement>
1070 SELECT count(*) as uesg_exist, name as name
1071 FROM floodmaps
1072 WHERE river_id = ${river_id} AND kind = 121
1073 GROUP BY name, kind
1074 </dc:statement>
1075 <dc:elements>
1076 <dc:if test="$uesg_exist>0">
1077 <floodmaps>
1078 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
1079 <dc:attribute name="ids" value="${river_id};${name}"/>
1080 <dc:attribute name="name" value="${name}"/>
1081 </floodmaps>
1082 </dc:if>
1083 </dc:elements>
1084 </dc:context>
1085 </bfg>
1086 <land>
1087 <dc:context>
1088 <dc:statement>
1089 SELECT count(*) as uesg_exist, name as name
1090 FROM floodmaps
1091 WHERE river_id = ${river_id} AND kind = 122
1092 GROUP BY name, kind
1093 </dc:statement>
1094 <dc:elements>
1095 <dc:if test="$uesg_exist>0">
1096 <floodmaps>
1097 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
1098 <dc:attribute name="ids" value="${river_id};${name}"/>
1099 <dc:attribute name="name" value="${name}"/>
1100 </floodmaps>
1101 </dc:if>
1102 </dc:elements>
1103 </dc:context>
1104 </land>
1105 </potentiel>
1106 </calculations>
1107 </uesk>
1108 </dc:macro>
1109 <dc:macro name="flood-map-complete">
1110 <buildings>
1111 <dc:call-macro name="flood-map-buildings"/>
1112 </buildings>
1113 <catchments>
1114 <dc:call-macro name="flood-map-catchments"/>
1115 </catchments>
1116 <fixpoints>
1117 <dc:call-macro name="flood-map-fixpoints"/>
1118 </fixpoints>
1119 <hws>
1120 <dc:call-macro name="flood-map-hws"/>
1121 </hws>
1122 <hydrboundaries>
1123 <dc:call-macro name="flood-map-hydr-boundaries"/>
1124 <dc:call-macro name="flood-map-floodplain"/>
1125 </hydrboundaries>
1126 <kilometrage>
1127 <riveraxis>
1128 <dc:attribute name="factory" value="riveraxis"/>
1129 <dc:attribute name="ids" value="${river_id}"/>
1130 </riveraxis>
1131 <dc:call-macro name="flood-map-km"/>
1132 <dc:call-macro name="flood-map-qps"/>
1133 </kilometrage>
1134 <lines>
1135 <dc:call-macro name="flood-map-lines"/>
1136 </lines>
1137 <dc:call-macro name="flood-map-uesk"/>
1138 <gaugelocations>
1139 <dc:call-macro name="flood-map-gaugelocations"/>
1140 </gaugelocations>
1141 <rastermap>
1142 <background>
1143 <dc:attribute name="factory" value="wmsbackground"/>
1144 <dc:attribute name="ids" value="${river_id}"/>
1145 </background>
1146 </rastermap>
1147 </dc:macro>
1148 </dc:if>
1149 </river>
1150 </dc:elements>
1151 </dc:context>
1152 </dc:macro>
1153
1154 <dc:choose>
1155 <dc:comment>
1156 User specific part
1157 ------------------
1158 </dc:comment>
1159 <dc:when test="dc:contains($parameters, 'user-id')">
1160
1161
1162 <old_calculations>
1163 <dc:context connection="user">
1164 <dc:comment>
1165 Get the user and collection-id.
1166 </dc:comment>
1167 <dc:statement>
1168 SELECT u.id AS user_id, c.id AS collection_id, c.name as collection_name
1169 FROM collections c JOIN users u ON c.user_id = u.id
1170 WHERE u.gid = CAST(${user-id} AS uuid)
1171 ORDER BY c.creation DESC
1172 </dc:statement>
1173
1174 <!-- OFFICIAL LINES -->
1175 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
1176 <dc:comment comment=".wst -------------------------------"/>
1177 <officiallines>
1178 <dc:elements>
1179 <dc:context>
1180 <dc:statement>
1181 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation, ardg.v as gaugy, arv.v as wqsingle
1182 FROM master_artifacts m, artifact_data ardg, artifact_data arv
1183 WHERE m.collection_id = ${collection_id} AND m.gid = CAST(${artifact-id} AS uuid) AND ardg.artifact_id = m.id AND ardg.k = 'ld_gaugename' AND arv.artifact_id = m.id AND arv.k = 'wq_single'
1184 AND EXISTS (
1185 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1186 </dc:statement>
1187 <dc:elements>
1188 <dc:context connection="system">
1189 <dc:statement>
1190 SELECT ol.wst_id AS wstid, ol.wst_column_pos AS wstcolpos, ol.name AS olname, ol.value AS oval
1191 FROM official_q_values ol
1192 WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2)) AND ol.gauge_name = ${gaugy}
1193 </dc:statement>
1194 <dc:elements>
1195 <dc:element name="${olname}">
1196 <dc:attribute name="name" value="${olname}"/>
1197 <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/>
1198 <dc:attribute name="factory" value="staticwkms"/>
1199 </dc:element>
1200 </dc:elements>
1201 </dc:context>
1202 </dc:elements>
1203 </dc:context>
1204 </dc:elements>
1205 </officiallines>
1206 </dc:if>
1207
1208 <dc:comment>
1209 SHOW W-DIFFERENCES
1210 </dc:comment>
1211
1212 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))">
1213 <differences>
1214 <dc:elements>
1215 <dc:context>
1216 <dc:statement>
1217 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1218 FROM master_artifacts m
1219 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1220 AND EXISTS (
1221 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1222 </dc:statement>
1223 <dc:elements>
1224 <dc:context>
1225 <dc:statement>
1226 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
1227 FROM outs as o, facets as f, artifacts as a
1228 WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
1229 </dc:statement>
1230 <dc:elements>
1231 <dc:element name="${facet_name}">
1232 <dc:attribute name="description" value="${facet_description}"/>
1233 <dc:attribute name="factory" value="winfo"/>
1234 <dc:attribute name="artifact-id" value="${aid}"/>
1235 <dc:attribute name="ids" value="${aid}"/>
1236 <dc:attribute name="out" value="w_differences"/>
1237 </dc:element>
1238 </dc:elements>
1239 </dc:context>
1240 </dc:elements>
1241 </dc:context>
1242 </dc:elements>
1243 </differences>
1244 </dc:if>
1245
1246 <dc:comment>
1247 SHOW REFERENCE CURVE
1248 </dc:comment>
1249
1250 <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
1251 <reference_curves>
1252 <dc:elements>
1253 <dc:context>
1254 <dc:statement>
1255 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1256 FROM master_artifacts m
1257 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1258 AND EXISTS (
1259 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1260 </dc:statement>
1261 <dc:elements>
1262 <dc:context>
1263 <dc:statement>
1264 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
1265 FROM outs as o, facets as f, artifacts as a
1266 WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
1267 </dc:statement>
1268 <dc:elements>
1269 <dc:element name="${facet_name}">
1270 <dc:attribute name="description" value="${facet_description}"/>
1271 <dc:attribute name="factory" value="winfo"/>
1272 <dc:attribute name="artifact-id" value="${aid}"/>
1273 <dc:attribute name="ids" value="${aid}"/>
1274 <dc:attribute name="out" value="reference_curve"/>
1275 </dc:element>
1276 </dc:elements>
1277 </dc:context>
1278 </dc:elements>
1279 </dc:context>
1280 </dc:elements>
1281 </reference_curves>
1282 </dc:if>
1283
1284 <dc:comment>
1285 SHOW COMPUTED DISCHARGE CURVES
1286 </dc:comment>
1287
1288 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
1289 <computed_discharge_curves>
1290 <dc:elements>
1291 <dc:context>
1292 <dc:statement>
1293 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1294 FROM master_artifacts m
1295 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1296 AND EXISTS (
1297 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1298 </dc:statement>
1299 <dc:elements>
1300 <dc:context>
1301 <dc:statement>
1302 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
1303 FROM outs as o, facets as f, artifacts as a
1304 WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
1305 </dc:statement>
1306 <dc:elements>
1307 <dc:element name="${facet_name}">
1308 <dc:attribute name="description" value="${facet_description}"/>
1309 <dc:attribute name="factory" value="winfo"/>
1310 <dc:attribute name="artifact-id" value="${aid}"/>
1311 <dc:attribute name="ids" value="${aid}"/>
1312 <dc:attribute name="out" value="computed_discharge_curve"/>
1313 </dc:element>
1314 </dc:elements>
1315 </dc:context>
1316 </dc:elements>
1317 </dc:context>
1318 </dc:elements>
1319 </computed_discharge_curves>
1320 </dc:if>
1321
1322 <dc:comment>
1323 CROSS SECTION
1324 </dc:comment>
1325
1326 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
1327 <waterlevels>
1328 <dc:elements>
1329 <dc:context>
1330 <dc:statement>
1331 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1332 FROM master_artifacts m
1333 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1334 AND EXISTS (
1335 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1336 </dc:statement>
1337 <dc:elements>
1338 <dc:context>
1339 <dc:statement>
1340 SELECT id AS out_id
1341 FROM outs
1342 WHERE artifact_id = ${a_id} AND name = 'cross_section'
1343 </dc:statement>
1344 <dc:elements>
1345 <dc:context>
1346 <dc:statement>
1347 SELECT name AS facet_name, num as facet_num, description AS facet_description
1348 FROM facets
1349 WHERE out_id = ${out_id}
1350 ORDER BY num ASC, name DESC
1351 </dc:statement>
1352 <longitudinal_section_columns>
1353 <dc:attribute name="description" value="${river} ${a_creation}"/>
1354 <dc:elements>
1355 <dc:element name="${facet_name}">
1356 <dc:attribute name="description" value="${facet_description}"/>
1357 <dc:attribute name="ids" value="${facet_num}"/>
1358 <dc:attribute name="factory" value="winfo"/>
1359 <dc:attribute name="artifact-id" value="${a_gid}"/>
1360 <dc:attribute name="out" value="cross_section"/>
1361 </dc:element>
1362 </dc:elements>
1363 </longitudinal_section_columns>
1364 </dc:context>
1365 </dc:elements>
1366 </dc:context>
1367 </dc:elements>
1368 </dc:context>
1369 </dc:elements>
1370 </waterlevels>
1371 </dc:if>
1372
1373
1374 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
1375 <waterlevels>
1376 <dc:elements>
1377 <dc:context>
1378 <dc:statement>
1379 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1380 FROM master_artifacts m
1381 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1382 AND EXISTS (
1383 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1384 </dc:statement>
1385 <dc:elements>
1386 <dc:context>
1387 <dc:statement>
1388 SELECT id AS out_id
1389 FROM outs
1390 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
1391 </dc:statement>
1392 <dc:elements>
1393 <dc:context>
1394 <dc:statement>
1395 SELECT name AS facet_name, num as facet_num, description AS facet_description
1396 FROM facets
1397 WHERE out_id = ${out_id}
1398 ORDER BY num ASC, name DESC
1399 </dc:statement>
1400 <longitudinal_section_columns>
1401 <dc:attribute name="description" value="${river} ${a_creation}"/>
1402 <dc:elements>
1403 <dc:element name="${facet_name}">
1404 <dc:attribute name="description" value="${facet_description}"/>
1405 <dc:attribute name="ids" value="${facet_num}"/>
1406 <dc:attribute name="factory" value="winfo"/>
1407 <dc:attribute name="artifact-id" value="${a_gid}"/>
1408 <dc:attribute name="out" value="longitudinal_section"/>
1409 </dc:element>
1410 </dc:elements>
1411 </longitudinal_section_columns>
1412 </dc:context>
1413 </dc:elements>
1414 </dc:context>
1415 </dc:elements>
1416 </dc:context>
1417 </dc:elements>
1418 </waterlevels>
1419 </dc:if>
1420
1421 <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
1422 <computed_discharge_curves>
1423 <dc:elements>
1424 <dc:context>
1425 <dc:statement>
1426 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1427 FROM master_artifacts m
1428 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1429 AND EXISTS (
1430 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1431 </dc:statement>
1432 <dc:elements>
1433 <dc:context>
1434 <dc:statement>
1435 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
1436 FROM outs as o, facets as f, artifacts as a
1437 WHERE (f.name = 'duration_curve.q' or f.name = 'duration_curve.w') and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
1438 </dc:statement>
1439 <dc:elements>
1440 <dc:element name="${facet_name}">
1441 <dc:attribute name="description" value="${facet_description}"/>
1442 <dc:attribute name="factory" value="winfo"/>
1443 <dc:attribute name="artifact-id" value="${aid}"/>
1444 <dc:attribute name="ids" value="${aid}"/>
1445 <dc:attribute name="out" value="duration_curve"/>
1446 </dc:element>
1447 </dc:elements>
1448 </dc:context>
1449 </dc:elements>
1450 </dc:context>
1451 </dc:elements>
1452 </computed_discharge_curves>
1453 </dc:if>
1454 <dc:comment>
1455 WATERLEVELS - ONLY SHOW Ws
1456 </dc:comment>
1457
1458 <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
1459 <waterlevels>
1460 <dc:elements>
1461 <dc:context>
1462 <dc:statement>
1463 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1464 FROM master_artifacts m
1465 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1466 AND EXISTS (
1467 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1468 </dc:statement>
1469 <dc:elements>
1470
1471 <dc:context>
1472 <dc:statement>
1473 SELECT id AS out_id
1474 FROM outs
1475 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
1476 </dc:statement>
1477 <dc:elements>
1478 <dc:context>
1479 <dc:statement>
1480 SELECT name AS facet_name, num as facet_num, description AS facet_description
1481 FROM facets
1482 WHERE out_id = ${out_id} and name = 'longitudinal_section.w'
1483 ORDER BY num ASC, name DESC
1484 </dc:statement>
1485 <waterlevels>
1486 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
1487 <dc:elements>
1488 <dc:element name="${facet_name}">
1489 <dc:attribute name="description" value="${facet_description}"/>
1490 <dc:attribute name="ids" value="${facet_num}"/>
1491 <dc:attribute name="factory" value="winfo"/>
1492 <dc:attribute name="artifact-id" value="${a_gid}"/>
1493 <dc:attribute name="out" value="longitudinal_section"/>
1494 </dc:element>
1495 </dc:elements>
1496 </waterlevels>
1497 </dc:context>
1498 </dc:elements>
1499 </dc:context>
1500 </dc:elements>
1501 </dc:context>
1502 </dc:elements>
1503 </waterlevels>
1504 </dc:if>
1505
1506 <dc:comment>
1507 SHOW FLOODMAPS
1508 </dc:comment>
1509
1510 <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'map')">
1511 <floodmap>
1512 <dc:elements>
1513 <dc:context>
1514 <dc:statement>
1515 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
1516 FROM master_artifacts m
1517 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1518 AND EXISTS (
1519 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1520 </dc:statement>
1521 <dc:elements>
1522 <dc:context>
1523 <dc:statement>
1524 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
1525 FROM outs as o, facets as f, artifacts as a
1526 WHERE f.name = 'floodmap.wsplgen' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
1527 </dc:statement>
1528 <dc:elements>
1529 <dc:element name="${facet_name}">
1530 <dc:attribute name="description" value="${facet_description}"/>
1531 <dc:attribute name="factory" value="winfo"/>
1532 <dc:attribute name="artifact-id" value="${aid}"/>
1533 <dc:attribute name="ids" value="${aid}"/>
1534 <dc:attribute name="out" value="floodmap"/>
1535 </dc:element>
1536 </dc:elements>
1537 </dc:context>
1538 </dc:elements>
1539 </dc:context>
1540 </dc:elements>
1541 </floodmap>
1542 </dc:if>
1543
1544 </dc:context>
1545 </old_calculations>
1546
1547
1548 <dc:comment>
1549 Include System specific part when 'load-system' is in parameters.
1550 -----------------------------------------------------------------
1551 </dc:comment>
1552 <dc:choose>
1553 <dc:when test="dc:contains($parameters,'load-system')">
1554 <dc:call-macro name="load-system"/>
1555 </dc:when>
1556 </dc:choose>
1557 </dc:when>
1558
1559
1560 <dc:comment>
1561 Include System specific part only if no user ID is given.
1562 ---------------------------------------------------------
1563 </dc:comment>
1564 <dc:otherwise>
1565 <dc:call-macro name="load-system"/>
1566 </dc:otherwise>
1567 </dc:choose>
1568 </datacage>
1569 </dc:template>

http://dive4elements.wald.intevation.org