comparison artifacts/doc/conf/meta-data.xml @ 7970:d66ea32d98bc

Updated macros and db statement for minfo bedheight differences.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 Jun 2014 14:54:04 +0200
parents d13859c0ef51
children 02b7ef079e6f
comparison
equal deleted inserted replaced
7968:09c9920e6f24 7970:d66ea32d98bc
1732 bhsv.station, 1732 bhsv.station,
1733 bhs.year 1733 bhs.year
1734 FROM bed_height_single bhs 1734 FROM bed_height_single bhs
1735 JOIN bed_height_single_values bhsv 1735 JOIN bed_height_single_values bhsv
1736 ON bhsv.bed_height_single_id = bhs.id 1736 ON bhsv.bed_height_single_id = bhs.id
1737 WHERE bhs.river_id = ${river_id} 1737 WHERE bhs.river_id = ${river_id}),
1738 AND bhs.year BETWEEN ${year_from} AND ${year_to}),
1739 csta 1738 csta
1740 AS (SELECT b1.id AS id1, 1739 AS (SELECT b1.id AS b1id,
1741 b1.description AS b1desc, 1740 b1.description AS b1desc,
1742 b1.year AS b1year, 1741 b1.year AS b1year,
1743 b2.id AS id2, 1742 b2.id AS b2id,
1744 b2.description AS b2desv, 1743 b2.description AS b2desc,
1745 b2.year AS b2year 1744 b2.year AS b2year
1746 FROM sta b1 1745 FROM sta b1
1747 JOIN sta b2 1746 JOIN sta b2
1748 ON b1.station = b2.station 1747 ON b1.station = b2.station
1749 AND b1.id &lt; b2.id) 1748 AND b1.id &lt; b2.id)
1750 SELECT id1, b1desc, b1year, 1749 SELECT DISTINCT b1id, b1desc, b1year,
1751 id2, b2desc, b2year 1750 b2id, b2desc, b2year
1752 FROM csta 1751 FROM csta
1753 ORDER BY b1year, b2year 1752 ORDER BY b1desc, b2desc
1754 </dc:statement> 1753 </dc:statement>
1755 <dc:if test="dc:has-result()"> 1754 <dc:if test="dc:has-result()">
1756 <bedheights> 1755 <bedheights>
1757 <dc:call-macro name="bed-heights-single-diff"/> 1756 <dc:call-macro name="bed-heights-single-diff"/>
1758 <dc:call-macro name="bed-heights-epoch-diff"/> 1757 <dc:call-macro name="bed-heights-epoch-diff"/>
1761 </dc:context> 1760 </dc:context>
1762 </dc:call-macro> 1761 </dc:call-macro>
1763 </dc:macro> 1762 </dc:macro>
1764 1763
1765 <dc:macro name="bed-heights-single-diff"> 1764 <dc:macro name="bed-heights-single-diff">
1766 <dc:filter expr="not(contains(lower-case($b1desc), 'epoche') or contains(lower-case($b2desc), 'epoche'))"> 1765 <dc:filter expr="not(contains(dc:lowercase($b1desc), 'epoche') or contains(dc:lowercase($b2desc), 'epoche'))">
1767 <years> 1766 <years>
1768 <dc:call-macro name="bed-heights-diff-tree"/> 1767 <dc:call-macro name="minfo-heights-diff-tree"/>
1769 </years> 1768 </years>
1770 </dc:filter> 1769 </dc:filter>
1771 </dc:macro> 1770 </dc:macro>
1772 1771
1773 <dc:macro name="bed-heights-epoch-diff"> 1772 <dc:macro name="bed-heights-epoch-diff">
1774 <dc:filter expr="contains(lower-case($b1desc), 'epoche') and contains(lower-case($b2desc), 'epoche')"> 1773 <dc:filter expr="contains(dc:lowercase($b1desc), 'epoche') and contains(dc:lowercase($b2desc), 'epoche')">
1775 <epochs> 1774 <epochs>
1776 <dc:call-macro name="bed-heights-diff-tree"/> 1775 <dc:call-macro name="minfo-heights-diff-tree"/>
1777 </epochs> 1776 </epochs>
1778 </dc:filter> 1777 </dc:filter>
1779 </dc:macro> 1778 </dc:macro>
1780 1779
1781 <dc:macro name="minfo-heights-diff-tree"> 1780 <dc:macro name="minfo-heights-diff-tree">
1782 <dc:group expr="$b1year #!# $b2year"> 1781 <dc:group expr="dc:coalesce($b1year, 'sonstige') #!# dc:coalesce($b2year, 'sonstige')">
1783 <dc:element name="${dc:group-key()}"> 1782 <minfo-diff name="{dc:group-key()}">
1784 <dc:comment>TODO: Better structure</dc:comment>
1785 <dc:for-each> 1783 <dc:for-each>
1786 <dc:comment>A - B</dc:comment> 1784 <dc:choose>
1787 <height factory="bedheight" 1785 <dc:when test="dc:group-key() = $b1year">
1788 target_out="{$out}" 1786 <height factory="bedheight"
1789 ids="bedheight-single-{$b1id}-{$b2id}" 1787 target_out="{$out}"
1790 description="{$b1desc} - {$b2desc}"/> 1788 ids="bedheight-single-{$b1id}-{$b1year}#bedheight-single-{$b2id}-{$b2year}"
1791 <dc:comment>B - A</dc:comment> 1789 info="{$b1desc}#{$b2desc}"
1792 <height factory="bedheight" 1790 description="{$b1desc} - {$b2desc}"/>
1793 target_out="{$out}" 1791 </dc:when>
1794 ids="bedheight-single-{$b2id}-{$b1id}" 1792 <dc:when test="dc:group-key() = 'sonstige'">
1795 description="{$b2desc} - {$b1desc}"/> 1793 <height factory="bedheight"
1794 target_out="{$out}"
1795 ids="bedheight-single-{$b1id}-{$b1year}#bedheight-single-{$b2id}-{$b2year}"
1796 info="{$b1desc}#{$b2desc}"
1797 description="{$b1desc} - {$b2desc}"/>
1798 <height factory="bedheight"
1799 target_out="{$out}"
1800 ids="bedheight-single-{$b2id}-{$b2year}#bedheight-single-{$b1id}-{$b1year}"
1801 info="{$b1desc}#{$b2desc}"
1802 description="{$b2desc} - {$b1desc}"/>
1803 </dc:when>
1804 <dc:otherwise>
1805 <height factory="bedheight"
1806 target_out="{$out}"
1807 ids="bedheight-single-{$b2id}-{$b2year}#bedheight-single-{$b1id}-{$b1year}"
1808 info="{$b1desc}#{$b2desc}"
1809 description="{$b2desc} - {$b1desc}"/>
1810 </dc:otherwise>
1811 </dc:choose>
1796 </dc:for-each> 1812 </dc:for-each>
1797 </dc:element> 1813 </minfo-diff>
1798 </dc:group> 1814 </dc:group>
1799 </dc:macro> 1815 </dc:macro>
1800 1816
1801 <dc:macro name="minfo-heights"> 1817 <dc:macro name="minfo-heights">
1802 <dc:call-macro name="minfo-heights-years"> 1818 <dc:call-macro name="minfo-heights-years">

http://dive4elements.wald.intevation.org