changeset 3393:525e976102ac

S/Q relation: Out commented the LEFT JOINs which produce a lot of empty and redundant data. flys-artifacts/trunk@5021 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 17 Jul 2012 07:22:17 +0000
parents 56f62b5209f5
children f091f2f55f88
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java
diffstat 3 files changed, 27 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jul 16 18:26:00 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jul 17 07:22:17 2012 +0000
@@ -1,3 +1,12 @@
+2012-07-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java:
+	  User Q_BPEGEL as symbolic name for Q
+
+	* src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java:
+	  Out commented the LEFT JOINs which produce a lot of empty and
+	  redundant data. Bring them back in when we treat subsamples right.
+
 2012-07-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/Parameters.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Mon Jul 16 18:26:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Tue Jul 17 07:22:17 2012 +0000
@@ -27,7 +27,7 @@
     }
 
     public double Q() {
-        return get("Q");
+        return get("Q_BPEGEL");
     }
 
     public double TOTAL_BL() {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Mon Jul 16 18:26:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Tue Jul 17 07:22:17 2012 +0000
@@ -44,21 +44,21 @@
             "m.TSAND    AS TSAND,"   +
             "m.TSCHWEB  AS TSCHWEB," +
             "m.CSCHWEB  AS CSCHWEB," +
-            "m.Q_BPEGEL AS Q," +
-            "%GSIEBSATZ%," +
-            "%SSIEBUNG% " +
+            "m.Q_BPEGEL AS Q_BPEGEL " +
+        //    ", %GSIEBSATZ% " +
+        //    "%SSIEBUNG% " +
         "FROM messung m " +
             "JOIN station   s ON m.stationid   = s.stationid " +
             "JOIN gewaesser g ON s.gewaesserid = g.gewaesserid " +
-            "LEFT JOIN GSIEBSATZ gs ON m.gsiebsatzid = gs.gsiebsatzid " +
-            "LEFT JOIN SSIEBUNG  ss ON gs.gsiebsatzid = ss.gsiebsatzid " +
+          //  "LEFT JOIN GSIEBSATZ gs ON m.gsiebsatzid = gs.gsiebsatzid " +
+          //  "LEFT JOIN SSIEBUNG  ss ON gs.gsiebsatzid = ss.gsiebsatzid " +
         "WHERE " +
-            "g.name = :river_name AND " +
-            "s.km BETWEEN :location - 0.001 AND :location + 0.001 AND " +
-            "m.datum BETWEEN :from AND :to AND " +
-            "m.Q_BPEGEL IS NOT NULL")
-        .replace("%GSIEBSATZ%", projection("gs", GSIEBSATZ))
-        .replace("%SSIEBUNG%",  projection("ss", SSIEBUNG));
+            "g.name = :river_name " +
+            "AND m.Q_BPEGEL IS NOT NULL " + 
+            "AND s.km BETWEEN :location - 0.001 AND :location + 0.001 " +
+            "AND m.datum BETWEEN :from AND :to ");
+        //.replace("%GSIEBSATZ%", projection("gs", GSIEBSATZ));
+        //.replace("%SSIEBUNG%",  projection("ss", SSIEBUNG));
 
     private static final String projection(
         String    prefix,
@@ -115,11 +115,12 @@
         }
 
         SQLQuery query = session.createSQLQuery(SQL_MEASSURE)
-            .addScalar("TSAND",   StandardBasicTypes.DOUBLE)
-            .addScalar("TSCHWEB", StandardBasicTypes.DOUBLE)
-            .addScalar("CSCHWEB", StandardBasicTypes.DOUBLE)
-            .addScalar("Q",       StandardBasicTypes.DOUBLE);
+            .addScalar("TSAND",    StandardBasicTypes.DOUBLE)
+            .addScalar("TSCHWEB",  StandardBasicTypes.DOUBLE)
+            .addScalar("CSCHWEB",  StandardBasicTypes.DOUBLE)
+            .addScalar("Q_BPEGEL", StandardBasicTypes.DOUBLE);
 
+        /*
         for (String siebsatz: GSIEBSATZ) {
             query.addScalar(siebsatz, StandardBasicTypes.DOUBLE);
         }
@@ -127,6 +128,7 @@
         for (String siebung: SSIEBUNG) {
             query.addScalar(siebung, StandardBasicTypes.DOUBLE);
         }
+        */
 
         query.setString("river_name", river);
         query.setDouble("location", location);

http://dive4elements.wald.intevation.org