comparison artifacts/doc/conf/meta-data.xml @ 6095:0f3ca851d204

First part of the filtering datacage for user data. This joins the outs to the master artifact information and adds km filtering. Next step: Joining the facets and filtering by them. This will also fix the broken select-facet macro
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 24 May 2013 18:53:05 +0200
parents 46c18b687fdc
children c21bfa653942
comparison
equal deleted inserted replaced
6094:16027599b2a9 6095:0f3ca851d204
271 </dc:call-macro> 271 </dc:call-macro>
272 </dc:macro> 272 </dc:macro>
273 273
274 <dc:macro name="generate-user-content"> 274 <dc:macro name="generate-user-content">
275 <dc:call-macro name="user-range"> 275 <dc:call-macro name="user-range">
276 <dc:call-macro name="km-filtered-userdata"> 276 <dc:call-macro name="all-user-artifacts">
277 <dc:choose> 277 <dc:call-macro name="km-filtered-user-artifacts">
278 <dc:when test="dc:contains($parameters, 'recommended')"> 278 <dc:choose>
279 <dc:comment> 279 <dc:when test="dc:contains($parameters, 'recommended')">
280 Recommendations (client shall load immediately). 280 <dc:comment>
281 </dc:comment> 281 Recommendations (user)
282 <dc:iterate var="out" container="artifact-outs"> 282 </dc:comment>
283 <dc:choose> 283 <dc:iterate var="out" container="artifact-outs">
284 <dc:when test="$out = 'longitudinal_section'"> 284 <dc:choose>
285 <dc:call-macro name="officiallines_user"/> 285 <dc:when test="$out = 'longitudinal_section'">
286 </dc:when> 286 <dc:call-macro name="officiallines_user"/>
287 </dc:choose> 287 </dc:when>
288 </dc:iterate> 288 </dc:choose>
289 </dc:when> 289 </dc:iterate>
290 <dc:otherwise> 290 </dc:when>
291 <dc:comment> 291 <dc:otherwise>
292 Non Recommendations 292 <dc:comment>
293 </dc:comment> 293 Non Recommendations (user)
294 <dc:iterate var="out" container="artifact-outs"> 294 </dc:comment>
295 <dc:choose> 295 <dc:iterate var="out" container="artifact-outs">
296 <dc:when test="$out = 'longitudinal_section'"> 296 <dc:choose>
297 <dc:call-macro name="longitudinal"/> 297 <dc:when test="$out = 'longitudinal_section'">
298 <dc:call-macro name="differences"/> 298 <dc:call-macro name="longitudinal"/>
299 </dc:when> 299 <dc:call-macro name="differences"/>
300 <dc:when test="$out = 'discharge_longitudinal_section'"> 300 </dc:when>
301 <dc:call-macro name="longitudinal"/> 301 <dc:when test="$out = 'discharge_longitudinal_section'">
302 <dc:call-macro name="differences"/> 302 <dc:call-macro name="longitudinal"/>
303 </dc:when> 303 <dc:call-macro name="differences"/>
304 <dc:when test="$out = 'w_differences'"> 304 </dc:when>
305 <dc:call-macro name="longitudinal"/> 305 <dc:when test="$out = 'w_differences'">
306 <dc:call-macro name="differences"/> 306 <dc:call-macro name="longitudinal"/>
307 </dc:when> 307 <dc:call-macro name="differences"/>
308 <dc:when test="$out = 'fix_deltawt_curve'"> 308 </dc:when>
309 <dc:call-macro name="delta-wt"/> 309 <dc:when test="$out = 'fix_deltawt_curve'">
310 </dc:when> 310 <dc:call-macro name="delta-wt"/>
311 <dc:when test="$out = 'reference_curve'"> 311 </dc:when>
312 <dc:call-macro name="reference-curves"/> 312 <dc:when test="$out = 'reference_curve'">
313 </dc:when> 313 <dc:call-macro name="reference-curves"/>
314 <dc:when test="$out = 'computed_discharge_curve'"> 314 </dc:when>
315 <dc:call-macro name="computed-discharge-curve"/> 315 <dc:when test="$out = 'computed_discharge_curve'">
316 </dc:when> 316 <dc:call-macro name="computed-discharge-curve"/>
317 <dc:when test="$out = 'cross_section'"> 317 </dc:when>
318 <dc:call-macro name="waterlevels"/> 318 <dc:when test="$out = 'cross_section'">
319 </dc:when> 319 <dc:call-macro name="waterlevels"/>
320 <dc:when test="$out = 'fix_longitudinal_section_curve'"> 320 </dc:when>
321 <dc:call-macro name="longitudinal-section"/> 321 <dc:when test="$out = 'fix_longitudinal_section_curve'">
322 </dc:when> 322 <dc:call-macro name="longitudinal-section"/>
323 <dc:when test="$out = 'fix_derivate_curve'"> 323 </dc:when>
324 <dc:call-macro name="fix-derivate-curve"/> 324 <dc:when test="$out = 'fix_derivate_curve'">
325 </dc:when> 325 <dc:call-macro name="fix-derivate-curve"/>
326 <dc:when test="$out = 'fix_wq_curve'"> 326 </dc:when>
327 <dc:call-macro name="fix-wq-curve"/> 327 <dc:when test="$out = 'fix_wq_curve'">
328 </dc:when> 328 <dc:call-macro name="fix-wq-curve"/>
329 <dc:when test="$out = 'duration_curve'"> 329 </dc:when>
330 <dc:call-macro name="duration-curve"/> 330 <dc:when test="$out = 'duration_curve'">
331 </dc:when> 331 <dc:call-macro name="duration-curve"/>
332 <dc:when test="$out = 'waterlevels'"> 332 </dc:when>
333 <dc:call-macro name="waterlevels-fix"/> 333 <dc:when test="$out = 'waterlevels'">
334 </dc:when> 334 <dc:call-macro name="waterlevels-fix"/>
335 <dc:when test="$out = 'fix_wq_curve'"> 335 </dc:when>
336 <dc:call-macro name="waterlevels-fix"/> 336 <dc:when test="$out = 'fix_wq_curve'">
337 </dc:when> 337 <dc:call-macro name="waterlevels-fix"/>
338 <dc:when test="$out = 'floodmap'"> 338 </dc:when>
339 <dc:call-macro name="flood-map"/> 339 <dc:when test="$out = 'floodmap'">
340 </dc:when> 340 <dc:call-macro name="flood-map"/>
341 <dc:when test="$out = 'map'"> 341 </dc:when>
342 <dc:call-macro name="flood-map"/> 342 <dc:when test="$out = 'map'">
343 </dc:when> 343 <dc:call-macro name="flood-map"/>
344 <dc:when test="$out = 'bedheight_middle'"> 344 </dc:when>
345 <dc:call-macro name="waterlevels-discharge"/> 345 <dc:when test="$out = 'bedheight_middle'">
346 <dc:call-macro name="waterlevels-fix"/> 346 <dc:call-macro name="waterlevels-discharge"/>
347 </dc:when> 347 <dc:call-macro name="waterlevels-fix"/>
348 <dc:when test="$out = 'floodmap-hws'"> 348 </dc:when>
349 <dc:call-macro name="floodmap-hws-user"/> 349 <dc:when test="$out = 'floodmap-hws'">
350 </dc:when> 350 <dc:call-macro name="floodmap-hws-user"/>
351 <dc:when test="$out = 'flow_velocity'"> 351 </dc:when>
352 <dc:call-macro name="bedquality-bed"/> 352 <dc:when test="$out = 'flow_velocity'">
353 <dc:call-macro name="bedquality-load"/> 353 <dc:call-macro name="bedquality-bed"/>
354 </dc:when> 354 <dc:call-macro name="bedquality-load"/>
355 <dc:when test="$out = 'bed_longitudinal_section'"> 355 </dc:when>
356 <dc:call-macro name="bedquality-bed"/> 356 <dc:when test="$out = 'bed_longitudinal_section'">
357 <dc:call-macro name="bedquality-load"/> 357 <dc:call-macro name="bedquality-bed"/>
358 <dc:call-macro name="bedquality-density"/> 358 <dc:call-macro name="bedquality-load"/>
359 <dc:call-macro name="bedquality-porosity"/> 359 <dc:call-macro name="bedquality-density"/>
360 </dc:when> 360 <dc:call-macro name="bedquality-porosity"/>
361 <dc:when test="$out = 'sedimentload_ls'"> 361 </dc:when>
362 <dc:call-macro name="differences"/> 362 <dc:when test="$out = 'sedimentload_ls'">
363 <dc:call-macro name="bedheight-differences"/> 363 <dc:call-macro name="differences"/>
364 <dc:call-macro name="flow-velocity"/> 364 <dc:call-macro name="bedheight-differences"/>
365 <dc:call-macro name="sediment-load"/> 365 <dc:call-macro name="flow-velocity"/>
366 </dc:when> 366 <dc:call-macro name="sediment-load"/>
367 <dc:when test="$out = 'bed_difference_year'"> 367 </dc:when>
368 <dc:call-macro name="waterlevels-discharge"/> 368 <dc:when test="$out = 'bed_difference_year'">
369 <dc:call-macro name="bedheight-differences"/> 369 <dc:call-macro name="waterlevels-discharge"/>
370 <dc:call-macro name="differences"/> 370 <dc:call-macro name="bedheight-differences"/>
371 <dc:call-macro name="waterlevels-fix"/> 371 <dc:call-macro name="differences"/>
372 <dc:call-macro name="delta-wt-ls"/> 372 <dc:call-macro name="waterlevels-fix"/>
373 </dc:when> 373 <dc:call-macro name="delta-wt-ls"/>
374 <dc:when test="$out = 'bed_difference_epoch'"> 374 </dc:when>
375 <dc:call-macro name="waterlevels-discharge"/> 375 <dc:when test="$out = 'bed_difference_epoch'">
376 <dc:call-macro name="bedheight-differences"/> 376 <dc:call-macro name="waterlevels-discharge"/>
377 <dc:call-macro name="differences"/> 377 <dc:call-macro name="bedheight-differences"/>
378 <dc:call-macro name="waterlevels-fix"/> 378 <dc:call-macro name="differences"/>
379 <dc:call-macro name="delta-wt-ls"/> 379 <dc:call-macro name="waterlevels-fix"/>
380 </dc:when> 380 <dc:call-macro name="delta-wt-ls"/>
381 </dc:choose> 381 </dc:when>
382 </dc:iterate> 382 </dc:choose>
383 </dc:otherwise> 383 </dc:iterate>
384 </dc:choose> 384 </dc:otherwise>
385 </dc:choose>
386 </dc:call-macro>
385 </dc:call-macro> 387 </dc:call-macro>
386 </dc:call-macro> 388 </dc:call-macro>
387 </dc:macro> 389 </dc:macro>
388 390
389 <!-- Macros to load user data --> 391 <!-- Macros to load user data -->
390 392
391 <dc:macro name="select-facets"> 393 <dc:macro name="select-facets">
394 <!-- FIXME : this is broken now! -->
392 <dc:context> 395 <dc:context>
393 <dc:statement> 396 <dc:statement>
394 SELECT a.gid AS aid, 397 SELECT a.gid AS aid,
395 f.id AS fid, 398 f.id AS fid,
396 f.name AS facet_name, 399 f.name AS facet_name,
474 </floodmap> 477 </floodmap>
475 </dc:call-macro> 478 </dc:call-macro>
476 </dc:macro> 479 </dc:macro>
477 480
478 <dc:macro name="waterlevels"> 481 <dc:macro name="waterlevels">
479 <dc:context> 482 <dc:filter expr="$out_name = 'cross_section'">
480 <dc:statement>
481 SELECT id AS out_id
482 FROM outs
483 WHERE artifact_id = ${a_id} AND name = 'cross_section'
484 </dc:statement>
485 <dc:if test="dc:has-result()"> 483 <dc:if test="dc:has-result()">
486 <waterlevels> 484 <waterlevels>
487 <dc:for-each> 485 <dc:for-each>
488 <dc:context> 486 <dc:context>
489 <dc:statement> 487 <dc:statement>
505 </longitudinal_section_columns> 503 </longitudinal_section_columns>
506 </dc:context> 504 </dc:context>
507 </dc:for-each> 505 </dc:for-each>
508 </waterlevels> 506 </waterlevels>
509 </dc:if> 507 </dc:if>
510 </dc:context> 508 </dc:filter>
511 </dc:macro> 509 </dc:macro>
512 510
513 <dc:macro name="longitudinal"> 511 <dc:macro name="longitudinal">
514 <dc:context> 512 <dc:filter expr="$out_name = 'longitudinal_section'">
515 <dc:statement>
516 SELECT id AS out_id
517 FROM outs
518 WHERE artifact_id = ${a_id}
519 AND name = 'longitudinal_section'
520 </dc:statement>
521 <dc:if test="dc:has-result()"> 513 <dc:if test="dc:has-result()">
522 <waterlevels> 514 <waterlevels>
523 <dc:for-each> 515 <dc:for-each>
524 <dc:context> 516 <dc:context>
525 <dc:statement> 517 <dc:statement>
543 </longitudinal_section_columns> 535 </longitudinal_section_columns>
544 </dc:context> 536 </dc:context>
545 </dc:for-each> 537 </dc:for-each>
546 </waterlevels> 538 </waterlevels>
547 </dc:if> 539 </dc:if>
548 </dc:context> 540 </dc:filter>
549 </dc:macro> 541 </dc:macro>
550 542
551 <dc:macro name="longitudinal-section"> 543 <dc:macro name="longitudinal-section">
552 <dc:context> 544 <dc:filter expr="$out_name = 'fix_longitudinal_section_curve'">
553 <dc:statement>
554 SELECT id AS out_id
555 FROM outs
556 WHERE artifact_id = ${a_id}
557 AND name = 'fix_longitudinal_section_curve'
558 </dc:statement>
559 <dc:if test="dc:has-result()"> 545 <dc:if test="dc:has-result()">
560 <waterlevels> 546 <waterlevels>
561 <dc:for-each> 547 <dc:for-each>
562 <dc:context> 548 <dc:context>
563 <dc:statement> 549 <dc:statement>
585 </waterlevels> 571 </waterlevels>
586 </dc:context> 572 </dc:context>
587 </dc:for-each> 573 </dc:for-each>
588 </waterlevels> 574 </waterlevels>
589 </dc:if> 575 </dc:if>
590 </dc:context> 576 </dc:filter>
591 </dc:macro> 577 </dc:macro>
592 578
593 <dc:macro name="delta-wt"> 579 <dc:macro name="delta-wt">
594 <dc:context> 580 <dc:filter expr="$out_name = 'fix_deltawt_curve'">
595 <dc:statement>
596 SELECT id AS out_id
597 FROM outs
598 WHERE artifact_id = ${a_id}
599 AND name = 'fix_deltawt_curve'
600 </dc:statement>
601 <dc:if test="dc:has-result()"> 581 <dc:if test="dc:has-result()">
602 <waterlevels> 582 <waterlevels>
603 <dc:for-each> 583 <dc:for-each>
604 <dc:context> 584 <dc:context>
605 <dc:statement> 585 <dc:statement>
628 </waterlevels> 608 </waterlevels>
629 </dc:context> 609 </dc:context>
630 </dc:for-each> 610 </dc:for-each>
631 </waterlevels> 611 </waterlevels>
632 </dc:if> 612 </dc:if>
633 </dc:context> 613 </dc:filter>
634 </dc:macro> 614 </dc:macro>
635 615
636 <dc:macro name="delta-wt-ls"> 616 <dc:macro name="delta-wt-ls">
637 <dc:context> 617 <dc:filter expr="$out_name = 'fix_deltawt_curve'">
638 <dc:statement>
639 SELECT id AS out_id
640 FROM outs
641 WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve'
642 </dc:statement>
643 <dc:if test="dc:has-result()"> 618 <dc:if test="dc:has-result()">
644 <waterlevels> 619 <waterlevels>
645 <dc:for-each> 620 <dc:for-each>
646 <dc:context> 621 <dc:context>
647 <dc:statement> 622 <dc:statement>
665 </waterlevels> 640 </waterlevels>
666 </dc:context> 641 </dc:context>
667 </dc:for-each> 642 </dc:for-each>
668 </waterlevels> 643 </waterlevels>
669 </dc:if> 644 </dc:if>
670 </dc:context> 645 </dc:filter>
671 </dc:macro> 646 </dc:macro>
672 647
673 <dc:macro name="fix-derivate-curve"> 648 <dc:macro name="fix-derivate-curve">
674 <dc:context> 649 <dc:filter expr="$out_name = 'fix_derivate_curve'">
675 <dc:statement>
676 SELECT id AS out_id
677 FROM outs
678 WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve'
679 </dc:statement>
680 <dc:if test="dc:has-result()"> 650 <dc:if test="dc:has-result()">
681 <waterlevels> 651 <waterlevels>
682 <dc:for-each> 652 <dc:for-each>
683 <dc:context> 653 <dc:context>
684 <dc:statement> 654 <dc:statement>
700 </waterlevels> 670 </waterlevels>
701 </dc:context> 671 </dc:context>
702 </dc:for-each> 672 </dc:for-each>
703 </waterlevels> 673 </waterlevels>
704 </dc:if> 674 </dc:if>
705 </dc:context> 675 </dc:filter>
706 </dc:macro> 676 </dc:macro>
707 677
708 <dc:macro name="fix-wq-curve"> 678 <dc:macro name="fix-wq-curve">
709 <dc:context> 679 <dc:filter expr="$out_name = 'fix_wq_curve'">
710 <dc:statement>
711 SELECT id AS out_id
712 FROM outs
713 WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve'
714 </dc:statement>
715 <dc:if test="dc:has-result()"> 680 <dc:if test="dc:has-result()">
716 <waterlevels> 681 <waterlevels>
717 <dc:for-each> 682 <dc:for-each>
718 <dc:context> 683 <dc:context>
719 <dc:statement> 684 <dc:statement>
739 </waterlevels> 704 </waterlevels>
740 </dc:context> 705 </dc:context>
741 </dc:for-each> 706 </dc:for-each>
742 </waterlevels> 707 </waterlevels>
743 </dc:if> 708 </dc:if>
744 </dc:context> 709 </dc:filter>
745 </dc:macro> 710 </dc:macro>
746 711
747 <dc:macro name="duration-curve"> 712 <dc:macro name="duration-curve">
748 <dc:context> 713 <dc:context>
749 <dc:statement> 714 <dc:statement>
775 </dc:context> 740 </dc:context>
776 </dc:macro> 741 </dc:macro>
777 742
778 <dc:comment>TODO doesnt work nicely for fix/wq-diags.</dc:comment> 743 <dc:comment>TODO doesnt work nicely for fix/wq-diags.</dc:comment>
779 <dc:macro name="waterlevels-fix"> 744 <dc:macro name="waterlevels-fix">
780 <dc:context> 745 <dc:filter expr="$out_name = 'longitudinal_section'">
781 <dc:statement> 746 <waterlevels>
782 SELECT id AS out_id 747 <dc:for-each>
783 FROM outs 748 <dc:context>
784 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' 749 <dc:statement>
785 </dc:statement> 750 SELECT name AS facet_name, num AS facet_num, description AS facet_description
786 <dc:if test="dc:has-result()"> 751 FROM facets
787 <waterlevels> 752 WHERE out_id = ${out_id} and name = 'longitudinal_section.w'
788 <dc:for-each> 753 ORDER BY num ASC, name DESC
789 <dc:context> 754 </dc:statement>
790 <dc:statement> 755 <waterlevels description="{$river} {$a_creation} {$collection_name}">
791 SELECT name AS facet_name, num AS facet_num, description AS facet_description 756 <dc:for-each>
792 FROM facets 757 <dc:element name="${facet_name}">
793 WHERE out_id = ${out_id} and name = 'longitudinal_section.w' 758 <dc:attribute name="description" value="${facet_description}"/>
794 ORDER BY num ASC, name DESC 759 <dc:attribute name="ids" value="${facet_num}"/>
795 </dc:statement> 760 <dc:attribute name="factory" value="winfo"/>
796 <waterlevels description="{$river} {$a_creation} {$collection_name}"> 761 <dc:attribute name="artifact-id" value="${a_gid}"/>
797 <dc:for-each> 762 <dc:attribute name="out" value="longitudinal_section"/>
798 <dc:element name="${facet_name}"> 763 </dc:element>
799 <dc:attribute name="description" value="${facet_description}"/> 764 </dc:for-each>
800 <dc:attribute name="ids" value="${facet_num}"/> 765 </waterlevels>
801 <dc:attribute name="factory" value="winfo"/> 766 </dc:context>
802 <dc:attribute name="artifact-id" value="${a_gid}"/> 767 </dc:for-each>
803 <dc:attribute name="out" value="longitudinal_section"/> 768 </waterlevels>
804 </dc:element> 769 </dc:filter>
805 </dc:for-each>
806 </waterlevels>
807 </dc:context>
808 </dc:for-each>
809 </waterlevels>
810 </dc:if>
811 </dc:context>
812 </dc:macro> 770 </dc:macro>
813 771
814 <dc:macro name="floodmap-hws-user"> 772 <dc:macro name="floodmap-hws-user">
815 <dc:context> 773 <dc:filter expr="$out_name = 'floodmap'">
816 <dc:statement>
817 SELECT id AS out_id
818 FROM outs
819 WHERE artifact_id = ${a_id} AND name = 'floodmap'
820 </dc:statement>
821 <dc:for-each> 774 <dc:for-each>
822 <dc:context> 775 <dc:context>
823 <dc:statement> 776 <dc:statement>
824 SELECT name AS facet_name, 777 SELECT name AS facet_name,
825 num AS facet_num, 778 num AS facet_num,
826 description AS facet_description 779 description AS facet_description
827 FROM facets 780 FROM facets
828 WHERE out_id = ${out_id} AND name = 'floodmap.usershape' 781 WHERE out_id = ${out_id} AND name = 'floodmap.usershape'
829 ORDER BY num ASC, name DESC 782 ORDER BY num ASC, name DESC
830 </dc:statement> 783 </dc:statement>
831 <own-hws> 784 <own-hws>
839 </dc:element> 792 </dc:element>
840 </dc:for-each> 793 </dc:for-each>
841 </own-hws> 794 </own-hws>
842 </dc:context> 795 </dc:context>
843 </dc:for-each> 796 </dc:for-each>
844 </dc:context> 797 </dc:filter>
845 </dc:macro> 798 </dc:macro>
846 799
847 <dc:macro name="bedquality-bed"> 800 <dc:macro name="bedquality-bed">
848 <dc:context> 801 <dc:filter expr="$out_name = 'bed_longitudinal_section'">
849 <dc:statement>
850 SELECT id AS oid
851 FROM outs AS o
852 WHERE
853 o.artifact_id = ${a_id} AND
854 o.name='bed_longitudinal_section'
855 </dc:statement>
856 <dc:if test="dc:has-result()"> 802 <dc:if test="dc:has-result()">
857 <bed_quality_bed> 803 <bed_quality_bed>
858 <dc:for-each> 804 <dc:for-each>
859 <quality-bed description="{$river} {$a_creation} {$collection_name}"> 805 <quality-bed description="{$river} {$a_creation} {$collection_name}">
860 <dc:context> 806 <dc:context>
861 <dc:statement> 807 <dc:statement>
862 SELECT a.gid AS aid, 808 SELECT a.gid AS aid,
863 f.id AS fid, 809 f.id AS fid,
864 f.name AS facet_name, 810 f.name AS facet_name,
865 f.num AS facet_num, 811 f.num AS facet_num,
866 f.description AS facet_description 812 f.description AS facet_description
867 FROM outs AS o, facets AS f, artifacts AS a 813 FROM outs AS o, facets AS f, artifacts AS a
868 WHERE 814 WHERE
869 (f.name = 'bed_longitudinal_section.bed_diameter_toplayer' 815 (f.name = 'bed_longitudinal_section.bed_diameter_toplayer'
870 OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND 816 OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND
871 f.out_id = o.id AND 817 f.out_id = o.id AND
872 o.artifact_id = ${a_id} AND 818 o.artifact_id = ${a_id} AND
873 a.id = ${a_id} 819 a.id = ${a_id}
874 </dc:statement> 820 </dc:statement>
875 <dc:for-each> 821 <dc:for-each>
876 <dc:element name="${facet_name}"> 822 <dc:element name="${facet_name}">
877 <dc:attribute name="factory" value="minfo"/> 823 <dc:attribute name="factory" value="minfo"/>
878 <dc:attribute name="description" value="${facet_description}"/> 824 <dc:attribute name="description" value="${facet_description}"/>
884 </dc:context> 830 </dc:context>
885 </quality-bed> 831 </quality-bed>
886 </dc:for-each> 832 </dc:for-each>
887 </bed_quality_bed> 833 </bed_quality_bed>
888 </dc:if> 834 </dc:if>
889 </dc:context> 835 </dc:filter>
890 </dc:macro> 836 </dc:macro>
891 837
892 <dc:macro name="bedquality-load"> 838 <dc:macro name="bedquality-load">
893 <dc:context> 839 <dc:filter expr="$out_name = 'bed_longitudinal_section'">
894 <dc:statement>
895 SELECT id AS oid
896 FROM outs AS o
897 WHERE
898 o.artifact_id = ${a_id} AND
899 o.name='bed_longitudinal_section'
900 </dc:statement>
901 <dc:if test="dc:has-result()"> 840 <dc:if test="dc:has-result()">
902 <bed_quality_load> 841 <bed_quality_load>
903 <dc:for-each> 842 <dc:for-each>
904 <quality-load description="{$river} {$a_creation} {$collection_name}"> 843 <quality-load description="{$river} {$a_creation} {$collection_name}">
905 <dc:context> 844 <dc:context>
928 </dc:context> 867 </dc:context>
929 </quality-load> 868 </quality-load>
930 </dc:for-each> 869 </dc:for-each>
931 </bed_quality_load> 870 </bed_quality_load>
932 </dc:if> 871 </dc:if>
933 </dc:context> 872 </dc:filter>
934 </dc:macro> 873 </dc:macro>
935 874
936 <dc:macro name="bedquality-density"> 875 <dc:macro name="bedquality-density">
937 <dc:context> 876 <dc:filter expr="$out_name = 'bed_longitudinal_section'">
938 <dc:statement>
939 SELECT id AS oid
940 FROM outs AS o
941 WHERE
942 o.artifact_id = ${a_id} AND
943 o.name='bed_longitudinal_section'
944 </dc:statement>
945 <dc:if test="dc:has-result()"> 877 <dc:if test="dc:has-result()">
946 <bed_quality_density> 878 <bed_quality_density>
947 <dc:for-each> 879 <dc:for-each>
948 <density description="{$river} {$a_creation} {$collection_name}"> 880 <density description="{$river} {$a_creation} {$collection_name}">
949 <dc:context> 881 <dc:context>
973 </dc:context> 905 </dc:context>
974 </density> 906 </density>
975 </dc:for-each> 907 </dc:for-each>
976 </bed_quality_density> 908 </bed_quality_density>
977 </dc:if> 909 </dc:if>
978 </dc:context> 910 </dc:filter>
979 </dc:macro> 911 </dc:macro>
980 912
981 <dc:macro name="bedquality-porosity"> 913 <dc:macro name="bedquality-porosity">
982 <dc:context> 914 <dc:filter expr="$out_name = 'bed_longitudinal_section'">
983 <dc:statement>
984 SELECT id AS oid
985 FROM outs AS o
986 WHERE
987 o.artifact_id = ${a_id} AND
988 o.name='bed_longitudinal_section'
989 </dc:statement>
990 <dc:if test="dc:has-result()"> 915 <dc:if test="dc:has-result()">
991 <bed_quality_porosity> 916 <bed_quality_porosity>
992 <dc:for-each> 917 <dc:for-each>
993 <porosity description="{$river} {$a_creation} {$collection_name}"> 918 <porosity description="{$river} {$a_creation} {$collection_name}">
994 <dc:context> 919 <dc:context>
1018 </dc:context> 943 </dc:context>
1019 </porosity> 944 </porosity>
1020 </dc:for-each> 945 </dc:for-each>
1021 </bed_quality_porosity> 946 </bed_quality_porosity>
1022 </dc:if> 947 </dc:if>
1023 </dc:context> 948 </dc:filter>
1024 </dc:macro> 949 </dc:macro>
1025 950
1026 <dc:macro name="flow-velocity"> 951 <dc:macro name="flow-velocity">
1027 <dc:context> 952 <dc:filter expr="$out_name = 'flow_velocity'">
1028 <dc:statement>
1029 SELECT id AS oid
1030 FROM outs AS o
1031 WHERE
1032 o.artifact_id = ${a_id} and o.name='flow_velocity'
1033 </dc:statement>
1034 <dc:if test="dc:has-result()"> 953 <dc:if test="dc:has-result()">
1035 <flow-velocity> 954 <flow-velocity>
1036 <dc:for-each> 955 <dc:for-each>
1037 <flow description="{$river} {$a_creation} {$collection_name}"> 956 <flow description="{$river} {$a_creation} {$collection_name}">
1038 <dc:context> 957 <dc:context>
1064 </dc:context> 983 </dc:context>
1065 </flow> 984 </flow>
1066 </dc:for-each> 985 </dc:for-each>
1067 </flow-velocity> 986 </flow-velocity>
1068 </dc:if> 987 </dc:if>
1069 </dc:context> 988 </dc:filter>
1070 </dc:macro> 989 </dc:macro>
1071 990
1072 <dc:macro name="sediment-load"> 991 <dc:macro name="sediment-load">
1073 <dc:context> 992 <dc:filter expr="$out_name = 'sedimentload_ls'">
1074 <dc:statement>
1075 SELECT id AS oid
1076 FROM outs AS o
1077 WHERE
1078 o.artifact_id = ${a_id} and o.name='sedimentload_ls'
1079 </dc:statement>
1080 <dc:if test="dc:has-result()"> 993 <dc:if test="dc:has-result()">
1081 <sediment-load> 994 <sediment-load>
1082 <dc:for-each> 995 <dc:for-each>
1083 <load description="{$river} {$a_creation} {$collection_name}"> 996 <load description="{$river} {$a_creation} {$collection_name}">
1084 <dc:context> 997 <dc:context>
1106 </dc:context> 1019 </dc:context>
1107 </load> 1020 </load>
1108 </dc:for-each> 1021 </dc:for-each>
1109 </sediment-load> 1022 </sediment-load>
1110 </dc:if> 1023 </dc:if>
1111 </dc:context> 1024 </dc:filter>
1112 </dc:macro> 1025 </dc:macro>
1113 1026
1114 <dc:macro name="bedheight-differences"> 1027 <dc:macro name="bedheight-differences">
1115 <dc:context> 1028 <dc:filter expr="$out_name = 'bed_difference_year' or $out_name = 'bed_difference_epoch'">
1116 <dc:statement>
1117 SELECT id AS oid,
1118 name AS o_name
1119 FROM outs AS o
1120 WHERE
1121 o.artifact_id = ${a_id} AND
1122 (o.name = 'bed_difference_year' OR
1123 o.name = 'bed_differnece_epoch')
1124 </dc:statement>
1125 <dc:if test="dc:has-result()"> 1029 <dc:if test="dc:has-result()">
1126 <bedheight-differences> 1030 <bedheight-differences>
1127 <dc:for-each> 1031 <dc:for-each>
1128 <difference description="{$river} {$a_creation} {$collection_name}"> 1032 <difference description="{$river} {$a_creation} {$collection_name}">
1129 <dc:context> 1033 <dc:context>
1159 </dc:context> 1063 </dc:context>
1160 </difference> 1064 </difference>
1161 </dc:for-each> 1065 </dc:for-each>
1162 </bedheight-differences> 1066 </bedheight-differences>
1163 </dc:if> 1067 </dc:if>
1164 </dc:context> 1068 </dc:filter>
1165 </dc:macro> 1069 </dc:macro>
1166 1070
1167 <dc:macro name="waterlevels-discharge"> 1071 <dc:macro name="waterlevels-discharge">
1168 <dc:context> 1072 <dc:filter expr="$out_name = 'discharge_longitudinal_section'">
1169 <dc:statement>
1170 SELECT id AS oid
1171 FROM outs AS o
1172 WHERE
1173 o.artifact_id = ${a_id} AND
1174 o.name = 'discharge_longitudinal_section'
1175 </dc:statement>
1176 <dc:if test="dc:has-result()"> 1073 <dc:if test="dc:has-result()">
1177 <waterlevels-discharge> 1074 <waterlevels-discharge>
1178 <dc:for-each> 1075 <dc:for-each>
1179 <discharge description="{$oid} {$river} {$a_id} {$a_creation} {$collection_name}"> 1076 <discharge description="{$oid} {$river} {$a_id} {$a_creation} {$collection_name}">
1180 <dc:context> 1077 <dc:context>
1202 </dc:context> 1099 </dc:context>
1203 </discharge> 1100 </discharge>
1204 </dc:for-each> 1101 </dc:for-each>
1205 </waterlevels-discharge> 1102 </waterlevels-discharge>
1206 </dc:if> 1103 </dc:if>
1207 </dc:context> 1104 </dc:filter>
1208 </dc:macro> 1105 </dc:macro>
1209 <!-- Macros to load system data --> 1106 <!-- Macros to load system data -->
1210 1107
1211 <dc:macro name="annotations"> 1108 <dc:macro name="annotations">
1212 <annotation factory="annotations" ids="{$river_id}"/> 1109 <annotation factory="annotations" ids="{$river_id}"/>
2651 </dc:statement> 2548 </dc:statement>
2652 <dc:macro-body/> 2549 <dc:macro-body/>
2653 </dc:context> 2550 </dc:context>
2654 </dc:macro> 2551 </dc:macro>
2655 2552
2656 <dc:macro name="km-filtered-userdata"> 2553 <dc:macro name="all-user-artifacts">
2657 <dc:context connection="user"> 2554 <dc:context connection="user">
2658 <dc:comment>Select collections and masterartifacts.</dc:comment> 2555 <dc:comment>Select collections and masterartifacts.</dc:comment>
2659 <dc:statement> 2556 <dc:statement>
2660 SELECT c.name AS collection_name, 2557 SELECT c.name AS collection_name,
2661 ma.id AS a_id, 2558 ma.id AS a_id,
2663 ma.gid AS a_gid, 2560 ma.gid AS a_gid,
2664 ma.creation AS a_creation, 2561 ma.creation AS a_creation,
2665 COALESCE(ma.ld_mode, '') AS ld_m, 2562 COALESCE(ma.ld_mode, '') AS ld_m,
2666 COALESCE(ma.ld_locations, '') AS ld_l, 2563 COALESCE(ma.ld_locations, '') AS ld_l,
2667 COALESCE(ma.ld_from, '') AS ld_f, 2564 COALESCE(ma.ld_from, '') AS ld_f,
2668 COALESCE(ma.ld_to, '') AS ld_t 2565 COALESCE(ma.ld_to, '') AS ld_t,
2566 o.name AS out_name,
2567 o.id AS out_id
2669 FROM users u 2568 FROM users u
2670 JOIN collections c ON c.user_id = u.id 2569 JOIN collections c ON c.user_id = u.id
2671 JOIN master_artifacts_range ma ON ma.collection_id = c.id 2570 JOIN master_artifacts_range ma ON ma.collection_id = c.id
2571 JOIN outs o ON o.artifact_id = ma.id
2672 WHERE u.gid = CAST(${user-id} AS UUID) 2572 WHERE u.gid = CAST(${user-id} AS UUID)
2673 AND ma.gid &lt;&gt; CAST(${artifact-id} AS uuid) 2573 AND ma.gid &lt;&gt; CAST(${artifact-id} AS uuid)
2674 AND EXISTS ( 2574 AND EXISTS (
2675 SELECT id 2575 SELECT id
2676 FROM artifact_data ad 2576 FROM artifact_data ad
2677 WHERE ad.artifact_id = ma.id 2577 WHERE ad.artifact_id = ma.id
2678 AND k = 'river' 2578 AND k = 'river'
2679 AND v = ${river}) 2579 AND v = ${river})
2680 </dc:statement> 2580 </dc:statement>
2681 <dc:for-each> 2581 <dc:virtual-column name="deffrom" type="number" expr="dc:fromValue($ld_m, $ld_l, $ld_f)">
2682 <dc:variable name="from" type="number" expr="dc:fromValue($ld_m, $ld_l, $ld_f)"/> 2582 <dc:virtual-column name="defto" type="number" expr="dc:toValue($ld_m, $ld_l, $ld_t)">
2683 <dc:variable name="to" type="number" expr="dc:toValue($ld_m, $ld_l, $ld_t)"/> 2583 <dc:macro-body/>
2684 <dc:if test="not (($tokm &lt; $from) or $fromkm &gt; $tokm)"> 2584 </dc:virtual-column>
2685 <dc:macro-body/> 2585 </dc:virtual-column>
2686 </dc:if>
2687 </dc:for-each>
2688 </dc:context> 2586 </dc:context>
2587 </dc:macro>
2588
2589 <dc:macro name="km-filtered-user-artifacts">
2590 <dc:filter expr="not($deffrom &gt; $tokm or $defto &lt; $fromkm)">
2591 <dc:macro-body/>
2592 </dc:filter>
2689 </dc:macro> 2593 </dc:macro>
2690 2594
2691 <dc:macro name="user-range"> 2595 <dc:macro name="user-range">
2692 <dc:choose> 2596 <dc:choose>
2693 <dc:when test="dc:contains($parameters, 'user-id')"> 2597 <dc:when test="dc:contains($parameters, 'user-id')">

http://dive4elements.wald.intevation.org