Mercurial > dive4elements > river
comparison artifacts/doc/conf/meta-data.xml @ 8120:b57f4bcd0f6f
Remove code duplications in sedimentload datacage.
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Fri, 22 Aug 2014 13:19:02 +0200 |
parents | a9a6414b3563 |
children | 82af749d5ab3 |
comparison
equal
deleted
inserted
replaced
8119:a9a6414b3563 | 8120:b57f4bcd0f6f |
---|---|
1352 p.id AS pid, | 1352 p.id AS pid, |
1353 p.description AS description, | 1353 p.description AS description, |
1354 d.lower AS depth_lower, | 1354 d.lower AS depth_lower, |
1355 d.upper AS depth_upper, | 1355 d.upper AS depth_upper, |
1356 p.description || '<BR>' || | 1356 p.description || '<BR>' || |
1357 'Tiefe: ' || d.lower || ' - ' || d.upper | 1357 'Tiefe: ' || d.lower || ' - ' || d.upper |
1358 || ' cm <BR>' || | 1358 || ' cm <BR>' || |
1359 'Zeitraum: ' AS info, | 1359 'Zeitraum: ' AS info, |
1360 t.start_time AS syear, | 1360 t.start_time AS syear, |
1361 t.stop_time AS eyear | 1361 t.stop_time AS eyear |
1362 FROM porosity p | 1362 FROM porosity p |
1407 </dc:if> | 1407 </dc:if> |
1408 </dc:context> | 1408 </dc:context> |
1409 </densities> | 1409 </densities> |
1410 </dc:macro> | 1410 </dc:macro> |
1411 | 1411 |
1412 <dc:macro name="one-load"> | 1412 <dc:macro name="load"> |
1413 <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $year)"/> | 1413 <year description="{$timespan}" |
1414 <year description="{$syear}" | |
1415 factory="sedimentload" | 1414 factory="sedimentload" |
1416 target_out="{$out}" | 1415 target_out="{$out}" |
1417 info="{$description}" | 1416 info="{$description}" |
1418 ids="{$syid};{$fraction};{$syear}" /> | 1417 ids="{$syid};{$fraction};{$timespan}" /> |
1419 </dc:macro> | 1418 </dc:macro> |
1420 | 1419 |
1421 <dc:macro name="epoch-load"> | 1420 <dc:macro name="load_ls"> |
1422 <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $startyear)"/> | 1421 <year description="{$timespan}" |
1423 <dc:variable name="eyear" type="string" expr="dc:date-format('yyyy', $endyear)"/> | |
1424 <year description="{$syear}-{$eyear}" | |
1425 factory="sedimentload" | |
1426 target_out="{$out}" | |
1427 info="{$description}" | |
1428 ids="{$syid};{$fraction};{$syear}-{$eyear}" /> | |
1429 </dc:macro> | |
1430 | |
1431 <dc:macro name="one-load_ls"> | |
1432 <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $year)"/> | |
1433 <year description="{$syear}" | |
1434 factory="sedimentload_ls" | 1422 factory="sedimentload_ls" |
1435 target_out="{$out}" | 1423 target_out="{$out}" |
1436 info="{$description}" | 1424 info="{$description}" |
1437 ids="{$syid};{$syear}" /> | 1425 ids="{$syid};{$timespan}" /> |
1438 </dc:macro> | |
1439 | |
1440 <dc:macro name="epoch-load_ls"> | |
1441 <dc:variable name="syear" type="string" expr="dc:date-format('yyyy', $startyear)"/> | |
1442 <dc:variable name="eyear" type="string" expr="dc:date-format('yyyy', $endyear)"/> | |
1443 <year description="{$syear}-{$eyear}" | |
1444 factory="sedimentload_ls" | |
1445 target_out="{$out}" | |
1446 info="{$description}" | |
1447 ids="{$syid};{$syear}-{$eyear}" /> | |
1448 </dc:macro> | 1426 </dc:macro> |
1449 | 1427 |
1450 <dc:macro name="loads"> | 1428 <dc:macro name="loads"> |
1451 <dc:if test="dc:has-result()"> | 1429 <dc:if test="dc:has-result()"> |
1452 <dc:group expr="$fraction"> | 1430 <dc:group expr="$fraction"> |
1453 <dc:variable name="fraction_name" expr="concat('\${', dc:group-key(), '}')"/> | 1431 <dc:variable name="fraction_name" expr="concat('\${', dc:group-key(), '}')"/> |
1454 <fraction description="{$fraction_name}"> | 1432 <fraction description="{$fraction_name}"> |
1455 <dc:for-each> | 1433 <dc:for-each> |
1456 <dc:macro-body/> | 1434 <dc:choose> |
1435 <dc:when test="string-length(dc:get('endyear')) = 0"> | |
1436 <dc:variable name="timespan" type="string" | |
1437 expr="dc:date-format('yyyy', $startyear)"/> | |
1438 </dc:when> | |
1439 <dc:otherwise> | |
1440 <dc:variable name="timespan" type="string" | |
1441 expr="concat(dc:date-format('yyyy', $startyear), | |
1442 '-', dc:date-format('yyyy', $endyear))"/> | |
1443 </dc:otherwise> | |
1444 </dc:choose> | |
1445 <dc:macro-body/> | |
1457 </dc:for-each> | 1446 </dc:for-each> |
1458 </fraction> | 1447 </fraction> |
1459 </dc:group> | 1448 </dc:group> |
1460 </dc:if> | 1449 </dc:if> |
1450 </dc:macro> | |
1451 | |
1452 <dc:macro name="sedimentloads-filter"> | |
1453 <years> | |
1454 <dc:filter expr="string-length(dc:get('endyear')) = 0" > | |
1455 <dc:macro-body/> | |
1456 </dc:filter> | |
1457 </years> | |
1458 <epochs> | |
1459 <dc:filter expr="string-length(dc:get('endyear')) > 0" > | |
1460 <dc:macro-body/> | |
1461 </dc:filter> | |
1462 </epochs> | |
1461 </dc:macro> | 1463 </dc:macro> |
1462 | 1464 |
1463 <dc:macro name="sedimentloads"> | 1465 <dc:macro name="sedimentloads"> |
1464 <dc:comment> | 1466 <dc:comment> |
1465 This is the macro for static datacage "Sedimentloads". | 1467 This is the macro for static datacage "Sedimentloads". |
1466 Or "Frachten". | 1468 Or "Frachten". |
1467 </dc:comment> | 1469 </dc:comment> |
1468 <sedimentloads> | 1470 <sedimentloads> |
1469 <dc:call-macro name="annotations_sediment_load_ls"/> | 1471 <dc:call-macro name="annotations_sediment_load_ls"/> |
1470 <measurement_stations> | 1472 <measurement_stations> |
1471 <years> | 1473 <dc:context> |
1472 <dc:context> | 1474 <dc:statement> |
1473 <dc:statement> | 1475 SELECT DISTINCT |
1474 SELECT DISTINCT | 1476 sy.id AS syid, |
1475 sy.id AS syid, | 1477 sy.description AS description, |
1476 sy.description AS description, | 1478 ti.start_time AS startyear, |
1477 ti.start_time AS year, | 1479 ti.stop_time AS endyear, |
1478 gf.name AS fraction | 1480 gf.name AS fraction |
1479 FROM sediment_load sy | 1481 FROM sediment_load sy |
1480 JOIN sediment_load_values syv | 1482 JOIN sediment_load_values syv |
1481 ON sy.id = syv.sediment_load_id | 1483 ON sy.id = syv.sediment_load_id |
1482 JOIN measurement_station ms | 1484 JOIN measurement_station ms |
1483 ON ms.id = syv.measurement_station_id | 1485 ON ms.id = syv.measurement_station_id |
1484 JOIN rivers r ON ms.river_id = r.id | 1486 JOIN rivers r ON ms.river_id = r.id |
1485 JOIN time_intervals ti ON sy.time_interval_id = ti.id | 1487 JOIN time_intervals ti ON sy.time_interval_id = ti.id |
1486 JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id | 1488 JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id |
1487 WHERE r.id = ${river_id} | 1489 WHERE r.id = ${river_id} |
1488 AND ti.stop_time IS NULL | 1490 AND ms.station BETWEEN ${fromkm} AND ${tokm} |
1489 AND ms.station BETWEEN ${fromkm} AND ${tokm} | 1491 ORDER BY fraction, startyear DESC, endyear DESC |
1490 ORDER BY fraction, year DESC | 1492 </dc:statement> |
1491 </dc:statement> | 1493 <dc:call-macro name="sedimentloads-filter"> |
1492 <dc:call-macro name="loads"> | 1494 <dc:call-macro name="loads"> |
1493 <dc:call-macro name="one-load"/> | 1495 <dc:call-macro name="load"/> |
1494 </dc:call-macro> | 1496 </dc:call-macro> |
1495 </dc:context> | 1497 </dc:call-macro> |
1496 </years> | 1498 </dc:context> |
1497 <epochs> | |
1498 <dc:context> | |
1499 <dc:statement> | |
1500 SELECT DISTINCT | |
1501 sy.id AS syid, | |
1502 sy.description AS description, | |
1503 ti.start_time AS startyear, | |
1504 ti.stop_time AS endyear, | |
1505 gf.name AS fraction | |
1506 FROM sediment_load sy | |
1507 JOIN sediment_load_values syv | |
1508 ON sy.id = syv.sediment_load_id | |
1509 JOIN measurement_station ms | |
1510 ON ms.id = syv.measurement_station_id | |
1511 JOIN rivers r ON ms.river_id = r.id | |
1512 JOIN time_intervals ti ON sy.time_interval_id = ti.id | |
1513 JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id | |
1514 WHERE r.id = ${river_id} | |
1515 AND ti.stop_time IS NOT NULL | |
1516 AND ms.station BETWEEN ${fromkm} AND ${tokm} | |
1517 ORDER BY fraction, startyear DESC, endyear DESC | |
1518 </dc:statement> | |
1519 <dc:call-macro name="loads"> | |
1520 <dc:call-macro name="epoch-load"/> | |
1521 </dc:call-macro> | |
1522 </dc:context> | |
1523 </epochs> | |
1524 </measurement_stations> | 1499 </measurement_stations> |
1525 <sediment_load_ls> | 1500 <sediment_load_ls> |
1526 <years> | 1501 <dc:context> |
1527 <dc:context> | 1502 <dc:statement> |
1528 <dc:statement> | 1503 SELECT DISTINCT |
1529 SELECT DISTINCT | 1504 sy.id AS syid, |
1530 sy.id AS syid, | 1505 sy.description AS description, |
1531 sy.description AS description, | 1506 ti.start_time AS startyear, |
1532 ti.start_time AS year, | 1507 ti.stop_time AS endyear, |
1533 gf.name AS fraction | 1508 gf.name AS fraction |
1534 FROM sediment_load_ls sy | 1509 FROM sediment_load_ls sy |
1535 JOIN rivers r ON sy.river_id = r.id | 1510 JOIN rivers r ON sy.river_id = r.id |
1536 JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id | 1511 JOIN sediment_load_ls_values syv |
1537 JOIN time_intervals ti ON sy.time_interval_id = ti.id | 1512 ON sy.id = syv.sediment_load_ls_id |
1538 JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id | 1513 JOIN time_intervals ti ON sy.time_interval_id = ti.id |
1539 WHERE r.id = ${river_id} | 1514 JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id |
1540 AND ti.stop_time IS NULL | 1515 WHERE r.id = ${river_id} |
1541 AND syv.station BETWEEN ${fromkm} AND ${tokm} | 1516 AND syv.station BETWEEN ${fromkm} AND ${tokm} |
1542 ORDER BY fraction, year DESC | 1517 ORDER BY fraction, startyear DESC, endyear DESC |
1543 </dc:statement> | 1518 </dc:statement> |
1519 <dc:call-macro name="sedimentloads-filter"> | |
1544 <dc:call-macro name="loads"> | 1520 <dc:call-macro name="loads"> |
1545 <dc:call-macro name="one-load_ls"/> | 1521 <dc:call-macro name="load_ls"/> |
1546 </dc:call-macro> | 1522 </dc:call-macro> |
1547 </dc:context> | 1523 </dc:call-macro> |
1548 </years> | 1524 </dc:context> |
1549 <epochs> | |
1550 <dc:context> | |
1551 <dc:statement> | |
1552 SELECT DISTINCT | |
1553 sy.id AS syid, | |
1554 sy.description AS description, | |
1555 ti.start_time AS startyear, | |
1556 ti.stop_time AS endyear, | |
1557 gf.name AS fraction | |
1558 FROM sediment_load_ls sy | |
1559 JOIN rivers r ON sy.river_id = r.id | |
1560 JOIN sediment_load_ls_values syv ON sy.id = syv.sediment_load_ls_id | |
1561 JOIN time_intervals ti ON sy.time_interval_id = ti.id | |
1562 JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id | |
1563 WHERE r.id = ${river_id} | |
1564 AND ti.stop_time IS NOT NULL | |
1565 AND syv.station BETWEEN ${fromkm} AND ${tokm} | |
1566 ORDER BY fraction, startyear DESC, endyear DESC | |
1567 </dc:statement> | |
1568 <dc:call-macro name="loads"> | |
1569 <dc:call-macro name="epoch-load_ls"/> | |
1570 </dc:call-macro> | |
1571 </dc:context> | |
1572 </epochs> | |
1573 </sediment_load_ls> | 1525 </sediment_load_ls> |
1574 </sedimentloads> | 1526 </sedimentloads> |
1575 </dc:macro> | 1527 </dc:macro> |
1576 | 1528 |
1577 | 1529 |