From 0d9731167f89130cb7c3875eea19913a0cac6f66 Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Thu, 20 Jun 2013 15:51:39 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@77201 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../ecoengine/evaluation/DiscrepancyAnalysis.java | 2 ++ .../dataanalysis/ecoengine/utils/DatabaseUtils.java | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/DiscrepancyAnalysis.java b/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/DiscrepancyAnalysis.java index 988d5b7..b8e4866 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/DiscrepancyAnalysis.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/evaluation/DiscrepancyAnalysis.java @@ -132,6 +132,7 @@ public class DiscrepancyAnalysis extends DataAnalysis { output.put("NUMBER_OF_ERRORS", "0"); output.put("NUMBER_OF_COMPARISONS", "" + numberofvectors); output.put("ACCURACY", "100.0"); + output.put("RELATIVE ERROR", "-"); output.put("MAXIMUM_ERROR", "0"); output.put("MAXIMUM_ERROR_POINT", "-"); output.put("COHENS_KAPPA", "1"); @@ -172,6 +173,7 @@ public class DiscrepancyAnalysis extends DataAnalysis { output.put("NUMBER_OF_ERRORS", "" + numberoferrors); output.put("NUMBER_OF_COMPARISONS", "" + numberofcomparisons); output.put("ACCURACY", "" + MathFunctions.roundDecimal(accuracy,2)); + output.put("RELATIVE ERROR", "" + MathFunctions.roundDecimal(mean/maxerror,2)); output.put("MAXIMUM_ERROR", "" + MathFunctions.roundDecimal(maxerror,2)); output.put("MAXIMUM_ERROR_POINT", maxdiscrepancyPoint); output.put("COHENS_KAPPA", "" + kappa); diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/utils/DatabaseUtils.java b/src/main/java/org/gcube/dataanalysis/ecoengine/utils/DatabaseUtils.java index 931ae09..27c837c 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/utils/DatabaseUtils.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/utils/DatabaseUtils.java @@ -181,6 +181,16 @@ public class DatabaseUtils { return "COPY "+table+" FROM '"+file+"' DELIMITERS ';' WITH NULL AS 'null string'"; } + public static String copyFileFromTableStatement (String file, String table, String delimiter, boolean withheader){ + + String withheaderS=""; + if (withheader) + withheaderS = "WITH CSV HEADER"; + + return "COPY "+table+" TO '"+file+"' DELIMITERS '"+delimiter+"' WITH NULL AS 'null string' "+withheaderS; + } + + public static String updateTableColumnFromOther(String tableName, String fieldToUpdate,String otherTable,String otherColumn,String keyColumn,String otherKeyColumn){ return "UPDATE "+tableName+" SET "+fieldToUpdate+" = "+otherTable+"."+otherColumn+" FROM "+otherTable+" WHERE "+tableName+"."+keyColumn +"="+ otherTable+"."+otherKeyColumn; }