comparison flys-artifacts/doc/conf/meta-data.xml @ 3814:8083f6384023

merged flys-artifacts/pre2.6-2012-01-04
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:56 +0200
parents 4c10a4cb978f
children dd3f5bd174ea
comparison
equal deleted inserted replaced
1491:2a00f4849738 3814:8083f6384023
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 <addtionals>
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 </addtionals>
113 </dc:macro>
114
115 <dc:macro name="basedata_2_fixations_wst">
116 <fixations>
117 <dc:context>
118 <dc:statement>
119 SELECT id AS prot_id,
120 description AS prot_description
121 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
122 </dc:statement>
123 <dc:elements>
124 <fixation>
125 <dc:attribute name="name" value="${prot_description}"/>
126 <dc:attribute name="ids" value="fixations-wstv-A-${prot_id}"/>
127 <dc:attribute name="factory" value="wqinterpol"/>
128 </fixation>
129 </dc:elements>
130 </dc:context>
131 </fixations>
132 </dc:macro>
133
134 <dc:macro name="basedata_2_fixations_wqkms">
135 <fixations>
136 <dc:context>
137 <dc:statement>
138 SELECT id AS prot_id,
139 description AS prot_description
140 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
141 </dc:statement>
142 <dc:elements>
143 <fixation>
144 <dc:attribute name="name" value="${prot_description}"/>
145 <dc:context>
146 <dc:statement>
147 SELECT id AS prot_column_id,
148 name AS prot_column_name,
149 position AS prot_rel_pos
150 FROM wst_columns WHERE wst_id = ${prot_id}
151 ORDER by position
152 </dc:statement>
153 <dc:elements>
154 <column>
155 <dc:attribute name="name" value="${prot_column_name}"/>
156 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
157 <dc:attribute name="factory" value="wqinterpol"/>
158 </column>
159 </dc:elements>
160 </dc:context>
161 </fixation>
162 </dc:elements>
163 </dc:context>
164 </fixations>
165 </dc:macro>
166
167 <dc:macro name="basedata_2_fixations">
168 <fixations>
169 <dc:context>
170 <dc:statement>
171 SELECT id AS prot_id,
172 description AS prot_description
173 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
174 </dc:statement>
175 <dc:elements>
176 <fixation>
177 <dc:attribute name="name" value="${prot_description}"/>
178 <dc:context>
179 <dc:statement>
180 SELECT id AS prot_column_id,
181 name AS prot_column_name,
182 position AS prot_rel_pos
183 FROM wst_columns WHERE wst_id = ${prot_id}
184 ORDER by position
185 </dc:statement>
186 <dc:elements>
187 <column>
188 <dc:attribute name="name" value="${prot_column_name}"/>
189 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
190 <dc:attribute name="factory" value="staticwkms"/>
191 </column>
192 </dc:elements>
193 </dc:context>
194 </fixation>
195 </dc:elements>
196 </dc:context>
197 </fixations>
198 </dc:macro>
199
200 <dc:macro name="basedata_4_heightmarks-points">
201 <heightmarks>
202 <dc:context>
203 <dc:statement>
204 SELECT id AS prot_id,
205 description AS prot_description
206 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
207 </dc:statement>
208 <dc:elements>
209 <heightmark>
210 <dc:attribute name="name" value="${prot_description}"/>
211 <dc:context>
212 <dc:statement>
213 SELECT id AS prot_column_id,
214 name AS prot_column_name,
215 position AS prot_rel_pos
216 FROM wst_columns WHERE wst_id = ${prot_id}
217 ORDER by position
218 </dc:statement>
219 <dc:elements>
220 <column>
221 <dc:attribute name="name" value="${prot_column_name}"/>
222 <dc:attribute name="ids" value="heightmarks_points-wstv-${prot_rel_pos}-${prot_id}"/>
223 <dc:attribute name="factory" value="staticwkms"/>
224 </column>
225 </dc:elements>
226 </dc:context>
227 </heightmark>
228 </dc:elements>
229 </dc:context>
230 </heightmarks>
231 </dc:macro>
232
233 <dc:macro name="basedata_4_heightmarks-wq">
234 <heightmarks>
235 <dc:context>
236 <dc:statement>
237 SELECT id AS prot_id,
238 description AS prot_description
239 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
240 </dc:statement>
241 <dc:elements>
242 <heightmark>
243 <dc:attribute name="name" value="${prot_description}"/>
244 <dc:context>
245 <dc:statement>
246 SELECT id AS prot_column_id,
247 name AS prot_column_name,
248 position AS prot_rel_pos
249 FROM wst_columns WHERE wst_id = ${prot_id}
250 ORDER by position
251 </dc:statement>
252 <dc:elements>
253 <column>
254 <dc:attribute name="name" value="${prot_column_name}"/>
255 <dc:attribute name="ids" value="heightmarks_annotations-wstv-${prot_rel_pos}-${prot_id}"/>
256 <dc:attribute name="factory" value="wqinterpol"/>
257 </column>
258 </dc:elements>
259 </dc:context>
260 </heightmark>
261 </dc:elements>
262 </dc:context>
263 </heightmarks>
264 </dc:macro>
265
266 <dc:macro name="basedata_5_flood-protections">
267 <flood-protections>
268 <dc:attribute name="id" value="flood-protections-${river_id}"/>
269 <dc:context>
270 <dc:statement>
271 SELECT id AS prot_id,
272 description AS prot_description
273 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
274 </dc:statement>
275 <dc:elements>
276 <flood-protection>
277 <dc:attribute name="name" value="${prot_description}"/>
278 <dc:attribute name="db-id" value="${prot_id}"/>
279 <dc:attribute name="factory" value="staticwkms"/>
280 <columns>
281 <dc:context>
282 <dc:statement>
283 SELECT id AS prot_column_id,
284 name AS prot_column_name,
285 position AS prot_rel_pos
286 FROM wst_columns WHERE wst_id = ${prot_id}
287 ORDER by position
288 </dc:statement>
289 <dc:elements>
290 <column>
291 <dc:attribute name="name" value="${prot_column_name}"/>
292 <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/>
293 <dc:attribute name="factory" value="staticwkms"/>
294 </column>
295 </dc:elements>
296 </dc:context>
297 </columns>
298 </flood-protection>
299 </dc:elements>
300 </dc:context>
301 </flood-protections>
302 </dc:macro>
303
304 <dc:macro name="mainvalues">
305 <mainvalue>
306 <dc:attribute name="factory" value="mainvalue"/>
307 <dc:attribute name="ids" value="${river_id}"/>
308 </mainvalue>
309 </dc:macro>
310
311 <dc:macro name="annotations">
312 <annotation>
313 <dc:attribute name="factory" value="annotations"/>
314 <dc:attribute name="ids" value="${river_id}"/>
315 </annotation>
316 </dc:macro>
317
318 <dc:macro name="cross_sections">
319 <cross-sections>
320 <dc:attribute name="id" value="flood-protections-${river_id}"/>
321 <dc:context>
322 <dc:statement>
323 SELECT id AS prot_id,
324 description AS prot_description
325 FROM cross_sections WHERE river_id = ${river_id}
326 </dc:statement>
327 <dc:elements>
328 <cross-section>
329 <dc:attribute name="name" value="${prot_description}"/>
330 <dc:attribute name="ids" value="${prot_id}"/>
331 <dc:attribute name="factory" value="crosssections"/>
332 </cross-section>
333 </dc:elements>
334 </dc:context>
335 </cross-sections>
336 </dc:macro>
337
338
339 <dc:comment>
340
341 + River-Node
342
343 </dc:comment>
344
345 <river>
346 <dc:attribute name="name" value="${river_name}"/>
347
348 <dc:choose>
349 <dc:when test="dc:contains($parameters, 'recommended')">
350 <dc:comment>
351 Recommendations.
352 </dc:comment>
353 <dc:if test="dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))">
354 <dc:call-macro name="annotations"/>
355 </dc:if>
356 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
357 <dc:call-macro name="cross_sections"/>
358 </dc:if>
359 </dc:when>
360 <dc:otherwise>
361 <dc:comment>
362 Non - Recommendations.
363 </dc:comment>
364 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
365 <dc:call-macro name="basedata_0"/>
366 <dc:call-macro name="basedata_1_additionals"/>
367 </dc:if>
368 <dc:if test="dc:contains($artifact-outs, 'discharge_longitudinal_section')">
369 <dc:call-macro name="basedata_0"/>
370 <dc:call-macro name="basedata_4_heightmarks-points"/>
371 </dc:if>
372 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
373 <dc:call-macro name="basedata_0_wq"/>
374 <dc:call-macro name="basedata_4_heightmarks-wq"/>
375 </dc:if>
376 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences'))">
377 <dc:call-macro name="basedata_0"/>
378 <dc:call-macro name="basedata_1_additionals"/>
379 <dc:comment comment=" FIXATIONS ---------------------------"/>
380 <dc:call-macro name="basedata_2_fixations"/>
381 <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
382 <dc:call-macro name="basedata_4_heightmarks-points"/>
383 </dc:if>
384 <dc:comment comment="--- non-recommendations---"/>
385 </dc:otherwise>
386 </dc:choose>
387
388
389 <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
390
391 <!-- base data -->
392 <dc:call-macro name="basedata_0"/>
393
394 <!-- extra-longitudinal-sections -->
395 <dc:call-macro name="basedata_1_additionals"/>
396
397 <!-- fixations -->
398 <dc:call-macro name="basedata_2_fixations"/>
399
400 <!-- flood water marks-->
401 <dc:call-macro name="basedata_4_heightmarks-points"/>
402
403 <!-- flood protection -->
404 <dc:call-macro name="basedata_5_flood-protections"/>
405
406 </dc:if>
407 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and (dc:contains($parameters, 'recommended'))">
408 <!--dc:call-macro name="basedata_2_fixations_wst"/-->
409 </dc:if>
410
411 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and not (dc:contains($parameters, 'recommended'))">
412 <discharge-table-nn>
413 <discharge-table-gauge>
414 <dc:context>
415 <dc:statement>
416 SELECT id AS gauge_id,
417 name AS gauge_name
418 FROM gauges WHERE river_id = ${river_id}
419 </dc:statement>
420 <dc:elements>
421 <gauge>
422 <dc:attribute name="name" value="${gauge_name}"/>
423 <dc:attribute name="db-id" value="${gauge_id}"/>
424 <dc:context>
425 <dc:statement>
426 SELECT description AS gauge_desc,
427 d.id AS discharge_id,
428 ti.start_time AS g_start,
429 ti.stop_time AS g_stop
430 FROM discharge_tables d JOIN time_intervals ti
431 ON d.time_interval_id = ti.id
432 WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
433 </dc:statement>
434 <dc:elements>
435 <historical>
436 <dc:attribute name="name" value="${gauge_desc}"/>
437 <dc:attribute name="from" value="${g_start}"/>
438 <dc:attribute name="to" value="${g_stop}"/>
439 <dc:attribute name="db-id" value="${discharge_id}"/></historical>
440 </dc:elements>
441 </dc:context>
442 </gauge>
443 </dc:elements>
444 </dc:context>
445 </discharge-table-gauge>
446
447 </discharge-table-nn>
448
449 <dc:call-macro name="basedata_2_fixations_wst"/>
450
451 <dc:call-macro name="basedata_5_flood-protections"/>
452
453 <!-- former waterlevels -->
454 <dc:call-macro name="basedata_0"/>
455
456 <dc:call-macro name="basedata_1_additionals"/>
457
458 <!-- former flood-water-marks -->
459 <dc:call-macro name="basedata_4_heightmarks-points"/>
460 </dc:if>
461 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')"><!-- or (dc:contains($artifact-outs, 'discharge_curve'))"-->
462 <!-- && parameter contains recommended/ation -->
463 <computed-discharge-curve>
464 <dc:call-macro name="mainvalues"/>
465 </computed-discharge-curve>
466 <dc:call-macro name="basedata_2_fixations_wst"/>
467 </dc:if>
468
469 <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
470 <dc:call-macro name="mainvalues"/>
471 </dc:if>
472
473 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
474 <longitudinal-section>
475 <dc:call-macro name="annotations"/>
476 </longitudinal-section>
477 </dc:if>
478 <dc:if test="dc:contains($artifact-outs, 'floodmap')">
479 <floodmap>
480 <dc:choose>
481 <dc:when test="dc:contains($parameters, 'recommended')">
482 <dc:call-macro name="flood-map-recommended"/>
483 </dc:when>
484 <dc:when test="dc:contains($parameters, 'dem')">
485 <dc:call-macro name="flood-map-dem"/>
486 </dc:when>
487 <dc:otherwise>
488 <dc:call-macro name="flood-map-complete"/>
489 </dc:otherwise>
490 </dc:choose>
491 </floodmap>
492 <dc:macro name="flood-map-recommended">
493 <dc:comment>
494 FIXME: Following two macros look identical to me.
495 </dc:comment>
496 <kilometrage>
497 <riveraxis>
498 <dc:attribute name="factory" value="riveraxis"/>
499 <dc:attribute name="ids" value="${river_id}"/>
500 </riveraxis>
501 </kilometrage>
502 <rastermap>
503 <background>
504 <dc:attribute name="factory" value="wmsbackground"/>
505 <dc:attribute name="ids" value="${river_id}"/>
506 </background>
507 </rastermap>
508 </dc:macro>
509 <dc:macro name="flood-map-dem">
510 <dems>
511 <dc:context>
512 <dc:statement>
513 SELECT id AS dem_id,
514 lower AS dem_lower,
515 upper AS dem_upper
516 FROM dem WHERE river_id = ${river_id}
517 </dc:statement>
518 <dc:elements>
519 <dem>
520 <dc:attribute name="factory" value="demfactory"/>
521 <dc:attribute name="ids" value="${dem_id}"/>
522 <dc:attribute name="description" value="${dem_lower}-${dem_upper}"/>
523 </dem>
524 </dc:elements>
525 </dc:context>
526 </dems>
527 </dc:macro>
528 <dc:macro name="flood-map-km">
529 <dc:context>
530 <dc:statement>
531 SELECT count(*) as km_exists
532 FROM river_axes_km WHERE river_id = ${river_id}
533 </dc:statement>
534 <dc:elements>
535 <dc:if test="$km_exists>0">
536 <km>
537 <dc:attribute name="factory" value="wmskmfactory"/>
538 <dc:attribute name="ids" value="${river_id}"/>
539 </km>
540 </dc:if>
541 </dc:elements>
542 </dc:context>
543 </dc:macro>
544 <dc:macro name="flood-map-qps">
545 <dc:context>
546 <dc:statement>
547 SELECT count(*) as km_exists
548 FROM cross_section_tracks WHERE river_id = ${river_id}
549 </dc:statement>
550 <dc:elements>
551 <dc:if test="$km_exists>0">
552 <qps>
553 <dc:attribute name="factory" value="wmsqpsfactory"/>
554 <dc:attribute name="ids" value="${river_id}"/>
555 </qps>
556 </dc:if>
557 </dc:elements>
558 </dc:context>
559 </dc:macro>
560 <dc:macro name="flood-map-hws">
561 <dc:context>
562 <dc:statement>
563 SELECT count(*) as km_exists
564 FROM hws WHERE river_id = ${river_id}
565 </dc:statement>
566 <dc:elements>
567 <dc:if test="$km_exists>0">
568 <hws>
569 <dc:attribute name="factory" value="wmshwsfactory"/>
570 <dc:attribute name="ids" value="${river_id}"/>
571 </hws>
572 </dc:if>
573 </dc:elements>
574 </dc:context>
575 </dc:macro>
576 <dc:macro name="flood-map-catchments">
577 <dc:context>
578 <dc:statement>
579 SELECT count(*) as km_exists
580 FROM catchment WHERE river_id = ${river_id}
581 </dc:statement>
582 <dc:elements>
583 <dc:if test="$km_exists>0">
584 <catchments>
585 <dc:attribute name="factory" value="wmscatchmentfactory"/>
586 <dc:attribute name="ids" value="${river_id}"/>
587 </catchments>
588 </dc:if>
589 </dc:elements>
590 </dc:context>
591 </dc:macro>
592 <dc:macro name="flood-map-floodplain">
593 <dc:context>
594 <dc:statement>
595 SELECT count(*) as km_exists
596 FROM floodplain WHERE river_id = ${river_id}
597 </dc:statement>
598 <dc:elements>
599 <dc:if test="$km_exists>0">
600 <floodplain>
601 <dc:attribute name="factory" value="wmsfloodplainfactory"/>
602 <dc:attribute name="ids" value="${river_id}"/>
603 </floodplain>
604 </dc:if>
605 </dc:elements>
606 </dc:context>
607 </dc:macro>
608 <dc:macro name="flood-map-lines">
609 <dc:context>
610 <dc:statement>
611 SELECT count(*) as km_exists
612 FROM lines WHERE river_id = ${river_id}
613 </dc:statement>
614 <dc:elements>
615 <dc:if test="$km_exists>0">
616 <lines>
617 <dc:attribute name="factory" value="wmslinefactory"/>
618 <dc:attribute name="ids" value="${river_id}"/>
619 </lines>
620 </dc:if>
621 </dc:elements>
622 </dc:context>
623 </dc:macro>
624 <dc:macro name="flood-map-buildings">
625 <dc:context>
626 <dc:statement>
627 SELECT count(*) as km_exists
628 FROM buildings WHERE river_id = ${river_id}
629 </dc:statement>
630 <dc:elements>
631 <dc:if test="$km_exists>0">
632 <buildings>
633 <dc:attribute name="factory" value="wmsbuildingsfactory"/>
634 <dc:attribute name="ids" value="${river_id}"/>
635 </buildings>
636 </dc:if>
637 </dc:elements>
638 </dc:context>
639 </dc:macro>
640 <dc:macro name="flood-map-fixpoints">
641 <dc:context>
642 <dc:statement>
643 SELECT count(*) as km_exists
644 FROM fixpoints WHERE river_id = ${river_id}
645 </dc:statement>
646 <dc:elements>
647 <dc:if test="$km_exists>0">
648 <fixpoints>
649 <dc:attribute name="factory" value="wmsfixpointsfactory"/>
650 <dc:attribute name="ids" value="${river_id}"/>
651 </fixpoints>
652 </dc:if>
653 </dc:elements>
654 </dc:context>
655 </dc:macro>
656 <dc:macro name="flood-map-complete">
657 <kilometrage>
658 <riveraxis>
659 <dc:attribute name="factory" value="riveraxis"/>
660 <dc:attribute name="ids" value="${river_id}"/>
661 </riveraxis>
662 <dc:call-macro name="flood-map-km"/>
663 <dc:call-macro name="flood-map-qps"/>
664 <dc:call-macro name="flood-map-hws"/>
665 <dc:call-macro name="flood-map-catchments"/>
666 <dc:call-macro name="flood-map-floodplain"/>
667 <dc:call-macro name="flood-map-lines"/>
668 <dc:call-macro name="flood-map-buildings"/>
669 <dc:call-macro name="flood-map-fixpoints"/>
670 </kilometrage>
671 <rastermap>
672 <background>
673 <dc:attribute name="factory" value="wmsbackground"/>
674 <dc:attribute name="ids" value="${river_id}"/>
675 </background>
676 </rastermap>
677 </dc:macro>
678 </dc:if>
679 </river>
680 </dc:elements>
681 </dc:context>
682 </dc:macro>
683
684 <dc:choose>
685 <dc:comment>
686 User specific part
687 ------------------
688 </dc:comment>
689 <dc:when test="dc:contains($parameters, 'user-id')">
690
691
692 <old_calculations>
693 <dc:context connection="user">
694 <dc:comment>
695 Get the user and collection-id.
696 </dc:comment>
697 <dc:statement>
698 SELECT u.id AS user_id, c.id AS collection_id, c.name as collection_name
699 FROM collections c JOIN users u ON c.user_id = u.id
700 WHERE u.gid = CAST(${user-id} AS uuid)
701 ORDER BY c.creation DESC
702 </dc:statement>
703
704
705 <dc:comment>
706 SHOW W-DIFFERENCES
707 </dc:comment>
708
709 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))">
710 <differences>
711 <dc:elements>
712 <dc:context>
713 <dc:statement>
714 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
715 FROM master_artifacts m
716 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
717 AND EXISTS (
718 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
719 </dc:statement>
720 <dc:elements>
721 <dc:context>
722 <dc:statement>
723 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
724 FROM outs as o, facets as f, artifacts as a
725 WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
726 </dc:statement>
727 <dc:elements>
728 <dc:element name="${facet_name}">
729 <dc:attribute name="description" value="${facet_description}"/>
730 <dc:attribute name="factory" value="winfo"/>
731 <dc:attribute name="artifact-id" value="${aid}"/>
732 <dc:attribute name="ids" value="${aid}"/>
733 <dc:attribute name="out" value="w_differences"/>
734 </dc:element>
735 </dc:elements>
736 </dc:context>
737 </dc:elements>
738 </dc:context>
739 </dc:elements>
740 </differences>
741 </dc:if>
742
743 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
744 <computed_discharge_curves>
745 <dc:elements>
746 <dc:context>
747 <dc:statement>
748 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
749 FROM master_artifacts m
750 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
751 AND EXISTS (
752 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
753 </dc:statement>
754 <dc:elements>
755 <dc:context>
756 <dc:statement>
757 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
758 FROM outs as o, facets as f, artifacts as a
759 WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
760 </dc:statement>
761 <dc:elements>
762 <dc:element name="${facet_name}">
763 <dc:attribute name="description" value="${facet_description}"/>
764 <dc:attribute name="factory" value="winfo"/>
765 <dc:attribute name="artifact-id" value="${aid}"/>
766 <dc:attribute name="ids" value="${aid}"/>
767 <dc:attribute name="out" value="computed_discharge_curve"/>
768 </dc:element>
769 </dc:elements>
770 </dc:context>
771 </dc:elements>
772 </dc:context>
773 </dc:elements>
774 </computed_discharge_curves>
775 </dc:if>
776
777
778 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
779 <waterlevels>
780 <dc:elements>
781 <dc:context>
782 <dc:statement>
783 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
784 FROM master_artifacts m
785 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
786 AND EXISTS (
787 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
788 </dc:statement>
789 <dc:elements>
790 <dc:context>
791 <dc:statement>
792 SELECT id AS out_id
793 FROM outs
794 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
795 </dc:statement>
796 <dc:elements>
797 <dc:context>
798 <dc:statement>
799 SELECT name AS facet_name, num as facet_num, description AS facet_description
800 FROM facets
801 WHERE out_id = ${out_id}
802 ORDER BY num ASC, name DESC
803 </dc:statement>
804 <longitudinal_section_columns>
805 <dc:attribute name="description" value="${river} ${a_creation}"/>
806 <dc:elements>
807 <dc:element name="${facet_name}">
808 <dc:attribute name="description" value="${facet_description}"/>
809 <dc:attribute name="ids" value="${facet_num}"/>
810 <dc:attribute name="factory" value="winfo"/>
811 <dc:attribute name="artifact-id" value="${a_gid}"/>
812 <dc:attribute name="out" value="longitudinal_section"/>
813 </dc:element>
814 </dc:elements>
815 </longitudinal_section_columns>
816 </dc:context>
817 </dc:elements>
818 </dc:context>
819 </dc:elements>
820 </dc:context>
821 </dc:elements>
822 </waterlevels>
823 </dc:if>
824
825 <dc:comment>
826 WATERLEVELS - ONLY SHOW Ws
827 </dc:comment>
828
829 <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
830 <waterlevels>
831 <dc:elements>
832 <dc:context>
833 <dc:statement>
834 SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
835 FROM master_artifacts m
836 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
837 AND EXISTS (
838 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
839 </dc:statement>
840 <dc:elements>
841
842 <dc:context>
843 <dc:statement>
844 SELECT id AS out_id
845 FROM outs
846 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
847 </dc:statement>
848 <dc:elements>
849 <dc:context>
850 <dc:statement>
851 SELECT name AS facet_name, num as facet_num, description AS facet_description
852 FROM facets
853 WHERE out_id = ${out_id} and name = 'longitudinal_section.w'
854 ORDER BY num ASC, name DESC
855 </dc:statement>
856 <waterlevels>
857 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
858 <dc:elements>
859 <dc:element name="${facet_name}">
860 <dc:attribute name="description" value="${facet_description}"/>
861 <dc:attribute name="ids" value="${facet_num}"/>
862 <dc:attribute name="factory" value="winfo"/>
863 <dc:attribute name="artifact-id" value="${a_gid}"/>
864 <dc:attribute name="out" value="longitudinal_section"/>
865 </dc:element>
866 </dc:elements>
867 </waterlevels>
868 </dc:context>
869 </dc:elements>
870 </dc:context>
871 </dc:elements>
872 </dc:context>
873 </dc:elements>
874 </waterlevels>
875 </dc:if>
876
877 </dc:context>
878 </old_calculations>
879
880
881 <dc:comment>
882 Include System specific part when 'load-system' is in parameters.
883 -----------------------------------------------------------------
884 </dc:comment>
885 <dc:choose>
886 <dc:when test="dc:contains($parameters,'load-system')">
887 <dc:call-macro name="load-system"/>
888 </dc:when>
889 </dc:choose>
890 </dc:when>
891
892
893 <dc:comment>
894 Include System specific part only if no user ID is given.
895 ---------------------------------------------------------
896 </dc:comment>
897 <dc:otherwise>
898 <dc:call-macro name="load-system"/>
899 </dc:otherwise>
900 </dc:choose>
901 </datacage>
902 </dc:template>

http://dive4elements.wald.intevation.org