sascha@1046: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
sascha@1046: <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage">
sascha@1046: <datacage>
ingo@1181:   <dc:macro name="load-system">
ingo@1181:     <dc:context connection="system">
ingo@1181:       <dc:statement>
ingo@1181:         SELECT id AS river_id, name as river_name FROM rivers
ingo@1181:         WHERE lower(name) LIKE lower(${river})
ingo@1181:       </dc:statement>
ingo@1181:       <dc:elements>
felix@1790:         <dc:comment>
felix@1790:           Base-data macros (mostly data imported from wst-files)
felix@1790:         </dc:comment>
felix@1790:         <dc:macro name="basedata_0">
felix@1790:             <dc:comment comment=" BASEDATA ---------------------------"/>
felix@1790:             <basedata>
felix@1790:               <dc:context>
felix@1790:                 <dc:statement>
felix@1790:                   SELECT id          AS prot_id,
felix@1790:                          description AS prot_description
felix@1790:                   FROM wsts WHERE kind = 0 AND river_id = ${river_id}
felix@1790:                 </dc:statement>
felix@1790:                 <dc:elements>
felix@1790:                   <basedata>
felix@1790:                     <dc:attribute name="name" value="${prot_description}"/>
felix@1790:                     <dc:context>
felix@1790:                       <dc:statement>
felix@1790:                         SELECT id       AS prot_column_id,
felix@1790:                                name     AS prot_column_name,
felix@3570:                                position AS prot_rel_pos,
felix@3570:                                description AS info
felix@1790:                         FROM wst_columns WHERE wst_id = ${prot_id}
felix@1790:                         ORDER by position
felix@1790:                       </dc:statement>
felix@1790:                       <dc:elements>
felix@1790:                         <column>
felix@1790:                           <dc:attribute name="name" value="${prot_column_name}"/>
felix@1790:                           <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1790:                           <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                           <dc:attribute name="info" value="${info}"/>
felix@1790:                         </column>
felix@1790:                       </dc:elements>
felix@1790:                     </dc:context>
felix@1790:                   </basedata>
felix@1790:                 </dc:elements>
felix@1790:               </dc:context>
felix@1790:             </basedata>
felix@1790:         </dc:macro>
felix@1916:         <dc:macro name="basedata_0_wq">
felix@1916:             <dc:comment comment=" BASEDATA ---------------------------"/>
felix@1916:             <basedata>
felix@1916:               <dc:context>
felix@1916:                 <dc:statement>
felix@1916:                   SELECT id          AS prot_id,
felix@1916:                          description AS prot_description
felix@1916:                   FROM wsts WHERE kind = 0 AND river_id = ${river_id}
felix@1916:                 </dc:statement>
felix@1916:                 <dc:elements>
felix@1916:                   <basedata>
felix@1916:                     <dc:attribute name="name" value="${prot_description}"/>
felix@1916:                     <dc:context>
felix@1916:                       <dc:statement>
felix@1916:                         SELECT id       AS prot_column_id,
felix@1916:                                name     AS prot_column_name,
felix@3570:                                position AS prot_rel_pos,
felix@3570:                                description AS info
felix@1916:                         FROM wst_columns WHERE wst_id = ${prot_id}
felix@1916:                         ORDER by position
felix@1916:                       </dc:statement>
felix@1916:                       <dc:elements>
felix@1916:                         <column>
felix@1916:                           <dc:attribute name="name" value="${prot_column_name}"/>
felix@1916:                           <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1916:                           <dc:attribute name="factory" value="wqinterpol"/>
felix@3570:                           <dc:attribute name="info" value="${info}"/>
felix@1916:                         </column>
felix@1916:                       </dc:elements>
felix@1916:                     </dc:context>
felix@1916:                   </basedata>
felix@1916:                 </dc:elements>
felix@1916:               </dc:context>
felix@1916:             </basedata>
felix@1916:         </dc:macro>
felix@1916: 
felix@1790:         <dc:macro name="basedata_1_additionals">
felix@1790:             <dc:comment comment=".ZUS -------------------------------"/>
felix@2085:             <additionals>
felix@1790:               <dc:context>
felix@1790:                 <dc:statement>
felix@1790:                   SELECT id          AS prot_id,
felix@1790:                          description AS prot_description
felix@1790:                   FROM wsts WHERE kind = 1 AND river_id = ${river_id}
felix@1790:                 </dc:statement>
felix@1790:                 <dc:elements>
felix@1790:                   <additional>
felix@1790:                     <dc:attribute name="name" value="${prot_description}"/>
felix@1790:                     <dc:context>
felix@1790:                       <dc:statement>
felix@1790:                         SELECT id       AS prot_column_id,
felix@1790:                                name     AS prot_column_name,
felix@3570:                                position AS prot_rel_pos,
felix@3570:                                description AS info
felix@1790:                         FROM wst_columns WHERE wst_id = ${prot_id}
felix@1790:                         ORDER by position
felix@1790:                       </dc:statement>
felix@1790:                       <dc:elements>
felix@1790:                         <column>
felix@1790:                           <dc:attribute name="name" value="${prot_column_name}"/>
felix@1790:                           <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1790:                           <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                           <dc:attribute name="info" value="${info}"/>
felix@1790:                         </column>
felix@1790:                       </dc:elements>
felix@1790:                     </dc:context>
felix@1790:                   </additional>
felix@1790:                 </dc:elements>
felix@1790:               </dc:context>
felix@2085:             </additionals>
felix@1790:         </dc:macro>
felix@1869: 
felix@2761:         <dc:macro name="basedata_1_additionals-relative_point">
felix@2761:             <dc:comment comment=".ZUS -------------------------------"/>
felix@2761:             <additionals>
felix@2761:               <dc:context>
felix@2761:                 <dc:statement>
felix@2761:                   SELECT id          AS prot_id,
felix@2761:                          description AS prot_description
felix@2761:                   FROM wsts WHERE kind = 1 AND river_id = ${river_id}
felix@2761:                 </dc:statement>
felix@2761:                 <dc:elements>
felix@2761:                   <relativepoint>
felix@2761:                     <dc:attribute name="name" value="${prot_description}"/>
felix@2761:                     <dc:context>
felix@2761:                       <dc:statement>
felix@2761:                         SELECT id       AS prot_column_id,
felix@2761:                                name     AS prot_column_name,
felix@3570:                                position AS prot_rel_pos,
felix@3570:                                description AS info
felix@2761:                         FROM wst_columns WHERE wst_id = ${prot_id}
felix@2761:                         ORDER by position
felix@2761:                       </dc:statement>
felix@2761:                       <dc:elements>
felix@2761:                         <column>
felix@2761:                           <dc:attribute name="name" value="${prot_column_name}"/>
felix@2761:                           <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
felix@2761:                           <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                           <dc:attribute name="info" value="${info}"/>
felix@2761:                         </column>
felix@2761:                       </dc:elements>
felix@2761:                     </dc:context>
felix@2761:                   </relativepoint>
felix@2761:                 </dc:elements>
felix@2761:               </dc:context>
felix@2761:             </additionals>
felix@2761:         </dc:macro>
felix@2761: 
felix@1905:         <dc:macro name="basedata_2_fixations_wst">
felix@1905:           <fixations>
felix@1905:             <dc:context>
felix@1905:               <dc:statement>
felix@1905:                 SELECT id          AS prot_id,
felix@1905:                        description AS prot_description
felix@1905:                 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
felix@1905:               </dc:statement>
felix@1905:               <dc:elements>
felix@1905:                 <fixation>
felix@2572:                   <dc:attribute name="name" value="${prot_description}"/>
felix@2572:                   <!--dc:attribute name="ids" value="fixations-wstv-A-${prot_id}"/-->
felix@2572:                   <dc:context>
felix@2572:                     <dc:statement>
felix@2572:                       SELECT id       AS prot_column_id,
felix@2572:                              name     AS prot_column_name,
felix@3570:                              position AS prot_rel_pos,
felix@3570:                              description AS info
felix@2572:                       FROM wst_columns WHERE wst_id = ${prot_id}
felix@2572:                       ORDER by position
felix@2572:                     </dc:statement>
felix@2572:                     <dc:elements>
felix@2572:                       <column>
felix@2572:                         <dc:attribute name="name" value="${prot_column_name}"/>
felix@2572:                         <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
felix@2572:                         <dc:attribute name="factory" value="wqinterpol"/>
felix@3570:                         <dc:attribute name="info" value="${info}"/>
felix@2572:                       </column>
felix@2572:                     </dc:elements>
felix@2572:                   </dc:context>
felix@1905:                 </fixation>
felix@1905:               </dc:elements>
felix@1905:             </dc:context>
felix@1905:           </fixations>
felix@1905:         </dc:macro>
felix@1905: 
felix@1905:         <dc:macro name="basedata_2_fixations_wqkms">
felix@1905:           <fixations>
felix@1905:             <dc:context>
felix@1905:               <dc:statement>
felix@1905:                 SELECT id          AS prot_id,
felix@1905:                        description AS prot_description
felix@1905:                 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
felix@1905:               </dc:statement>
felix@1905:               <dc:elements>
felix@1905:                 <fixation>
felix@1905:                   <dc:attribute name="name" value="${prot_description}"/>
felix@1905:                   <dc:context>
felix@1905:                     <dc:statement>
felix@1905:                       SELECT id       AS prot_column_id,
felix@1905:                              name     AS prot_column_name,
felix@3570:                              position AS prot_rel_pos,
felix@3570:                              desciption AS info
felix@1905:                       FROM wst_columns WHERE wst_id = ${prot_id}
felix@1905:                       ORDER by position
felix@1905:                     </dc:statement>
felix@1905:                     <dc:elements>
felix@1905:                       <column>
felix@1905:                         <dc:attribute name="name" value="${prot_column_name}"/>
felix@1905:                         <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1905:                         <dc:attribute name="factory" value="wqinterpol"/>
felix@3570:                         <dc:attribute name="info" value="${info}"/>
felix@1905:                       </column>
felix@1905:                     </dc:elements>
felix@1905:                   </dc:context>
felix@1905:                 </fixation>
felix@1905:               </dc:elements>
felix@1905:             </dc:context>
felix@1905:           </fixations>
felix@1905:         </dc:macro>
felix@1905: 
felix@1872:         <dc:macro name="basedata_2_fixations">
felix@1872:           <fixations>
felix@1872:             <dc:context>
felix@1872:               <dc:statement>
felix@1872:                 SELECT id          AS prot_id,
felix@1872:                        description AS prot_description
felix@1872:                 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
felix@1872:               </dc:statement>
felix@1872:               <dc:elements>
felix@1872:                 <fixation>
felix@1872:                   <dc:attribute name="name" value="${prot_description}"/>
felix@1872:                   <dc:context>
felix@1872:                     <dc:statement>
felix@1872:                       SELECT id       AS prot_column_id,
felix@1872:                              name     AS prot_column_name,
felix@3570:                              position AS prot_rel_pos,
felix@3570:                              description AS info
felix@1872:                       FROM wst_columns WHERE wst_id = ${prot_id}
felix@1872:                       ORDER by position
felix@1872:                     </dc:statement>
felix@1872:                     <dc:elements>
felix@1872:                       <column>
felix@1872:                         <dc:attribute name="name" value="${prot_column_name}"/>
felix@1872:                         <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1872:                         <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                         <dc:attribute name="info" value="${info}"/>
felix@1872:                       </column>
felix@1872:                     </dc:elements>
felix@1872:                   </dc:context>
felix@1872:                 </fixation>
felix@1872:               </dc:elements>
felix@1872:             </dc:context>
felix@1872:           </fixations>
felix@1872:         </dc:macro>
felix@1872: 
felix@2749:         <dc:macro name="basedata_2_fixations_relative_point">
felix@2749:           <fixations>
felix@2749:             <dc:context>
felix@2749:               <dc:statement>
felix@2749:                 SELECT id          AS prot_id,
felix@2749:                        description AS prot_description
felix@2749:                 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
felix@2749:               </dc:statement>
felix@2749:               <dc:elements>
felix@2749:                 <relativepoint>
felix@2749:                   <dc:attribute name="name" value="${prot_description}"/>
felix@2749:                   <dc:context>
felix@2749:                     <dc:statement>
felix@2749:                       SELECT id       AS prot_column_id,
felix@2749:                              name     AS prot_column_name,
felix@3570:                              position AS prot_rel_pos,
felix@3570:                              description AS info
felix@2749:                       FROM wst_columns WHERE wst_id = ${prot_id}
felix@2749:                       ORDER by position
felix@2749:                     </dc:statement>
felix@2749:                     <dc:elements>
felix@2749:                       <column>
felix@2749:                         <dc:attribute name="name" value="${prot_column_name}"/>
felix@2749:                         <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/>
felix@2749:                         <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                         <dc:attribute name="info" value="${info}"/>
felix@2749:                       </column>
felix@2749:                     </dc:elements>
felix@2749:                   </dc:context>
felix@2749:                 </relativepoint>
felix@2749:               </dc:elements>
felix@2749:             </dc:context>
felix@2749:           </fixations>
felix@2749:         </dc:macro>
felix@2751: 
felix@3283:         <dc:macro name="basedata_3_officials">
felix@3283:             <dc:comment comment=".wst -------------------------------"/>
felix@3283:             <officiallines>
felix@3283:               <dc:context>
felix@3283:                 <dc:statement>
felix@3283:                   SELECT id          AS prot_id,
felix@3283:                          description AS prot_description
felix@3283:                   FROM wsts WHERE kind = 3 AND river_id = ${river_id}
felix@3283:                 </dc:statement>
felix@3283:                 <dc:elements>
felix@3283:                   <official>
felix@3283:                     <dc:attribute name="name" value="${prot_description}"/>
felix@3283:                     <dc:context>
felix@3283:                       <dc:statement>
felix@3283:                         SELECT id       AS prot_column_id,
felix@3283:                                name     AS prot_column_name,
felix@3570:                                position AS prot_rel_pos,
felix@3570:                                description AS info
felix@3283:                         FROM wst_columns WHERE wst_id = ${prot_id}
felix@3283:                         ORDER by position
felix@3283:                       </dc:statement>
felix@3283:                       <dc:elements>
felix@3283:                         <column>
felix@3283:                           <dc:attribute name="name" value="${prot_column_name}"/>
felix@3283:                           <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
felix@3283:                           <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                           <dc:attribute name="info" value="${info}"/>
felix@3283:                         </column>
felix@3283:                       </dc:elements>
felix@3283:                     </dc:context>
felix@3283:                   </official>
felix@3283:                 </dc:elements>
felix@3283:               </dc:context>
felix@3283:             </officiallines>
felix@3283:         </dc:macro>
felix@3283: 
felix@2751:         <dc:macro name="basedata_4_heightmarks-points-relative_points">
felix@2751:           <heightmarks>
felix@2751:             <dc:context>
felix@2751:               <dc:statement>
felix@2751:                 SELECT id          AS prot_id,
felix@2751:                        description AS prot_description
felix@2751:                 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
felix@2751:               </dc:statement>
felix@2751:               <dc:elements>
felix@2751:                 <relativepoint>
felix@2751:                   <dc:attribute name="name" value="${prot_description}"/>
felix@2751:                   <dc:context>
felix@2751:                     <dc:statement>
felix@2751:                       SELECT id       AS prot_column_id,
felix@2751:                              name     AS prot_column_name,
felix@3570:                              position AS prot_rel_pos,
felix@3570:                              description AS info
felix@2751:                       FROM wst_columns WHERE wst_id = ${prot_id}
felix@2751:                       ORDER by position
felix@2751:                     </dc:statement>
felix@2751:                     <dc:elements>
felix@2751:                       <column>
felix@2751:                         <dc:attribute name="name" value="${prot_column_name}"/>
felix@2751:                         <dc:attribute name="ids" value="heightmarks_points-wstv-${prot_rel_pos}-${prot_id}"/>
felix@2751:                         <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                         <dc:attribute name="info" value="${info}"/>
felix@2751:                       </column>
felix@2751:                     </dc:elements>
felix@2751:                   </dc:context>
felix@2751:                 </relativepoint>
felix@2751:               </dc:elements>
felix@2751:             </dc:context>
felix@2751:           </heightmarks>
felix@2751:         </dc:macro>
felix@2751: 
felix@1869:         <dc:macro name="basedata_4_heightmarks-points">
felix@1869:           <heightmarks>
felix@1869:             <dc:context>
felix@1869:               <dc:statement>
felix@1869:                 SELECT id          AS prot_id,
felix@1869:                        description AS prot_description
felix@1869:                 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
felix@1869:               </dc:statement>
felix@1869:               <dc:elements>
felix@1869:                 <heightmark>
felix@1869:                   <dc:attribute name="name" value="${prot_description}"/>
felix@1869:                   <dc:context>
felix@1869:                     <dc:statement>
felix@1869:                       SELECT id       AS prot_column_id,
felix@1869:                              name     AS prot_column_name,
felix@3570:                              position AS prot_rel_pos,
felix@3570:                              description AS info
felix@1869:                       FROM wst_columns WHERE wst_id = ${prot_id}
felix@1869:                       ORDER by position
felix@1869:                     </dc:statement>
felix@1869:                     <dc:elements>
felix@1869:                       <column>
felix@1869:                         <dc:attribute name="name" value="${prot_column_name}"/>
felix@1869:                         <dc:attribute name="ids" value="heightmarks_points-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1869:                         <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                         <dc:attribute name="info" value="${info}"/>
felix@1869:                       </column>
felix@1869:                     </dc:elements>
felix@1869:                   </dc:context>
felix@1869:                 </heightmark>
felix@1869:               </dc:elements>
felix@1869:             </dc:context>
felix@1869:           </heightmarks>
felix@1869:         </dc:macro>
felix@1978: 
felix@1916:         <dc:macro name="basedata_4_heightmarks-wq">
felix@1916:           <heightmarks>
felix@1916:             <dc:context>
felix@1916:               <dc:statement>
felix@1916:                 SELECT id          AS prot_id,
felix@1916:                        description AS prot_description
felix@1916:                 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
felix@1916:               </dc:statement>
felix@1916:               <dc:elements>
felix@1916:                 <heightmark>
felix@1916:                   <dc:attribute name="name" value="${prot_description}"/>
felix@1916:                   <dc:context>
felix@1916:                     <dc:statement>
felix@1916:                       SELECT id       AS prot_column_id,
felix@1916:                              name     AS prot_column_name,
felix@3570:                              position AS prot_rel_pos,
felix@3570:                              description AS info
felix@1916:                       FROM wst_columns WHERE wst_id = ${prot_id}
felix@1916:                       ORDER by position
felix@1916:                     </dc:statement>
felix@1916:                     <dc:elements>
felix@1916:                       <column>
felix@1916:                         <dc:attribute name="name" value="${prot_column_name}"/>
felix@1916:                         <dc:attribute name="ids" value="heightmarks_annotations-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1916:                         <dc:attribute name="factory" value="wqinterpol"/>
felix@3570:                         <dc:attribute name="info" value="${info}"/>
felix@1916:                       </column>
felix@1916:                     </dc:elements>
felix@1916:                   </dc:context>
felix@1916:                 </heightmark>
felix@1916:               </dc:elements>
felix@1916:             </dc:context>
felix@1916:           </heightmarks>
felix@1916:         </dc:macro>
felix@1869: 
felix@2751:         <dc:macro name="basedata_5_flood-protections_relative_points">
felix@2751:           <flood_protections>
felix@2751:             <dc:attribute name="id" value="flood-protections-${river_id}"/>
felix@2751:             <dc:context>
felix@2751:               <dc:statement>
felix@2751:                 SELECT id          AS prot_id,
felix@2751:                        description AS prot_description
felix@2751:                 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
felix@2751:               </dc:statement>
felix@2751:               <dc:elements>
felix@2751:                 <relativepoint>
felix@2751:                   <dc:attribute name="name" value="${prot_description}"/>
felix@2751:                   <dc:attribute name="db-id" value="${prot_id}"/>
felix@2751:                   <dc:attribute name="factory" value="staticwkms"/>
felix@2751:                   <columns>
felix@2751:                     <dc:context>
felix@2751:                       <dc:statement>
felix@2751:                         SELECT id       AS prot_column_id,
felix@2751:                                name     AS prot_column_name,
felix@3570:                                position AS prot_rel_pos,
felix@3570:                                description AS info
felix@2751:                         FROM wst_columns WHERE wst_id = ${prot_id}
felix@2751:                         ORDER by position
felix@2751:                       </dc:statement>
felix@2751:                       <dc:elements>
felix@2751:                         <column>
felix@2751:                           <dc:attribute name="name" value="${prot_column_name}"/>
felix@2751:                           <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/>
felix@2751:                           <dc:attribute name="factory" value="staticwkms"/>
felix@3570:                           <dc:attribute name="info" value="${info}"/>
felix@2751:                         </column>
felix@2751:                       </dc:elements>
felix@2751:                     </dc:context>
felix@2751:                   </columns>
felix@2751:                 </relativepoint>
felix@2751:               </dc:elements>
felix@2751:             </dc:context>
felix@2751:           </flood_protections>
felix@2751:         </dc:macro>
felix@2751: 
felix@1905:         <dc:macro name="basedata_5_flood-protections">
felix@2086:           <flood_protections>
felix@1905:             <dc:attribute name="id" value="flood-protections-${river_id}"/>
felix@1905:             <dc:context>
felix@1905:               <dc:statement>
felix@1905:                 SELECT id          AS prot_id,
felix@1905:                        description AS prot_description
felix@1905:                 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
felix@1905:               </dc:statement>
felix@1905:               <dc:elements>
felix@2086:                 <flood_protection>
felix@1905:                   <dc:attribute name="name" value="${prot_description}"/>
felix@1905:                   <dc:attribute name="db-id" value="${prot_id}"/>
felix@1905:                   <dc:attribute name="factory" value="staticwkms"/>
felix@1905:                   <columns>
felix@1905:                     <dc:context>
felix@1905:                       <dc:statement>
felix@1905:                         SELECT id       AS prot_column_id,
felix@1905:                                name     AS prot_column_name,
felix@1905:                                position AS prot_rel_pos
felix@1905:                         FROM wst_columns WHERE wst_id = ${prot_id}
felix@1905:                         ORDER by position
felix@1905:                       </dc:statement>
felix@1905:                       <dc:elements>
felix@1905:                         <column>
felix@1905:                           <dc:attribute name="name" value="${prot_column_name}"/>
felix@1905:                           <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/>
felix@1905:                           <dc:attribute name="factory" value="staticwkms"/>
felix@1905:                         </column>
felix@1905:                       </dc:elements>
felix@1905:                     </dc:context>
felix@1905:                   </columns>
felix@2086:                 </flood_protection>
felix@1905:               </dc:elements>
felix@1905:             </dc:context>
felix@2086:           </flood_protections>
felix@1905:         </dc:macro>
felix@1905: 
felix@1851:         <dc:macro name="mainvalues">
felix@1851:           <mainvalue>
felix@1851:             <dc:attribute name="factory" value="mainvalue"/>
felix@1851:             <dc:attribute name="ids"     value="${river_id}"/>
felix@1851:           </mainvalue>
felix@1851:         </dc:macro>
felix@1865: 
felix@3574:         <dc:macro name="qsectors">
felix@3574:           <qsector>
felix@3574:             <dc:attribute name="factory" value="qsectors"/>
felix@3574:             <dc:attribute name="ids"     value="${river_id}"/>
felix@3574:           </qsector>
felix@3574:         </dc:macro>
felix@3574: 
felix@1865:         <dc:macro name="annotations">
felix@1865:           <annotation>
felix@1865:             <dc:attribute name="factory" value="annotations"/>
felix@1865:             <dc:attribute name="ids"     value="${river_id}"/>
felix@1865:           </annotation>
felix@1865:         </dc:macro>
felix@1865: 
felix@1978:         <dc:macro name="cross_sections">
felix@2324:           <cross_sections>
felix@1978:             <dc:attribute name="id" value="flood-protections-${river_id}"/>
felix@1978:             <dc:context>
felix@1978:               <dc:statement>
felix@1978:                 SELECT id          AS prot_id,
felix@1978:                        description AS prot_description
felix@1978:                 FROM cross_sections WHERE river_id = ${river_id}
felix@1978:               </dc:statement>
felix@1978:               <dc:elements>
felix@2324:                 <cross_section>
felix@1978:                   <dc:attribute name="name" value="${prot_description}"/>
felix@1978:                   <dc:attribute name="ids" value="${prot_id}"/>
felix@1978:                   <dc:attribute name="factory" value="crosssections"/>
felix@2324:                 </cross_section>
felix@1978:               </dc:elements>
felix@1978:             </dc:context>
felix@2324:           </cross_sections>
felix@1978:         </dc:macro>
felix@1978: 
felix@2140:         <dc:macro name="hyks">
felix@2140:           <hyks>
felix@2140:             <dc:attribute name="id" value="hyk-${river_id}"/>
felix@2140:             <dc:context>
felix@2140:               <dc:statement>
felix@2140:                 SELECT id          AS hyk_id,
felix@2140:                        description AS hyk_description
felix@2140:                 FROM hyks WHERE river_id = ${river_id}
felix@2140:               </dc:statement>
felix@2140:               <dc:elements>
felix@2140:                 <hyk>
felix@2140:                   <dc:attribute name="name" value="${hyk_description}"/>
felix@2140:                   <dc:attribute name="ids" value="${hyk_id}"/>
felix@2140:                   <dc:attribute name="factory" value="hyk"/>
felix@2140:                 </hyk>
felix@2140:               </dc:elements>
felix@2140:             </dc:context>
felix@2140:           </hyks>
felix@2140:         </dc:macro>
felix@1869: 
felix@1869:         <dc:comment>
felix@1869: 
felix@1869:         + River-Node
felix@1869: 
felix@1869:         </dc:comment>
felix@1869: 
ingo@1181:         <river>
ingo@1181:           <dc:attribute name="name" value="${river_name}"/>
felix@1865: 
felix@1865:           <dc:choose>
felix@1865:             <dc:when test="dc:contains($parameters, 'recommended')">
felix@1865:                <dc:comment>
felix@2101:                   Recommendations (client shall load immediately).
felix@1865:                </dc:comment>
felix@1865:                <dc:if test="dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))">
felix@2101:                  <dc:call-macro name="annotations"/>
felix@1865:                </dc:if>
felix@1978:                <dc:if test="dc:contains($artifact-outs, 'cross_section')">
felix@1978:                  <dc:call-macro name="cross_sections"/>
felix@2140:                  <dc:call-macro name="hyks"/>
felix@1978:                </dc:if>
felix@2721:                <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
felix@2721:                  <dc:call-macro name="annotations"/>
felix@2770:                  <dc:call-macro name="mainvalues"/>
felix@2721:                </dc:if>
felix@3574:                <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
felix@3574:                  <dc:call-macro name="qsectors"/>
felix@3574:                </dc:if>
felix@3579:                <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
felix@3579:                  <dc:call-macro name="annotations"/>
felix@3579:                </dc:if>
felix@1865:             </dc:when>
felix@1865:             <dc:otherwise>
felix@1869:               <dc:comment>
felix@1869:                  Non - Recommendations.
felix@1869:               </dc:comment>
felix@1869:               <dc:if test="dc:contains($artifact-outs, 'cross_section')">
felix@2101:                  <dc:call-macro name="basedata_0"/>
felix@2101:                  <dc:call-macro name="basedata_1_additionals"/>
felix@2736:                  <dc:call-macro name="basedata_2_fixations"/>
felix@3570:                  <dc:call-macro name="basedata_3_officials"/>
felix@2736:                  <dc:call-macro name="basedata_4_heightmarks-points"/>
raimund@2153:                  <dc:call-macro name="cross_sections"/>
felix@2689:                  <dc:call-macro name="hyks"/>
felix@1869:               </dc:if>
felix@1869:               <dc:if test="dc:contains($artifact-outs, 'discharge_longitudinal_section')">
felix@1869:                  <dc:call-macro name="basedata_0"/>
felix@2732:                  <dc:call-macro name="basedata_1_additionals"/>
felix@2732:                  <dc:call-macro name="basedata_2_fixations"/>
felix@3314:                  <dc:call-macro name="basedata_3_officials"/>
felix@1869:                  <dc:call-macro name="basedata_4_heightmarks-points"/>
felix@2732:                  <dc:call-macro name="basedata_5_flood-protections"/>
felix@1869:               </dc:if>
felix@3627:               <!--dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
felix@1916:                  <dc:call-macro name="basedata_0_wq"/>
felix@1916:                  <dc:call-macro name="basedata_4_heightmarks-wq"/>
felix@3627:               </dc:if-->
felix@1869:               <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences'))">
felix@1869:                  <dc:call-macro name="basedata_0"/>
felix@1869:                  <dc:call-macro name="basedata_1_additionals"/>
felix@1869:                  <dc:comment comment=" FIXATIONS ---------------------------"/>
felix@1869:                  <dc:call-macro name="basedata_2_fixations"/>
felix@1869:                  <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
felix@1869:                  <dc:call-macro name="basedata_4_heightmarks-points"/>
felix@3283:                  <dc:comment comment=" AMTL LINIEN  ---------------------------"/>
felix@3283:                  <dc:call-macro name="basedata_3_officials"/>
felix@2101:                  <dc:call-macro name="annotations"/>
felix@1869:               </dc:if>
felix@2721:                <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
felix@2721:                  <dc:call-macro name="annotations"/>
felix@2761:                  <!--dc:call-macro name="basedata_0"/-->
felix@2761:                  <dc:call-macro name="basedata_1_additionals-relative_point"/>
felix@2721:                  <dc:comment comment=" FIXATIONS ---------------------------"/>
felix@2755:                  <dc:call-macro name="basedata_2_fixations_relative_point"/>
felix@2721:                  <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
felix@2761:                  <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
felix@2761:                  <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
felix@2721:                </dc:if>
felix@3579:                <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
felix@3585:                  <dc:call-macro name="basedata_0_wq"/>
felix@3579:                  <dc:call-macro name="basedata_1_additionals"/>
felix@3587:                  <dc:call-macro name="basedata_2_fixations"/>
felix@3587:                  <dc:call-macro name="basedata_3_officials"/>
felix@3587:                  <dc:call-macro name="basedata_4_heightmarks-points"/>
felix@3587:                  <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
felix@3579:                </dc:if>
felix@3585:                <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
felix@3585:                </dc:if>
felix@3579:                <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
felix@3579:                  <dc:call-macro name="annotations"/>
felix@3579:                </dc:if>
felix@1869:              <dc:comment comment="--- non-recommendations---"/>
felix@1865:             </dc:otherwise>
felix@1865:           </dc:choose>
felix@1872: 
felix@1764: 
felix@1728:           <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
felix@1905: 
felix@1875:             <!-- base data -->
felix@1875:             <dc:call-macro name="basedata_0"/>
felix@1905: 
felix@1905:             <!-- extra-longitudinal-sections -->
felix@1875:             <dc:call-macro name="basedata_1_additionals"/>
felix@1875: 
felix@1875:             <!-- fixations -->
felix@1875:             <dc:call-macro name="basedata_2_fixations"/>
felix@1875: 
felix@1875:             <!-- flood water marks-->
felix@1875:             <dc:call-macro name="basedata_4_heightmarks-points"/>
felix@1905: 
felix@1905:             <!-- flood protection -->
felix@1905:             <dc:call-macro name="basedata_5_flood-protections"/>
felix@1905: 
felix@1728:           </dc:if>
felix@1905:           <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and (dc:contains($parameters, 'recommended'))">
felix@1905:                 <!--dc:call-macro name="basedata_2_fixations_wst"/-->
felix@1905:           </dc:if>
felix@1905: 
felix@1773:           <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and not (dc:contains($parameters, 'recommended'))">
felix@2324:               <discharge_table_nn>
felix@2324:                 <discharge_table_gauge>
ingo@1181:                   <dc:context>
ingo@1181:                     <dc:statement>
ingo@1181:                       SELECT id   AS gauge_id,
ingo@1181:                              name AS gauge_name
ingo@1181:                       FROM gauges WHERE river_id = ${river_id}
ingo@1181:                     </dc:statement>
ingo@1181:                     <dc:elements>
ingo@1181:                       <gauge>
ingo@1181:                         <dc:attribute name="name" value="${gauge_name}"/>
ingo@1181:                         <dc:attribute name="db-id" value="${gauge_id}"/>
felix@3051:                         <dc:attribute name="factory" value="gaugedischarge"/>
felix@3051:                         <dc:attribute name="from" value="${g_start}"/>
felix@3051:                         <dc:attribute name="to" value="${g_stop}"/>
felix@3051:                         <dc:attribute name="ids" value="${gauge_name}"/>
felix@3051:                       </gauge>
felix@3051:                       <!--
felix@3051:                       <gauge>
felix@3051:                         <dc:attribute name="name" value="${gauge_name}"/>
felix@3051:                         <dc:attribute name="db-id" value="${gauge_id}"/>
ingo@1181:                         <dc:context>
ingo@1181:                           <dc:statement>
sascha@3219:                             SELECT description   AS gauge_desc,
ingo@1181:                                    d.id          AS discharge_id,
sascha@3219:                                    ti.start_time AS g_start,
ingo@1181:                                    ti.stop_time  AS g_stop
sascha@3219:                             FROM discharge_tables d JOIN time_intervals ti
ingo@1181:                             ON d.time_interval_id = ti.id
ingo@1181:                             WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
ingo@1181:                           </dc:statement>
ingo@1181:                           <dc:elements>
ingo@1181:                             <historical>
ingo@1181:                               <dc:attribute name="name" value="${gauge_desc}"/>
felix@2732:                               <dc:attribute name="factory" value="gaugedischarge"/>
ingo@1181:                               <dc:attribute name="from" value="${g_start}"/>
ingo@1181:                               <dc:attribute name="to" value="${g_stop}"/>
felix@2732:                               <dc:attribute name="ids" value="${discharge_id}-${g_start}-${g_stop}"/>
felix@2732:                             </historical>
ingo@1181:                           </dc:elements>
ingo@1181:                         </dc:context>
ingo@1181:                       </gauge>
felix@3051:                       -->
ingo@1181:                     </dc:elements>
ingo@1181:                   </dc:context>
felix@2324:                 </discharge_table_gauge>
felix@1872: 
felix@2324:               </discharge_table_nn>
felix@1905: 
felix@1905:             <dc:call-macro name="basedata_2_fixations_wst"/>
felix@1905: 
felix@1905:             <dc:call-macro name="basedata_5_flood-protections"/>
felix@1905: 
felix@1905:             <!-- former waterlevels -->
felix@1905:             <dc:call-macro name="basedata_0"/>
felix@1905: 
felix@1905:             <dc:call-macro name="basedata_1_additionals"/>
felix@1905: 
felix@1905:             <!-- former flood-water-marks -->
felix@1905:             <dc:call-macro name="basedata_4_heightmarks-points"/>
felix@2324:               <computed_discharge_curve>
felix@1851:                 <dc:call-macro name="mainvalues"/>
felix@2324:               </computed_discharge_curve>
ingo@1181:           </dc:if>
felix@1905: 
felix@1851:           <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
felix@2717:             <dc:choose>
felix@2717:                 <dc:when test="dc:contains($parameters, 'recommended')">
felix@2717:                   <dc:call-macro name="mainvalues"/>
felix@2717:                 </dc:when>
felix@2717:                 <dc:otherwise>
felix@2717:                   <dc:call-macro name="mainvalues"/>
felix@2749:                   <dc:call-macro name="basedata_2_fixations_relative_point"/>
felix@2751:                   <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
felix@2751:                   <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
felix@2717:                 </dc:otherwise>
felix@2717:             </dc:choose>
felix@1851:           </dc:if>
felix@1872: 
felix@3592:           <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve') and not (dc:contains($parameters, 'recommended'))">
felix@3585:               <discharge_table_nn>
felix@3585:                 <discharge_table_gauge>
felix@3585:                   <dc:context>
felix@3585:                     <dc:statement>
felix@3585:                       SELECT id   AS gauge_id,
felix@3585:                              name AS gauge_name
felix@3585:                       FROM gauges WHERE river_id = ${river_id}
felix@3585:                     </dc:statement>
felix@3585:                     <dc:elements>
felix@3585:                       <gauge>
felix@3585:                         <dc:attribute name="name" value="${gauge_name}"/>
felix@3585:                         <dc:attribute name="db-id" value="${gauge_id}"/>
felix@3585:                         <dc:attribute name="factory" value="gaugedischarge"/>
felix@3585:                         <dc:attribute name="from" value="${g_start}"/>
felix@3585:                         <dc:attribute name="to" value="${g_stop}"/>
felix@3585:                         <dc:attribute name="ids" value="${gauge_name}"/>
felix@3585:                       </gauge>
felix@3585:                     </dc:elements>
felix@3585:                   </dc:context>
felix@3585:                 </discharge_table_gauge>
felix@3585:               </discharge_table_nn>
felix@3585:           </dc:if>
felix@3585: 
ingo@1181:           <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
felix@3570: 
felix@2106:               <longitudinal_section>
felix@1865:                 <dc:call-macro name="annotations"/>
felix@2106:               </longitudinal_section>
ingo@1181:           </dc:if>
raimund@2100:           <dc:if test="dc:contains($artifact-outs, 'map')">
raimund@2100:               <map>
raimund@2100:               <dc:choose>
raimund@2100:                   <dc:when test="dc:contains($parameters, 'recommended')">
raimund@2100:                   </dc:when>
raimund@2100:                   <dc:otherwise>
raimund@2100:                       <dc:call-macro name="flood-map-complete"/>
raimund@2100:                   </dc:otherwise>
raimund@2100:               </dc:choose>
raimund@2100:               </map>
raimund@2100:           </dc:if>
ingo@1181:           <dc:if test="dc:contains($artifact-outs, 'floodmap')">
ingo@1181:               <floodmap>
ingo@1181:               <dc:choose>
ingo@1181:                   <dc:when test="dc:contains($parameters, 'recommended')">
ingo@1181:                     <dc:call-macro name="flood-map-recommended"/>
ingo@1181:                   </dc:when>
ingo@1185:                   <dc:when test="dc:contains($parameters, 'dem')">
ingo@1185:                     <dc:call-macro name="flood-map-dem"/>
ingo@1185:                   </dc:when>
ingo@1181:                   <dc:otherwise>
ingo@1181:                     <dc:call-macro name="flood-map-complete"/>
ingo@1181:                   </dc:otherwise>
ingo@1181:               </dc:choose>
ingo@1181:               </floodmap>
ingo@1181:               <dc:macro name="flood-map-recommended">
ingo@1181:                 <dc:comment>
ingo@1181:                    FIXME: Following two macros look identical to me.
ingo@1181:                 </dc:comment>
ingo@1181:                   <kilometrage>
ingo@1181:                       <riveraxis>
ingo@1181:                           <dc:attribute name="factory" value="riveraxis"/>
ingo@1181:                           <dc:attribute name="ids" value="${river_id}"/>
ingo@1181:                       </riveraxis>
ingo@1181:                   </kilometrage>
ingo@1181:                   <rastermap>
ingo@1181:                       <background>
ingo@1181:                           <dc:attribute name="factory" value="wmsbackground"/>
ingo@1181:                           <dc:attribute name="ids" value="${river_id}"/>
ingo@1181:                       </background>
ingo@1181:                   </rastermap>
ingo@1181:               </dc:macro>
ingo@1185:               <dc:macro name="flood-map-dem">
ingo@1185:                 <dems>
ingo@1185:                   <dc:context>
ingo@1185:                     <dc:statement>
ingo@1185:                       SELECT id    AS dem_id,
ingo@1185:                              lower AS dem_lower,
ingo@1185:                              upper AS dem_upper
ingo@1185:                       FROM dem WHERE river_id = ${river_id}
ingo@1185:                     </dc:statement>
ingo@1185:                     <dc:elements>
ingo@1186:                         <dem>
ingo@1186:                           <dc:attribute name="factory" value="demfactory"/>
ingo@1186:                           <dc:attribute name="ids" value="${dem_id}"/>
ingo@1186:                           <dc:attribute name="description" value="${dem_lower}-${dem_upper}"/>
ingo@1186:                         </dem>
ingo@1185:                     </dc:elements>
ingo@1185:                   </dc:context>
ingo@1185:                 </dems>
ingo@1185:               </dc:macro>
ingo@1805:               <dc:macro name="flood-map-km">
ingo@1805:                 <dc:context>
ingo@1805:                   <dc:statement>
ingo@1805:                     SELECT count(*) as km_exists
ingo@1805:                     FROM river_axes_km WHERE river_id = ${river_id}
ingo@1805:                   </dc:statement>
ingo@1805:                    <dc:elements>
ingo@1805:                     <dc:if test="$km_exists>0">
ingo@1805:                       <km>
ingo@1805:                         <dc:attribute name="factory" value="wmskmfactory"/>
ingo@1805:                         <dc:attribute name="ids" value="${river_id}"/>
ingo@1805:                       </km>
ingo@1805:                     </dc:if>
ingo@1805:                   </dc:elements>
ingo@1805:                 </dc:context>
ingo@1805:               </dc:macro>
ingo@1836:               <dc:macro name="flood-map-qps">
ingo@1836:                 <dc:context>
ingo@1836:                   <dc:statement>
ingo@1836:                     SELECT count(*) as km_exists
ingo@1836:                     FROM cross_section_tracks WHERE river_id = ${river_id}
ingo@1836:                   </dc:statement>
ingo@1836:                    <dc:elements>
ingo@1836:                     <dc:if test="$km_exists>0">
ingo@1836:                       <qps>
ingo@1836:                         <dc:attribute name="factory" value="wmsqpsfactory"/>
ingo@1836:                         <dc:attribute name="ids" value="${river_id}"/>
ingo@1836:                       </qps>
ingo@1836:                     </dc:if>
ingo@1836:                   </dc:elements>
ingo@1836:                 </dc:context>
ingo@1836:               </dc:macro>
ingo@1855:               <dc:macro name="flood-map-hws">
ingo@1855:                 <dc:context>
ingo@1855:                   <dc:statement>
ingo@2672:                     SELECT count(*) as km_exists, name as name
ingo@2672:                     FROM hws WHERE river_id = ${river_id} GROUP BY name
ingo@1855:                   </dc:statement>
ingo@1855:                    <dc:elements>
ingo@1855:                     <dc:if test="$km_exists>0">
ingo@1855:                       <hws>
ingo@1855:                         <dc:attribute name="factory" value="wmshwsfactory"/>
ingo@2672:                         <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2672:                         <dc:attribute name="name" value="${name}"/>
ingo@1855:                       </hws>
ingo@1855:                     </dc:if>
ingo@1855:                   </dc:elements>
ingo@1855:                 </dc:context>
ingo@1855:               </dc:macro>
ingo@2683:               <dc:macro name="flood-map-hydr-boundaries">
ingo@2683:                 <hydr_boundaries_lines>
ingo@2683:                   <dc:call-macro name="flood-map-hydr-boundaries-lines"/>
ingo@2683:                 </hydr_boundaries_lines>
ingo@2683:                 <hydr_boundaries_polygons>
ingo@2683:                   <dc:call-macro name="flood-map-hydr-boundaries-poly"/>
ingo@2683:                 </hydr_boundaries_polygons>
ingo@2683:               </dc:macro>
ingo@2683:               <dc:macro name="flood-map-hydr-boundaries-lines">
ingo@2683:                 <bfg>
ingo@2683:                   <dc:context>
ingo@2683:                     <dc:statement>
ingo@2683:                       SELECT count(*) as km_exists, name as name
ingo@2683:                       FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 1 GROUP BY name
ingo@2683:                     </dc:statement>
ingo@2683:                      <dc:elements>
ingo@2683:                       <dc:if test="$km_exists>0">
ingo@2683:                         <hydrboundary>
ingo@2683:                           <dc:attribute name="factory" value="wmshydrboundariesfactory"/>
ingo@2683:                           <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2683:                           <dc:attribute name="name" value="${name}"/>
ingo@2683:                         </hydrboundary>
ingo@2683:                       </dc:if>
ingo@2683:                     </dc:elements>
ingo@2683:                   </dc:context>
ingo@2683:                 </bfg>
ingo@2683:                 <land>
ingo@2683:                   <dc:context>
ingo@2683:                     <dc:statement>
ingo@2683:                       SELECT count(*) as km_exists, name as name
ingo@2683:                       FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 2 GROUP BY name
ingo@2683:                     </dc:statement>
ingo@2683:                      <dc:elements>
ingo@2683:                       <dc:if test="$km_exists>0">
ingo@2683:                         <hydrboundary>
ingo@2683:                           <dc:attribute name="factory" value="wmshydrboundariesfactory"/>
ingo@2683:                           <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2683:                           <dc:attribute name="name" value="${name}"/>
ingo@2683:                         </hydrboundary>
ingo@2683:                       </dc:if>
ingo@2683:                     </dc:elements>
ingo@2683:                   </dc:context>
ingo@2683:                 </land>
ingo@2683:               </dc:macro>
ingo@2683:               <dc:macro name="flood-map-hydr-boundaries-poly">
ingo@2683:                 <bfg>
ingo@2683:                   <dc:context>
ingo@2683:                     <dc:statement>
ingo@2683:                       SELECT count(*) as km_exists, name as name
ingo@2683:                       FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 1 GROUP BY name
ingo@2683:                     </dc:statement>
ingo@2683:                      <dc:elements>
ingo@2683:                       <dc:if test="$km_exists>0">
ingo@2683:                         <hws>
ingo@2683:                           <dc:attribute name="factory" value="wmshydrboundariespolyfactory"/>
ingo@2683:                           <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2683:                           <dc:attribute name="name" value="${name}"/>
ingo@2683:                         </hws>
ingo@2683:                       </dc:if>
ingo@2683:                     </dc:elements>
ingo@2683:                   </dc:context>
ingo@2683:                 </bfg>
ingo@2683:                 <land>
ingo@2683:                   <dc:context>
ingo@2683:                     <dc:statement>
ingo@2683:                       SELECT count(*) as km_exists, name as name
ingo@2683:                       FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 2 GROUP BY name
ingo@2683:                     </dc:statement>
ingo@2683:                      <dc:elements>
ingo@2683:                       <dc:if test="$km_exists>0">
ingo@2683:                         <hws>
ingo@2683:                           <dc:attribute name="factory" value="wmshydrboundariespolyfactory"/>
ingo@2683:                           <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2683:                           <dc:attribute name="name" value="${name}"/>
ingo@2683:                         </hws>
ingo@2683:                       </dc:if>
ingo@2683:                     </dc:elements>
ingo@2683:                   </dc:context>
ingo@2683:                 </land>
ingo@2683:               </dc:macro>
ingo@1856:               <dc:macro name="flood-map-catchments">
ingo@1856:                 <dc:context>
ingo@1856:                   <dc:statement>
ingo@2671:                     SELECT count(*) as km_exists, name as name
ingo@2671:                     FROM catchment WHERE river_id = ${river_id} GROUP BY name
ingo@1856:                   </dc:statement>
ingo@1856:                    <dc:elements>
ingo@1856:                     <dc:if test="$km_exists>0">
ingo@2683:                       <catchment>
ingo@1856:                         <dc:attribute name="factory" value="wmscatchmentfactory"/>
ingo@2671:                         <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2671:                         <dc:attribute name="name" value="${name}"/>
ingo@2683:                       </catchment>
ingo@1856:                     </dc:if>
ingo@1856:                   </dc:elements>
ingo@1856:                 </dc:context>
ingo@1856:               </dc:macro>
ingo@1857:               <dc:macro name="flood-map-floodplain">
ingo@1857:                 <dc:context>
ingo@1857:                   <dc:statement>
ingo@1857:                     SELECT count(*) as km_exists
ingo@1857:                     FROM floodplain WHERE river_id = ${river_id}
ingo@1857:                   </dc:statement>
ingo@1857:                    <dc:elements>
ingo@1857:                     <dc:if test="$km_exists>0">
ingo@1857:                       <floodplain>
ingo@1857:                         <dc:attribute name="factory" value="wmsfloodplainfactory"/>
ingo@1857:                         <dc:attribute name="ids" value="${river_id}"/>
ingo@1857:                       </floodplain>
ingo@1857:                     </dc:if>
ingo@1857:                   </dc:elements>
ingo@1857:                 </dc:context>
ingo@1857:               </dc:macro>
ingo@1870:               <dc:macro name="flood-map-lines">
ingo@1870:                 <dc:context>
ingo@1870:                   <dc:statement>
ingo@2683:                     SELECT count(*) as km_exists, name as name
ingo@2683:                     FROM lines WHERE river_id = ${river_id} GROUP BY name
ingo@1870:                   </dc:statement>
ingo@1870:                    <dc:elements>
ingo@1870:                     <dc:if test="$km_exists>0">
ingo@2683:                       <line>
ingo@1870:                         <dc:attribute name="factory" value="wmslinefactory"/>
ingo@2683:                         <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2683:                         <dc:attribute name="name" value="${name}"/>
ingo@2683:                       </line>
ingo@1870:                     </dc:if>
ingo@1870:                   </dc:elements>
ingo@1870:                 </dc:context>
ingo@1870:               </dc:macro>
ingo@1871:               <dc:macro name="flood-map-buildings">
ingo@1871:                 <dc:context>
ingo@1871:                   <dc:statement>
ingo@2683:                     SELECT count(*) as km_exists, name as name
ingo@2683:                     FROM buildings WHERE river_id = ${river_id} GROUP BY name
ingo@1871:                   </dc:statement>
ingo@1871:                    <dc:elements>
ingo@1871:                     <dc:if test="$km_exists>0">
ingo@2683:                       <building>
ingo@1871:                         <dc:attribute name="factory" value="wmsbuildingsfactory"/>
ingo@2683:                         <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2683:                         <dc:attribute name="name" value="${name}"/>
ingo@2683:                       </building>
ingo@1871:                     </dc:if>
ingo@1871:                   </dc:elements>
ingo@1871:                 </dc:context>
ingo@1871:               </dc:macro>
ingo@1873:               <dc:macro name="flood-map-fixpoints">
ingo@1873:                 <dc:context>
ingo@1873:                   <dc:statement>
ingo@2683:                     SELECT count(*) as km_exists, name as name
ingo@2683:                     FROM fixpoints WHERE river_id = ${river_id} GROUP BY name
ingo@1873:                   </dc:statement>
ingo@1873:                    <dc:elements>
ingo@1873:                     <dc:if test="$km_exists>0">
ingo@2683:                       <fixpoint>
ingo@1873:                         <dc:attribute name="factory" value="wmsfixpointsfactory"/>
ingo@2683:                         <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2683:                         <dc:attribute name="name"  value="${name}"/>
ingo@2683:                       </fixpoint>
ingo@1873:                     </dc:if>
ingo@1873:                   </dc:elements>
ingo@1873:                 </dc:context>
ingo@1873:               </dc:macro>
ingo@2684:               <dc:macro name="flood-map-gaugelocations">
ingo@2684:                 <dc:context>
ingo@2684:                   <dc:statement>
ingo@2684:                     SELECT count(*) as km_exists, name as name
ingo@2684:                     FROM gauge_location WHERE river_id = ${river_id} GROUP BY name
ingo@2684:                   </dc:statement>
ingo@2684:                    <dc:elements>
ingo@2684:                     <dc:if test="$km_exists>0">
ingo@2684:                       <gaugelocation>
ingo@2684:                         <dc:attribute name="factory" value="wmsgaugelocationfactory"/>
ingo@2684:                         <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2684:                         <dc:attribute name="name"  value="${name}"/>
ingo@2684:                       </gaugelocation>
ingo@2684:                     </dc:if>
ingo@2684:                   </dc:elements>
ingo@2684:                 </dc:context>
ingo@2684:               </dc:macro>
ingo@2580:               <dc:macro name="flood-map-uesk">
ingo@2580:                 <uesk>
ingo@2580:                   <calculations>
ingo@2580:                     <current>
ingo@2582:                       <bfg>
ingo@2582:                         <dc:context>
ingo@2582:                           <dc:statement>
ingo@2582:                               SELECT count(*) as uesg_exist, name as name
ingo@2582:                               FROM floodmaps
ingo@2582:                               WHERE river_id = ${river_id} AND kind = 111
ingo@2582:                               GROUP BY name, kind
ingo@2582:                           </dc:statement>
ingo@2582:                           <dc:elements>
ingo@2582:                             <dc:if test="$uesg_exist>0">
ingo@2582:                               <floodmaps>
ingo@2582:                                 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
ingo@2683:                                 <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2582:                                 <dc:attribute name="name" value="${name}"/>
ingo@2582:                               </floodmaps>
ingo@2582:                             </dc:if>
ingo@2582:                           </dc:elements>
ingo@2582:                         </dc:context>
ingo@2582:                       </bfg>
ingo@2582:                       <land>
ingo@2582:                         <dc:context>
ingo@2582:                           <dc:statement>
ingo@2582:                               SELECT count(*) as uesg_exist, name as name
ingo@2582:                               FROM floodmaps
ingo@2582:                               WHERE river_id = ${river_id} AND kind = 112
ingo@2582:                               GROUP BY name, kind
ingo@2582:                           </dc:statement>
ingo@2582:                           <dc:elements>
ingo@2582:                             <dc:if test="$uesg_exist>0">
ingo@2582:                               <floodmaps>
ingo@2582:                                 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
ingo@2683:                                 <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2582:                                 <dc:attribute name="name" value="${name}"/>
ingo@2582:                               </floodmaps>
ingo@2582:                             </dc:if>
ingo@2582:                           </dc:elements>
ingo@2582:                         </dc:context>
ingo@2582:                       </land>
ingo@2580:                     </current>
ingo@2580:                     <potentiel>
ingo@2582:                       <bfg>
ingo@2582:                         <dc:context>
ingo@2582:                           <dc:statement>
ingo@2582:                               SELECT count(*) as uesg_exist, name as name
ingo@2582:                               FROM floodmaps
ingo@2582:                               WHERE river_id = ${river_id} AND kind = 121
ingo@2582:                               GROUP BY name, kind
ingo@2582:                           </dc:statement>
ingo@2582:                           <dc:elements>
ingo@2582:                             <dc:if test="$uesg_exist>0">
ingo@2582:                               <floodmaps>
ingo@2582:                                 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
ingo@2683:                                 <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2582:                                 <dc:attribute name="name" value="${name}"/>
ingo@2582:                               </floodmaps>
ingo@2582:                             </dc:if>
ingo@2582:                           </dc:elements>
ingo@2582:                         </dc:context>
ingo@2582:                       </bfg>
ingo@2582:                       <land>
ingo@2582:                         <dc:context>
ingo@2582:                           <dc:statement>
ingo@2582:                               SELECT count(*) as uesg_exist, name as name
ingo@2582:                               FROM floodmaps
ingo@2582:                               WHERE river_id = ${river_id} AND kind = 122
ingo@2582:                               GROUP BY name, kind
ingo@2582:                           </dc:statement>
ingo@2582:                           <dc:elements>
ingo@2582:                             <dc:if test="$uesg_exist>0">
ingo@2582:                               <floodmaps>
ingo@2582:                                 <dc:attribute name="factory" value="wmsfloodmapsfactory"/>
ingo@2683:                                 <dc:attribute name="ids" value="${river_id};${name}"/>
ingo@2582:                                 <dc:attribute name="name" value="${name}"/>
ingo@2582:                               </floodmaps>
ingo@2582:                             </dc:if>
ingo@2582:                           </dc:elements>
ingo@2582:                         </dc:context>
ingo@2582:                       </land>
ingo@2580:                     </potentiel>
ingo@2580:                   </calculations>
ingo@2580:                 </uesk>
ingo@2580:               </dc:macro>
ingo@1181:               <dc:macro name="flood-map-complete">
ingo@2683:                   <buildings>
ingo@2683:                     <dc:call-macro name="flood-map-buildings"/>
ingo@2683:                   </buildings>
ingo@2683:                   <catchments>
ingo@2683:                     <dc:call-macro name="flood-map-catchments"/>
ingo@2683:                   </catchments>
ingo@2683:                   <fixpoints>
ingo@2683:                     <dc:call-macro name="flood-map-fixpoints"/>
ingo@2683:                   </fixpoints>
ingo@2683:                   <hws>
ingo@2683:                     <dc:call-macro name="flood-map-hws"/>
ingo@2683:                   </hws>
ingo@2683:                   <hydrboundaries>
ingo@2683:                     <dc:call-macro name="flood-map-hydr-boundaries"/>
ingo@2683:                     <dc:call-macro name="flood-map-floodplain"/>
ingo@2683:                   </hydrboundaries>
ingo@1181:                   <kilometrage>
ingo@1181:                       <riveraxis>
ingo@1181:                           <dc:attribute name="factory" value="riveraxis"/>
ingo@1181:                           <dc:attribute name="ids" value="${river_id}"/>
ingo@1181:                       </riveraxis>
ingo@1805:                     <dc:call-macro name="flood-map-km"/>
ingo@1836:                     <dc:call-macro name="flood-map-qps"/>
ingo@2683:                   </kilometrage>
ingo@2683:                   <lines>
ingo@1870:                     <dc:call-macro name="flood-map-lines"/>
ingo@2683:                   </lines>
ingo@2595:                   <dc:call-macro name="flood-map-uesk"/>
ingo@2684:                   <gaugelocations>
ingo@2684:                     <dc:call-macro name="flood-map-gaugelocations"/>
ingo@2684:                   </gaugelocations>
ingo@1181:                   <rastermap>
ingo@1181:                       <background>
ingo@1181:                           <dc:attribute name="factory" value="wmsbackground"/>
ingo@1181:                           <dc:attribute name="ids" value="${river_id}"/>
ingo@1181:                       </background>
ingo@1181:                   </rastermap>
ingo@1181:               </dc:macro>
ingo@1181:           </dc:if>
raimund@3614:           <dc:if test="dc:contains($artifact-outs, 'minfo-heights')">
raimund@3614:             <dc:call-macro name="minfo-heights"/>
raimund@3614:             <dc:macro name="minfo-heights">
raimund@3614:               <bedheights>
raimund@3614:                 <dc:call-macro name="bed-heights-single"/>
raimund@3614:                 <dc:call-macro name="bed-heights-epoch"/>
raimund@3614:               </bedheights>
raimund@3614:             </dc:macro>
raimund@3614:           </dc:if>
raimund@3614:           <dc:if test="dc:contains($artifact-outs, 'minfo-heights-epoch')">
raimund@3614:             <bedheights>
raimund@3614:               <dc:call-macro name="bed-heights-epoch"/>
raimund@3614:             </bedheights>
raimund@3614:           </dc:if>
raimund@3614:           <dc:macro name="bed-heights-single">
raimund@3614:             <single>
raimund@3614:               <dc:context>
raimund@3614:                 <dc:statement>
raimund@3614:                     SELECT id          AS bedh_id,
raimund@3614:                            year        AS bedh_year,
raimund@3614:                            description AS bedh_descr
raimund@3614:                     FROM bed_height_single WHERE river_id = ${river_id}
raimund@3614:                 </dc:statement>
raimund@3614:                 <dc:elements>
raimund@3614:                   <height>
raimund@3614:                     <dc:attribute name="factory" value="bedheight"/>
raimund@3614:                     <dc:attribute name="ids" value="bedheight-single-${bedh_id}-${bedh_year}"/>
raimund@3614:                     <dc:attribute name="description" value="${bedh_descr}"/>
raimund@3614:                   </height>
raimund@3614:                 </dc:elements>
raimund@3614:               </dc:context>
raimund@3614:             </single>
raimund@3614:           </dc:macro>
raimund@3614:           <dc:macro name="bed-heights-epoch">
raimund@3614:             <epoch>
raimund@3614:               <dc:context>
raimund@3614:                 <dc:statement>
raimund@3614:                   SELECT id               AS bedh_id,
raimund@3614:                          time_interval_id AS bedh_interval_id,
raimund@3614:                          description      AS bedh_descr
raimund@3614:                   FROM bed_height_epoch WHERE river_id = ${river_id}
raimund@3614:                 </dc:statement>
raimund@3614:                 <dc:elements>
raimund@3614:                   <height>
raimund@3614:                     <dc:attribute name="factory" value="bedheight"/>
raimund@3614:                     <dc:attribute name="ids" value="bedheight-epoch-${bedh_id}-${bedh_interval_id}"/>
raimund@3614:                     <dc:attribute name="description" value="${bedh_descr}"/>
raimund@3614:                   </height>
raimund@3614:                 </dc:elements>
raimund@3614:               </dc:context>
raimund@3614:             </epoch>
raimund@3614:           </dc:macro>
ingo@1181:         </river>
ingo@1181:       </dc:elements>
ingo@1181:     </dc:context>
ingo@1181:   </dc:macro>
ingo@1181: 
sascha@1046:   <dc:choose>
sascha@1046:     <dc:comment>
sascha@1046:       User specific part
sascha@1046:       ------------------
sascha@1046:     </dc:comment>
sascha@1046:     <dc:when test="dc:contains($parameters, 'user-id')">
felix@1879: 
felix@1905: 
felix@1879:      <old_calculations>
felix@1879:       <dc:context connection="user">
felix@1879:         <dc:comment>
felix@1879:            Get the user and collection-id.
felix@1879:         </dc:comment>
felix@1760:         <dc:statement>
felix@1879:             SELECT u.id AS user_id, c.id AS collection_id, c.name as collection_name
felix@1879:             FROM collections c JOIN users u ON c.user_id = u.id
felix@1879:             WHERE u.gid = CAST(${user-id} AS uuid)
felix@1879:             ORDER BY c.creation DESC
felix@1760:         </dc:statement>
ingo@1657: 
felix@3307:         <!-- OFFICIAL LINES -->
felix@3307:         <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
felix@3307:           <dc:comment comment=".wst -------------------------------"/>
felix@3307:           <officiallines>
felix@3307:             <dc:elements>
felix@3307:                 <dc:context>
felix@3307:                   <dc:statement>
felix@3307:                     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
felix@3307:                     FROM   master_artifacts m, artifact_data ardg, artifact_data arv
felix@3307:                     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'
felix@3307:                     AND EXISTS (
felix@3307:                         SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@3307:                   </dc:statement>
felix@3307:                   <dc:elements>
felix@3307:                       <dc:context connection="system">
felix@3307:                         <dc:statement>
felix@3307:                           SELECT ol.wst_id AS wstid, ol.wst_column_pos AS wstcolpos, ol.name AS olname, ol.value AS oval
felix@3307:                           FROM official_q_values ol
felix@3307:                           WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2)) AND ol.gauge_name = ${gaugy}
felix@3307:                         </dc:statement>
felix@3307:                         <dc:elements>
felix@3307:                           <dc:element name="${olname}">
felix@3307:                             <dc:attribute name="name" value="${olname}"/>
felix@3307:                             <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/>
felix@3307:                             <dc:attribute name="factory" value="staticwkms"/>
felix@3307:                           </dc:element>
felix@3307:                         </dc:elements>
felix@3307:                       </dc:context>
felix@3307:                   </dc:elements>
felix@3307:                 </dc:context>
felix@3307:           </dc:elements>
felix@3307:           </officiallines>
felix@3307:         </dc:if>
felix@3570:         <!-- END OFFICIAL LINES -->
ingo@1657: 
felix@1879:         <dc:comment>
felix@1879:           SHOW W-DIFFERENCES
felix@1879:         </dc:comment>
ingo@1657: 
felix@1879:         <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))">
felix@1879:           <differences>
felix@1879:             <dc:elements>
felix@1879:                 <dc:context>
felix@1879:                   <dc:statement>
felix@1879:                     SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@1879:                     FROM   master_artifacts m
felix@1879:                     WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@1879:                     AND EXISTS (
felix@1879:                         SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@1879:                   </dc:statement>
felix@1879:                   <dc:elements>
felix@1879:                       <dc:context>
felix@1879:                         <dc:statement>
felix@1879:                           SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
felix@1879:                           FROM outs as o, facets as f, artifacts as a
felix@1879:                           WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
felix@1879:                         </dc:statement>
felix@1879:                         <dc:elements>
felix@1879:                           <dc:element name="${facet_name}">
felix@1879:                             <dc:attribute name="description" value="${facet_description}"/>
felix@1879:                             <dc:attribute name="factory"     value="winfo"/>
felix@1879:                             <dc:attribute name="artifact-id" value="${aid}"/>
felix@1879:                             <dc:attribute name="ids"         value="${aid}"/>
felix@1879:                             <dc:attribute name="out"         value="w_differences"/>
felix@1879:                           </dc:element>
felix@1879:                         </dc:elements>
felix@1879:                       </dc:context>
felix@1879:                   </dc:elements>
felix@1879:                 </dc:context>
felix@1879:             </dc:elements>
felix@1879:           </differences>
felix@1879:         </dc:if>
ingo@1657: 
felix@2722:         <dc:comment>
felix@2722:           SHOW REFERENCE CURVE
felix@2722:         </dc:comment>
felix@2722: 
felix@2722:         <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
felix@2722:           <reference_curves>
felix@2722:             <dc:elements>
felix@2722:                 <dc:context>
felix@2722:                   <dc:statement>
felix@2722:                     SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@2722:                     FROM   master_artifacts m
felix@2722:                     WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@2722:                     AND EXISTS (
felix@2722:                         SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@2722:                   </dc:statement>
felix@2722:                   <dc:elements>
felix@2722:                       <dc:context>
felix@2722:                         <dc:statement>
felix@2722:                           SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
felix@2722:                           FROM outs as o, facets as f, artifacts as a
felix@2722:                           WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
felix@2722:                         </dc:statement>
felix@2722:                         <dc:elements>
felix@2722:                           <dc:element name="${facet_name}">
felix@2722:                             <dc:attribute name="description" value="${facet_description}"/>
felix@2722:                             <dc:attribute name="factory"     value="winfo"/>
felix@2722:                             <dc:attribute name="artifact-id" value="${aid}"/>
felix@2722:                             <dc:attribute name="ids"         value="${aid}"/>
felix@2722:                             <dc:attribute name="out"         value="reference_curve"/>
felix@2722:                           </dc:element>
felix@2722:                         </dc:elements>
felix@2722:                       </dc:context>
felix@2722:                   </dc:elements>
felix@2722:                 </dc:context>
felix@2722:             </dc:elements>
felix@2722:           </reference_curves>
felix@2722:         </dc:if>
felix@2722: 
felix@2722:         <dc:comment>
felix@2722:           SHOW COMPUTED DISCHARGE CURVES
felix@2722:         </dc:comment>
felix@2722: 
felix@1880:         <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
felix@1880:           <computed_discharge_curves>
felix@1880:             <dc:elements>
felix@1880:                 <dc:context>
felix@1880:                   <dc:statement>
felix@1880:                     SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@1880:                     FROM   master_artifacts m
felix@1880:                     WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@1880:                     AND EXISTS (
felix@1880:                         SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@1880:                   </dc:statement>
felix@1880:                   <dc:elements>
felix@1880:                       <dc:context>
felix@1880:                         <dc:statement>
felix@1880:                           SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
felix@1880:                           FROM outs as o, facets as f, artifacts as a
felix@1880:                           WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
felix@1880:                         </dc:statement>
felix@1880:                         <dc:elements>
felix@1880:                           <dc:element name="${facet_name}">
felix@1880:                             <dc:attribute name="description" value="${facet_description}"/>
felix@1880:                             <dc:attribute name="factory"     value="winfo"/>
felix@1880:                             <dc:attribute name="artifact-id" value="${aid}"/>
felix@1880:                             <dc:attribute name="ids"         value="${aid}"/>
felix@1880:                             <dc:attribute name="out"         value="computed_discharge_curve"/>
felix@1880:                           </dc:element>
felix@1880:                         </dc:elements>
felix@1880:                       </dc:context>
felix@1880:                   </dc:elements>
felix@1880:                 </dc:context>
felix@1880:             </dc:elements>
felix@1880:           </computed_discharge_curves>
felix@1880:         </dc:if>
sascha@3219: 
felix@2736:         <dc:comment>
felix@2736:           CROSS SECTION
felix@2736:         </dc:comment>
felix@2736: 
felix@2736:         <dc:if test="dc:contains($artifact-outs, 'cross_section')">
felix@2736:           <waterlevels>
felix@2736:             <dc:elements>
felix@2736:               <dc:context>
felix@2736:                  <dc:statement>
felix@2736:                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@2736:                    FROM   master_artifacts m
felix@2736:                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@2736:                    AND EXISTS (
felix@2736:                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@2736:                  </dc:statement>
felix@2736:                  <dc:elements>
felix@2736:                    <dc:context>
felix@2736:                      <dc:statement>
felix@2736:                        SELECT id AS out_id
felix@2736:                        FROM outs
felix@2736:                        WHERE artifact_id = ${a_id} AND name = 'cross_section'
felix@2736:                      </dc:statement>
felix@2736:                      <dc:elements>
felix@2736:                        <dc:context>
felix@2736:                          <dc:statement>
felix@2736:                            SELECT name AS facet_name, num as facet_num, description AS facet_description
felix@2736:                            FROM facets
felix@2736:                            WHERE out_id = ${out_id}
felix@2736:                            ORDER BY num ASC, name DESC
felix@2736:                          </dc:statement>
felix@2736:                          <longitudinal_section_columns>
felix@2736:                              <dc:attribute name="description" value="${river} ${a_creation}"/>
felix@2736:                              <dc:elements>
felix@2736:                                <dc:element name="${facet_name}">
felix@2736:                                  <dc:attribute name="description" value="${facet_description}"/>
felix@2736:                                  <dc:attribute name="ids" value="${facet_num}"/>
felix@2736:                                  <dc:attribute name="factory" value="winfo"/>
felix@2736:                                  <dc:attribute name="artifact-id" value="${a_gid}"/>
felix@2736:                                  <dc:attribute name="out" value="cross_section"/>
felix@2736:                                </dc:element>
felix@2736:                              </dc:elements>
felix@2736:                          </longitudinal_section_columns>
felix@2736:                        </dc:context>
felix@2736:                      </dc:elements>
felix@2736:                    </dc:context>
felix@2736:                  </dc:elements>
felix@2736:                </dc:context>
felix@2736:              </dc:elements>
felix@2736:           </waterlevels>
felix@2736:         </dc:if>
felix@1880: 
felix@1880: 
felix@2736:         <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
felix@1879:           <waterlevels>
felix@1879:             <dc:elements>
felix@1879:               <dc:context>
felix@1879:                  <dc:statement>
felix@1879:                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@1879:                    FROM   master_artifacts m
felix@1879:                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@1879:                    AND EXISTS (
felix@1879:                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@1879:                  </dc:statement>
felix@1879:                  <dc:elements>
felix@1879:                    <dc:context>
felix@1879:                      <dc:statement>
felix@1879:                        SELECT id AS out_id
felix@1879:                        FROM outs
felix@1879:                        WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
felix@1879:                      </dc:statement>
felix@1879:                      <dc:elements>
felix@1879:                        <dc:context>
felix@1879:                          <dc:statement>
felix@1879:                            SELECT name AS facet_name, num as facet_num, description AS facet_description
felix@1879:                            FROM facets
felix@1879:                            WHERE out_id = ${out_id}
felix@1879:                            ORDER BY num ASC, name DESC
felix@1879:                          </dc:statement>
felix@1879:                          <longitudinal_section_columns>
felix@1879:                              <dc:attribute name="description" value="${river} ${a_creation}"/>
felix@1879:                              <dc:elements>
felix@1879:                                <dc:element name="${facet_name}">
felix@1879:                                  <dc:attribute name="description" value="${facet_description}"/>
felix@1879:                                  <dc:attribute name="ids" value="${facet_num}"/>
felix@1879:                                  <dc:attribute name="factory" value="winfo"/>
felix@1879:                                  <dc:attribute name="artifact-id" value="${a_gid}"/>
felix@1879:                                  <dc:attribute name="out" value="longitudinal_section"/>
felix@1879:                                </dc:element>
felix@1879:                              </dc:elements>
felix@1879:                          </longitudinal_section_columns>
felix@1879:                        </dc:context>
felix@1879:                      </dc:elements>
felix@1879:                    </dc:context>
felix@1879:                  </dc:elements>
felix@1879:                </dc:context>
felix@1879:              </dc:elements>
felix@1879:           </waterlevels>
felix@1879:         </dc:if>
felix@1879: 
felix@3579:         <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
felix@3579:           <waterlevels>
felix@3579:             <dc:elements>
felix@3579:               <dc:context>
felix@3579:                  <dc:statement>
felix@3579:                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@3579:                    FROM   master_artifacts m
felix@3579:                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@3579:                    AND EXISTS (
felix@3579:                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@3579:                  </dc:statement>
felix@3579:                  <dc:elements>
felix@3579: 
felix@3579:                    <dc:context>
felix@3579:                    <dc:statement>
felix@3579:                      SELECT id AS out_id
felix@3579:                      FROM outs
felix@3579:                      WHERE artifact_id = ${a_id} AND name = 'fix_longitudinal_section_curve'
felix@3579:                    </dc:statement>
felix@3579:                    <dc:elements>
felix@3579:                      <dc:context>
felix@3579:                      <!-- average und deviation ls_0 . ls_1 ...-->
felix@3579:                        <dc:statement>
felix@3579:                          SELECT name AS facet_name, num as facet_num, description AS facet_description
felix@3579:                          FROM facets
felix@3589:                          WHERE out_id = ${out_id} AND ( name LIKE 'fix_deviation_ls%' OR name LIKE 'fix_sector_average_ls%' OR name LIKE 'fix_analysis_events_ls%' OR name LIKE 'fix_reference_events_ls%' )
felix@3579:                          ORDER BY num ASC, name DESC
felix@3579:                        </dc:statement>
felix@3579:                        <waterlevels>
felix@3579:                          <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
felix@3579:                          <dc:elements>
felix@3579:                            <dc:element name="${facet_name}">
felix@3579:                              <dc:attribute name="description" value="${facet_description}"/>
felix@3579:                              <dc:attribute name="ids"         value="${facet_num}"/>
felix@3579:                              <dc:attribute name="factory"     value="fixanalysis"/>
felix@3579:                              <dc:attribute name="artifact-id" value="${a_gid}"/>
felix@3579:                              <dc:attribute name="out"         value="fix_longitudinal_section_curve"/>
felix@3579:                            </dc:element>
felix@3579:                          </dc:elements>
felix@3579:                        </waterlevels>
felix@3579:                      </dc:context>
felix@3579:                    </dc:elements>
felix@3579:                   </dc:context>
felix@3579:                  </dc:elements>
felix@3579:                 </dc:context>
felix@3579:              </dc:elements>
felix@3579:           </waterlevels>
felix@3579:         </dc:if>
felix@3579: 
felix@3579:         <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
felix@3579:           <waterlevels>
felix@3579:             <dc:elements>
felix@3579:               <dc:context>
felix@3579:                  <dc:statement>
felix@3579:                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@3579:                    FROM   master_artifacts m
felix@3579:                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@3579:                    AND EXISTS (
felix@3579:                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@3579:                  </dc:statement>
felix@3579:                  <dc:elements>
felix@3579: 
felix@3579:                    <dc:context>
felix@3579:                    <dc:statement>
felix@3579:                      SELECT id AS out_id
felix@3579:                      FROM outs
felix@3582:                      WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve'
felix@3579:                    </dc:statement>
felix@3579:                    <dc:elements>
felix@3579:                      <dc:context>
felix@3579:                        <dc:statement>
felix@3579:                          SELECT name AS facet_name, num as facet_num, description AS facet_description
felix@3579:                          FROM facets
felix@3590:                          WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_dwt%' OR name LIKE 'fix_deviation_dwt%' OR name = 'fix_analysis_events_dwt' OR name = 'fix_reference_events_dwt' OR name = 'fix_analysis_periods_dwt' )
felix@3579:                          ORDER BY num ASC, name DESC
felix@3579:                        </dc:statement>
felix@3579:                        <waterlevels>
felix@3579:                          <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
felix@3579:                          <dc:elements>
felix@3579:                            <dc:element name="${facet_name}">
felix@3579:                              <dc:attribute name="description" value="${facet_description}"/>
felix@3579:                              <dc:attribute name="ids"         value="${facet_num}"/>
felix@3582:                              <dc:attribute name="factory"     value="fixanalysis"/>
felix@3579:                              <dc:attribute name="artifact-id" value="${a_gid}"/>
felix@3582:                              <dc:attribute name="out"         value="fix_deltawt_curve"/>
felix@3579:                            </dc:element>
felix@3579:                          </dc:elements>
felix@3579:                        </waterlevels>
felix@3579:                      </dc:context>
felix@3579:                    </dc:elements>
felix@3579:                   </dc:context>
felix@3579:                  </dc:elements>
felix@3579:                 </dc:context>
felix@3579:              </dc:elements>
felix@3579:           </waterlevels>
felix@3579:         </dc:if>
felix@3579: 
felix@3589:         <dc:if test="dc:contains($artifact-outs, 'fix_derivate_curve')">
felix@3589:           <waterlevels>
felix@3589:             <dc:elements>
felix@3589:               <dc:context>
felix@3589:                  <dc:statement>
felix@3589:                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@3589:                    FROM   master_artifacts m
felix@3589:                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@3589:                    AND EXISTS (
felix@3589:                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@3589:                  </dc:statement>
felix@3589:                  <dc:elements>
felix@3589: 
felix@3589:                    <dc:context>
felix@3589:                    <dc:statement>
felix@3589:                      SELECT id AS out_id
felix@3589:                      FROM outs
felix@3589:                      WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve'
felix@3589:                    </dc:statement>
felix@3589:                    <dc:elements>
felix@3589:                      <dc:context>
felix@3589:                        <dc:statement>
felix@3589:                          SELECT name AS facet_name, num as facet_num, description AS facet_description
felix@3589:                          FROM facets
felix@3589:                          WHERE out_id = ${out_id} and name = 'fix_derivate'
felix@3589:                          ORDER BY num ASC, name DESC
felix@3589:                        </dc:statement>
felix@3589:                        <waterlevels>
felix@3589:                          <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
felix@3589:                          <dc:elements>
felix@3589:                            <dc:element name="${facet_name}">
felix@3589:                              <dc:attribute name="description" value="${facet_description}"/>
felix@3589:                              <dc:attribute name="ids"         value="${facet_num}"/>
felix@3589:                              <dc:attribute name="factory"     value="fixanalysis"/>
felix@3589:                              <dc:attribute name="artifact-id" value="${a_gid}"/>
felix@3589:                              <dc:attribute name="out"         value="fix_derivate_curve"/>
felix@3589:                            </dc:element>
felix@3589:                          </dc:elements>
felix@3589:                        </waterlevels>
felix@3589:                      </dc:context>
felix@3589:                    </dc:elements>
felix@3589:                   </dc:context>
felix@3589:                  </dc:elements>
felix@3589:                 </dc:context>
felix@3589:              </dc:elements>
felix@3589:           </waterlevels>
felix@3589:         </dc:if>
felix@3589: 
felix@3579:         <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
felix@3579:           <waterlevels>
felix@3579:             <dc:elements>
felix@3579:               <dc:context>
felix@3579:                  <dc:statement>
felix@3579:                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@3579:                    FROM   master_artifacts m
felix@3579:                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@3579:                    AND EXISTS (
felix@3579:                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@3579:                  </dc:statement>
felix@3579:                  <dc:elements>
felix@3579: 
felix@3579:                    <dc:context>
felix@3579:                    <dc:statement>
felix@3579:                      SELECT id AS out_id
felix@3579:                      FROM outs
felix@3583:                      WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve'
felix@3579:                    </dc:statement>
felix@3579:                    <dc:elements>
felix@3579:                      <dc:context>
felix@3579:                        <dc:statement>
felix@3579:                          SELECT name AS facet_name, num as facet_num, description AS facet_description
felix@3579:                          FROM facets
felix@3588:                          WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_wq%' OR name = 'fix_wq_curve' OR name LIKE 'fix_analysis_events_wq%' OR name LIKE 'fix_reference_events_wq%' )
felix@3579:                          ORDER BY num ASC, name DESC
felix@3579:                        </dc:statement>
felix@3579:                        <waterlevels>
felix@3579:                          <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
felix@3579:                          <dc:elements>
felix@3579:                            <dc:element name="${facet_name}">
felix@3579:                              <dc:attribute name="description" value="${facet_description}"/>
felix@3579:                              <dc:attribute name="ids"         value="${facet_num}"/>
felix@3583:                              <dc:attribute name="factory"     value="fixanalysis"/>
felix@3579:                              <dc:attribute name="artifact-id" value="${a_gid}"/>
felix@3583:                              <dc:attribute name="out"         value="fix_wq_curve"/>
felix@3579:                            </dc:element>
felix@3579:                          </dc:elements>
felix@3579:                        </waterlevels>
felix@3579:                      </dc:context>
felix@3579:                    </dc:elements>
felix@3579:                   </dc:context>
felix@3579:                  </dc:elements>
felix@3579:                 </dc:context>
felix@3579:              </dc:elements>
felix@3579:           </waterlevels>
felix@3579:         </dc:if>
felix@3579: 
felix@2690:         <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
felix@2690:           <computed_discharge_curves>
felix@2690:             <dc:elements>
felix@2690:                 <dc:context>
felix@2690:                   <dc:statement>
felix@2690:                     SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@2690:                     FROM   master_artifacts m
felix@2690:                     WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@2690:                     AND EXISTS (
felix@2690:                         SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@2690:                   </dc:statement>
felix@2690:                   <dc:elements>
felix@2690:                       <dc:context>
felix@2690:                         <dc:statement>
felix@2690:                           SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
felix@2690:                           FROM outs as o, facets as f, artifacts as a
felix@2717:                           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}
felix@2690:                         </dc:statement>
felix@2690:                         <dc:elements>
felix@2690:                           <dc:element name="${facet_name}">
felix@2690:                             <dc:attribute name="description" value="${facet_description}"/>
felix@2690:                             <dc:attribute name="factory"     value="winfo"/>
felix@2690:                             <dc:attribute name="artifact-id" value="${aid}"/>
felix@2690:                             <dc:attribute name="ids"         value="${aid}"/>
felix@2690:                             <dc:attribute name="out"         value="duration_curve"/>
felix@2690:                           </dc:element>
felix@2690:                         </dc:elements>
felix@2690:                       </dc:context>
felix@2690:                   </dc:elements>
felix@2690:                 </dc:context>
felix@2690:             </dc:elements>
felix@2690:           </computed_discharge_curves>
felix@2690:         </dc:if>
felix@1879:         <dc:comment>
felix@1879:            WATERLEVELS - ONLY SHOW Ws
felix@1879:         </dc:comment>
felix@1879: 
felix@3589:         <!-- TODO doesnt work nicely for fix/wq-diags. -->
felix@3589:         <dc:if test="dc:contains($artifact-outs, 'waterlevels') or (dc:contains($artifact-outs, 'fix_wq_curve'))"> 
felix@1879:           <waterlevels>
felix@1879:             <dc:elements>
felix@1879:               <dc:context>
felix@1879:                  <dc:statement>
felix@1879:                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
felix@1879:                    FROM   master_artifacts m
felix@1879:                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
felix@1879:                    AND EXISTS (
felix@1879:                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
felix@1879:                  </dc:statement>
felix@1879:                  <dc:elements>
felix@1879: 
felix@1879:                    <dc:context>
felix@1879:                    <dc:statement>
felix@1879:                      SELECT id AS out_id
felix@1879:                      FROM outs
felix@1879:                      WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
felix@1879:                    </dc:statement>
felix@1879:                    <dc:elements>
felix@1879:                      <dc:context>
felix@1879:                        <dc:statement>
felix@1879:                          SELECT name AS facet_name, num as facet_num, description AS facet_description
felix@1879:                          FROM facets
felix@1879:                          WHERE out_id = ${out_id} and name = 'longitudinal_section.w'
felix@1879:                          ORDER BY num ASC, name DESC
felix@1879:                        </dc:statement>
felix@1879:                        <waterlevels>
felix@1879:                          <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
felix@1879:                          <dc:elements>
felix@1879:                            <dc:element name="${facet_name}">
felix@1879:                              <dc:attribute name="description" value="${facet_description}"/>
felix@1879:                              <dc:attribute name="ids"         value="${facet_num}"/>
felix@1879:                              <dc:attribute name="factory"     value="winfo"/>
felix@1879:                              <dc:attribute name="artifact-id" value="${a_gid}"/>
felix@1879:                              <dc:attribute name="out"         value="longitudinal_section"/>
felix@1879:                            </dc:element>
felix@1879:                          </dc:elements>
felix@1879:                        </waterlevels>
felix@1879:                      </dc:context>
felix@1879:                    </dc:elements>
felix@1879:                   </dc:context>
felix@1879:                  </dc:elements>
felix@1879:                 </dc:context>
felix@1879:              </dc:elements>
felix@1879:           </waterlevels>
felix@1879:         </dc:if>
felix@1879: 
ingo@2096:         <dc:comment>
ingo@2096:           SHOW FLOODMAPS
ingo@2096:         </dc:comment>
ingo@2096: 
ingo@2114:         <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'map')">
ingo@2096:           <floodmap>
ingo@2096:             <dc:elements>
ingo@2096:                 <dc:context>
ingo@2096:                   <dc:statement>
ingo@2096:                     SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
ingo@2096:                     FROM   master_artifacts m
ingo@2096:                     WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
ingo@2096:                     AND EXISTS (
ingo@2096:                         SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
ingo@2096:                   </dc:statement>
ingo@2096:                   <dc:elements>
ingo@2096:                       <dc:context>
ingo@2096:                         <dc:statement>
ingo@2096:                           SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
ingo@2096:                           FROM outs as o, facets as f, artifacts as a
ingo@2096:                           WHERE f.name = 'floodmap.wsplgen' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
ingo@2096:                         </dc:statement>
ingo@2096:                         <dc:elements>
ingo@2096:                           <dc:element name="${facet_name}">
ingo@2096:                             <dc:attribute name="description" value="${facet_description}"/>
ingo@2096:                             <dc:attribute name="factory"     value="winfo"/>
ingo@2096:                             <dc:attribute name="artifact-id" value="${aid}"/>
ingo@2096:                             <dc:attribute name="ids"         value="${aid}"/>
ingo@2096:                             <dc:attribute name="out"         value="floodmap"/>
ingo@2096:                           </dc:element>
ingo@2096:                         </dc:elements>
ingo@2096:                       </dc:context>
ingo@2096:                   </dc:elements>
ingo@2096:                 </dc:context>
ingo@2096:             </dc:elements>
ingo@2096:           </floodmap>
ingo@2096:         </dc:if>
ingo@2096: 
felix@1879:       </dc:context>
sascha@1046:       </old_calculations>
ingo@1657: 
ingo@1657: 
ingo@1181:       <dc:comment>
ingo@1657:         Include System specific part when 'load-system' is in parameters.
ingo@1657:         -----------------------------------------------------------------
ingo@1181:       </dc:comment>
ingo@1657:       <dc:choose>
ingo@1657:         <dc:when test="dc:contains($parameters,'load-system')">
ingo@1657:           <dc:call-macro name="load-system"/>
ingo@1657:         </dc:when>
ingo@1657:       </dc:choose>
sascha@1046:     </dc:when>
ingo@1657: 
ingo@1657: 
sascha@1046:     <dc:comment>
ingo@1657:       Include System specific part only if no user ID is given.
ingo@1657:       ---------------------------------------------------------
sascha@1046:     </dc:comment>
sascha@1046:     <dc:otherwise>
ingo@1181:         <dc:call-macro name="load-system"/>
sascha@1046:     </dc:otherwise>
sascha@1046:   </dc:choose>
sascha@1046: </datacage>
sascha@1046: </dc:template>