This commit is contained in:
Gianpaolo Coro 2012-10-09 12:50:04 +00:00
parent 8c195c4b9b
commit 52c38a92ee
16 changed files with 108 additions and 63 deletions

View File

@ -8,5 +8,5 @@ ABSENCE_CELLS_FROM_AQUAMAPS=org.gcube.dataanalysis.ecoengine.transducers.simpleq
PRESENCE_CELLS_GENERATION=org.gcube.dataanalysis.ecoengine.transducers.simplequeryexecutors.MarinePresencePoints
OCCURRENCES_MERGER=org.gcube.dataanalysis.ecoengine.transducers.OccurrencePointsMerger
OCCURRENCES_INTERSECTOR=org.gcube.dataanalysis.ecoengine.transducers.OccurrencePointsIntersector
OCCURRENCES_INSEAS_ONEARTH=org.gcube.dataanalysis.ecoengine.transducers.OccurrencePointsInSeaOnEarth
OCCURRENCES_DUPLICATE_DELETER=org.gcube.dataanalysis.ecoengine.transducers.OccurrencePointsDuplicatesDeleter
OCCURRENCES_MARINE_TERRESTRIAL=org.gcube.dataanalysis.ecoengine.transducers.OccurrencePointsInSeaOnEarth
OCCURRENCES_DUPLICATES_DELETER=org.gcube.dataanalysis.ecoengine.transducers.OccurrencePointsDuplicatesDeleter

View File

@ -42,6 +42,7 @@ public class DBScan implements Clusterer{
protected ExampleSet points;
protected ArrayList<ArrayList<String>> rows;
protected String OccurrencePointsTable;
protected String OccurrencePointsClusterLabel;
protected String OccurrencePointsClusterTable;
protected String FeaturesColumnNames;
protected float status;
@ -211,6 +212,7 @@ public class DBScan implements Clusterer{
epsilon=config.getParam("epsilon");
minPoints = config.getParam("min_points");
OccurrencePointsTable = config.getParam("OccurrencePointsTable").toLowerCase();
OccurrencePointsClusterLabel=config.getParam("OccurrencePointsClusterLabel");
OccurrencePointsClusterTable=config.getParam("OccurrencePointsClusterTable").toLowerCase();
FeaturesColumnNames=config.getParam("FeaturesColumnNames");
this.config=config;
@ -386,7 +388,7 @@ public class DBScan implements Clusterer{
public StatisticalType getOutput() {
List<TableTemplates> templateHspec = new ArrayList<TableTemplates>();
templateHspec.add(TableTemplates.CLUSTER);
return new OutputTable(templateHspec,OccurrencePointsClusterTable,OccurrencePointsClusterTable,"Output cluster table");
return new OutputTable(templateHspec,OccurrencePointsClusterLabel,OccurrencePointsClusterTable,"Output cluster table");
}
@Override
@ -395,13 +397,15 @@ public class DBScan implements Clusterer{
List<TableTemplates> templateOccs = new ArrayList<TableTemplates>();
templateOccs.add(TableTemplates.GENERIC);
InputTable p1 = new InputTable(templateOccs,"OccurrencePointsTable","Occurrence Points Table","occurrences");
ColumnTypesList p2 = new ColumnTypesList ("OccurrencePointsTable","FeaturesColumnNames", "Column Names for the features", false);
ServiceType p3 = new ServiceType(ServiceParameters.RANDOMSTRING, "OccurrencePointsClusterTable","Table name of the distribution","occCluster_");
ColumnTypesList p2 = new ColumnTypesList ("OccurrencePointsTable","FeaturesColumnNames", "column Names for the features", false);
PrimitiveType p0 = new PrimitiveType(String.class.getName(), null, PrimitiveTypes.STRING, "OccurrencePointsClusterLabel","table name of the resulting distribution","OccCluster_");
ServiceType p3 = new ServiceType(ServiceParameters.RANDOMSTRING, "OccurrencePointsClusterTable","table name of the distribution","occCluster_");
PrimitiveType p4 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "epsilon","DBScan epsilon parameter","10");
PrimitiveType p5 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "min_points","DBScan minimum points parameter (identifies outliers)","1");
parameters.add(p1);
parameters.add(p2);
parameters.add(p0);
parameters.add(p3);
parameters.add(p4);
parameters.add(p5);

View File

@ -62,6 +62,7 @@ public class KMeans extends DBScan{
kk=config.getParam("k");
maxRuns= config.getParam("max_runs");
maxOptimizations = config.getParam("max_optimization_steps");
OccurrencePointsClusterLabel=config.getParam("OccurrencePointsClusterLabel");
OccurrencePointsTable = config.getParam("OccurrencePointsTable").toLowerCase();
OccurrencePointsClusterTable=config.getParam("OccurrencePointsClusterTable").toLowerCase();
FeaturesColumnNames=config.getParam("FeaturesColumnNames");
@ -114,16 +115,17 @@ public class KMeans extends DBScan{
List<TableTemplates> templateOccs = new ArrayList<TableTemplates>();
templateOccs.add(TableTemplates.GENERIC);
InputTable p1 = new InputTable(templateOccs,"OccurrencePointsTable","Occurrence Points Table","occurrences");
ColumnTypesList p2 = new ColumnTypesList ("OccurrencePointsTable","FeaturesColumnNames", "Column Names for the features", false);
ServiceType p3 = new ServiceType(ServiceParameters.RANDOMSTRING, "OccurrencePointsClusterTable","Table name of the distribution","occCluster_");
PrimitiveType p4 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "k","Expected Number of Clusters","3");
PrimitiveType p5 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "max_runs","Max runs of the clustering procedure","10");
PrimitiveType p12 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "max_optimization_steps","Max number of internal optimization steps","5");
PrimitiveType p13 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "min_points","Number of points which define an outlier set","2");
ColumnTypesList p2 = new ColumnTypesList ("OccurrencePointsTable","FeaturesColumnNames", "column Names for the features", false);
PrimitiveType p0 = new PrimitiveType(String.class.getName(), null, PrimitiveTypes.STRING, "OccurrencePointsClusterLabel","table name of the resulting distribution","OccCluster_");
ServiceType p3 = new ServiceType(ServiceParameters.RANDOMSTRING, "OccurrencePointsClusterTable","table name of the distribution","occCluster_");
PrimitiveType p4 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "k","expected Number of Clusters","3");
PrimitiveType p5 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "max_runs","max runs of the clustering procedure","10");
PrimitiveType p12 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "max_optimization_steps","max number of internal optimization steps","5");
PrimitiveType p13 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "min_points","number of points which define an outlier set","2");
parameters.add(p1);
parameters.add(p2);
parameters.add(p0);
parameters.add(p3);
parameters.add(p4);
parameters.add(p5);

View File

@ -120,16 +120,18 @@ public class XMeansWrapper extends DBScan {
templateOccs.add(TableTemplates.GENERIC);
InputTable p1 = new InputTable(templateOccs, "OccurrencePointsTable", "Occurrence Points Table", "occurrences");
ColumnTypesList p2 = new ColumnTypesList ("OccurrencePointsTable","FeaturesColumnNames", "Column Names for the features", false);
ServiceType p3 = new ServiceType(ServiceParameters.RANDOMSTRING, "OccurrencePointsClusterTable", "Table name of the distribution", "occCluster_");
ColumnTypesList p2 = new ColumnTypesList ("OccurrencePointsTable","FeaturesColumnNames", "column Names for the features", false);
PrimitiveType p0 = new PrimitiveType(String.class.getName(), null, PrimitiveTypes.STRING, "OccurrencePointsClusterLabel","table name of the resulting distribution","OccCluster_");
ServiceType p3 = new ServiceType(ServiceParameters.RANDOMSTRING, "OccurrencePointsClusterTable", "table name of the distribution", "occCluster_");
PrimitiveType p4 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "maxIterations", "XMeans max number of overall iterations of the clustering learning", "10");
PrimitiveType p5 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "minClusters", "Minimum number of expected clusters", "1");
PrimitiveType p12 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "maxClusters", "Maximum number of clusters to produce", "50");
PrimitiveType p13 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "min_points", "Number of points which define an outlier set", "2");
PrimitiveType p5 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "minClusters", "minimum number of expected clusters", "1");
PrimitiveType p12 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "maxClusters", "maximum number of clusters to produce", "50");
PrimitiveType p13 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "min_points", "number of points which define an outlier set", "2");
parameters.add(p1);
parameters.add(p2);
parameters.add(p0);
parameters.add(p3);
parameters.add(p4);
parameters.add(p5);
@ -152,8 +154,8 @@ public class XMeansWrapper extends DBScan {
minClusters = config.getParam("minClusters");
maxClusters = config.getParam("maxClusters");
minPoints = config.getParam("min_points");
OccurrencePointsTable = config.getParam("OccurrencePointsTable").toLowerCase();
OccurrencePointsClusterLabel=config.getParam("OccurrencePointsClusterLabel");
OccurrencePointsClusterTable = config.getParam("OccurrencePointsClusterTable").toLowerCase();
FeaturesColumnNames = config.getParam("FeaturesColumnNames");
this.config = config;

View File

@ -23,9 +23,9 @@ public class DiscrepancyAnalysis extends DataAnalysis {
// static String discrepancyQuery = "select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from %5$s as a inner join %6$s as b on a.%1$s=b.%2$s and (a.%3$s<>b.%4$s)";
// static String discrepancyQuery = "select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from (select * from %5$s order by %1$s limit %7$s) as a inner join (select * from %6$s order by %2$s limit %7$s) as b on a.%1$s=b.%2$s and (a.%3$s<>b.%4$s)";
static String discrepancyQuery = "select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from " +
"(select csquarecode,sum(%3$s) as %3$s from (select * from %5$s order by %1$s limit %7$s) as aa group by %1$s) as a " +
"(select csquarecode,sum(%3$s) as %3$s from (select distinct * from %5$s order by %1$s limit %7$s) as aa group by %1$s) as a " +
"inner join " +
"(select csquarecode,sum(%4$s) as %4$s from (select * from %6$s order by %2$s limit %7$s) as aa group by %2$s) as b " +
"(select csquarecode,sum(%4$s) as %4$s from (select distinct * from %6$s order by %2$s limit %7$s) as aa group by %2$s) as b " +
"on a.%1$s=b.%2$s and (a.%3$s<>b.%4$s)";
static String getNumberOfElementsQuery = "select count(*) from %1$s";
@ -117,8 +117,8 @@ public class DiscrepancyAnalysis extends DataAnalysis {
calcDiscrepancy();
output = new HashMap<String, String>();
output.put("MEAN", "" + mean);
output.put("VARIANCE", "" + variance);
output.put("MEAN", "" + MathFunctions.roundDecimal(mean,2));
output.put("VARIANCE", "" + MathFunctions.roundDecimal(variance,2));
output.put("NUMBER_OF_ERRORS", "" + numberoferrors);
output.put("NUMBER_OF_COMPARISONS", "" + numberofvectors);
@ -127,8 +127,8 @@ public class DiscrepancyAnalysis extends DataAnalysis {
accuracy = (1 - (float) numberoferrors / (float) numberofvectors) * 100;
output.put("ACCURACY", "" + accuracy);
output.put("MAXIMUM_ERROR", "" + maxerror);
output.put("ACCURACY", "" + MathFunctions.roundDecimal(accuracy,2));
output.put("MAXIMUM_ERROR", "" + MathFunctions.roundDecimal(maxerror,2));
output.put("MAXIMUM_ERROR_POINT", "" + maxdiscrepancyPoint);
return output;

View File

@ -6,6 +6,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.gcube.contentmanagement.graphtools.utils.MathFunctions;
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.datatypes.ColumnType;
@ -189,12 +190,12 @@ public class DistributionQualityAnalysis extends DataAnalysis {
output.put("TRUE_NEGATIVES", "" + trueNegatives);
output.put("FALSE_POSITIVES", "" + falsePositives);
output.put("FALSE_NEGATIVES", "" + falseNegatives);
output.put("AUC", "" + auc);
output.put("ACCURACY", "" + accuracy);
output.put("SENSITIVITY", "" + sensitivity);
output.put("OMISSIONRATE", "" + omissionrate);
output.put("SPECIFICITY", "" + specificity);
output.put("BESTTHRESHOLD", "" + bestThreshold);
output.put("AUC", "" + MathFunctions.roundDecimal(auc,2));
output.put("ACCURACY", "" + MathFunctions.roundDecimal(accuracy,2));
output.put("SENSITIVITY", "" + MathFunctions.roundDecimal(sensitivity,2));
output.put("OMISSIONRATE", "" + MathFunctions.roundDecimal(omissionrate,2));
output.put("SPECIFICITY", "" + MathFunctions.roundDecimal(specificity,2));
output.put("BESTTHRESHOLD", "" + MathFunctions.roundDecimal(bestThreshold,2));
return output;
}
@ -312,7 +313,7 @@ public class DistributionQualityAnalysis extends DataAnalysis {
quality = new DistributionQualityAnalysis();
auc = quality.calculateAUC(posRandom, negRandom, true);
System.out.println("AUC: " + auc);
// System.out.println("AUC: " + auc);
double[] po = { 0.16, 0.12, 0.12, 0.16, 0.58, 0.36, 0.32, 0.5, 0.65, 0.59, 0.65, 0.65, 0.65, 0.38, 0.18, 0.64, 0.28, 0.64, 0.52, 0.72, 0.74, 0.23, 0.23, 0.23, 0.21, 0.21, 0.22, 0.22, 0.24, 0.32, 0.32, 0.32, 0.32, 0.55, 0.78, 0.37, 0.87, 0.87, 0.87, 0.98, 0.98, 0.76, 0.76, 0.9, 0.88, 0.97, 0.97, 0.97, 1.0, 1.0, 0.45, 0.45, 0.19, 0.89, 0.17, 0.16, 0.1, 0.25, 0.89, 0.89, 0.9, 0.9, 0.87, 1.0, 0.48, 0.88, 0.9, 0.93, 1.0, 1.0, 0.17, 0.87, 1.0, 0.24, 0.86, 0.15, 0.74, 0.32, 1.0, 0.95, 0.52, 0.66, 0.39, 0.31, 0.47, 0.57, 0.73, 0.83, 0.86, 0.98, 0.99, 1.0, 1.0, 1.0, 1.0, 0.86, 0.43, 0.67, 0.66, 0.41, 0.52, 0.46, 0.34, 1.0, 1.0, 1.0, 0.68, 1.0, 0.98, 0.89, 0.79, 1.0, 0.88, 0.99, 1.0, 0.95, 0.95, 0.95, 0.95, 0.88, 0.96, 0.95, 0.96, 0.99, 1.0, 0.98, 0.6, 0.36, 0.15, 0.87, 0.43, 0.86, 0.34, 0.21, 0.41, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.94, 0.98, 0.71, 0.85, 0.49, 0.91, 0.75, 0.74, 0.42, 0.99, 0.43, 0.22, 0.23, 1.0, 1.0, 1.0, 1.0, 0.4, 1.0, 1.0, 1.0, 0.94, 0.95, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.94, 0.98, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,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0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

View File

@ -213,7 +213,7 @@ public class HabitatRepresentativeness extends DataAnalysis {
meanHRSVector = new double[currentHRSVector.length];
for (int j=0;j<currentHRSVector.length;j++){
meanHRSVector[j]=MathFunctions.incrementAvg(meanHRSVector[j],currentHRSVector[j],i);
meanHRSVector[j]=org.gcube.contentmanagement.graphtools.utils.MathFunctions.roundDecimal(MathFunctions.incrementAvg(meanHRSVector[j],currentHRSVector[j],i),2);
}
AnalysisLogger.getLogger().trace("ITERATION FINISHED "+meanHRS);
@ -222,7 +222,7 @@ public class HabitatRepresentativeness extends DataAnalysis {
output = new HashMap<String, String>();
output.put("HRS_VECTOR", "" + Transformations.vector2String(meanHRSVector));
output.put("HRS", "" + meanHRS);
output.put("HRS", "" + org.gcube.contentmanagement.graphtools.utils.MathFunctions.roundDecimal(meanHRS,2));
return output;
} catch (Exception e) {

View File

@ -55,7 +55,7 @@ public static void main(String[] args) throws Exception {
trans = null;
*/
trans = EvaluatorsFactory.getEvaluators(testConfigLocal11());
trans = EvaluatorsFactory.getEvaluators(testConfigLocal12());
trans.get(0).init();
Regressor.process(trans.get(0));
@ -183,7 +183,7 @@ public static void main(String[] args) throws Exception {
config.setAgent("HRS");
config.setParam("ProjectingAreaTable","hspen_filteredid_16d7291d_7b11_48f3_af3a_1b2eef38efee");
config.setParam("OptionalCondition","oceanarea>0");
config.setParam("OptionalCondition","where oceanarea>0");
config.setParam("PositiveCasesTable","presence_hcafid_317683c4_3474_4648_ba5b_9cd832db73cf");
config.setParam("NegativeCasesTable","absence_hcafid_c4bb5bae_b875_4753_974b_c4b3ad616a24");
config.setParam("FeaturesColumns", "depthmean"+AlgorithmConfiguration.getListSeparator()+"depthmax"+AlgorithmConfiguration.getListSeparator()+"depthmin"+AlgorithmConfiguration.getListSeparator()+" sstanmean"+AlgorithmConfiguration.getListSeparator()+"sbtanmean"+AlgorithmConfiguration.getListSeparator()+"salinitymean"+AlgorithmConfiguration.getListSeparator()+"salinitybmean"+AlgorithmConfiguration.getListSeparator()+" primprodmean"+AlgorithmConfiguration.getListSeparator()+"iceconann"+AlgorithmConfiguration.getListSeparator()+"landdist"+AlgorithmConfiguration.getListSeparator()+"oceanarea");
@ -196,6 +196,28 @@ public static void main(String[] args) throws Exception {
return config;
}
private static AlgorithmConfiguration testConfigLocal12() {
AlgorithmConfiguration config = Regressor.getConfig();
config.setNumberOfResources(1);
config.setAgent("DISCREPANCY_ANALYSIS");
config.setParam("FirstTable", "hspec_id_18b20d04_edf3_4c83_9a48_fcbe773e3fd3");
config.setParam("SecondTable", "hspec_id_46cbfde4_9c9b_4414_a1f0_a350fe429018");
config.setParam("FirstTableCsquareColumn", "csquarecode");
config.setParam("SecondTableCsquareColumn", "csquarecode");
config.setParam("FirstTableProbabilityColumn", "probability");
config.setParam("SecondTableProbabilityColumn", "probability");
config.setParam("ComparisonThreshold", "0.1");
config.setParam("DatabaseUserName","utente");
config.setParam("DatabasePassword","d4science");
config.setParam("DatabaseURL","jdbc:postgresql://dbtest.next.research-infrastructures.eu/testdb");
config.setParam("DatabaseDriver","org.postgresql.Driver");
return config;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.datatypes.DatabaseType;
import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType;
import org.gcube.dataanalysis.ecoengine.datatypes.TablesList;
import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveTypesList;
import org.gcube.dataanalysis.ecoengine.datatypes.StatisticalType;
@ -18,13 +19,15 @@ public class BioClimateHCAFTransducer extends BioClimateHSPECTransducer{
private String[] hcafTables;
private String[] hcafTablesNames;
@Override
public void init() throws Exception {
//init the analyzer
bioClimate=new BioClimateAnalysis(config.getConfigPath(),config.getPersistencePath(),config.getParam("DatabaseURL"),config.getParam("DatabaseUserName"), config.getParam("DatabasePassword"), false);
//build the hspec names:
hcafTables = config.getParam("HCAF_TABLE_LIST").split(AlgorithmConfiguration.getListSeparator());
hcafTablesNames = config.getParam("HCAF_TABLE_NAMES").split(AlgorithmConfiguration.getListSeparator());
hcafTables = config.getParam("HCAF_Table_List").split(AlgorithmConfiguration.getListSeparator());
hcafTablesNames = config.getParam("HCAF_Table_List").split(AlgorithmConfiguration.getListSeparator());
}
@Override
@ -37,8 +40,9 @@ public class BioClimateHCAFTransducer extends BioClimateHSPECTransducer{
List<StatisticalType> parameters = new ArrayList<StatisticalType>();
List<TableTemplates> templateHspec = new ArrayList<TableTemplates>();
templateHspec.add(TableTemplates.HCAF);
TablesList p7 = new TablesList(templateHspec, "HCAF_TABLE_LIST", "List of HCAF tables to analyze", false);
PrimitiveTypesList p8 = new PrimitiveTypesList(String.class.getName(),PrimitiveTypes.STRING, "HCAF_TABLE_NAMES", "List of HCAF table names to be used as labels", false);
TablesList p7 = new TablesList(templateHspec, "HCAF_Table_List", "list of HCAF tables to analyze", false);
PrimitiveTypesList p8 = new PrimitiveTypesList(String.class.getName(),PrimitiveTypes.STRING, "HCAF_Table_List", "list of HCAF table names to be used as labels", false);
parameters.add(p7);
parameters.add(p8);

View File

@ -75,9 +75,9 @@ public class BioClimateHSPECTransducer implements Transducerer{
List<TableTemplates> templateHspec = new ArrayList<TableTemplates>();
templateHspec.add(TableTemplates.HSPEC);
TablesList p7 = new TablesList(templateHspec, "HSPEC_TABLE_LIST", "List of HSPEC tables to analyze", false);
PrimitiveTypesList p8 = new PrimitiveTypesList(String.class.getName(),PrimitiveTypes.STRING, "HSPEC_TABLE_NAMES", "List of HSPEC table names to be used as labels", false);
PrimitiveTypesList p8 = new PrimitiveTypesList(String.class.getName(),PrimitiveTypes.STRING, "HSPEC_TABLE_NAMES", "list of HSPEC table names to be used as labels", false);
PrimitiveType p9 = new PrimitiveType(Double.class.getName(), null, PrimitiveTypes.NUMBER, "Threshold", "A threshold of probability over which the abundancy per species will be calculated","0.5");
PrimitiveType p9 = new PrimitiveType(Double.class.getName(), null, PrimitiveTypes.NUMBER, "Threshold", "a threshold of probability over which the abundancy per species will be calculated","0.5");
parameters.add(p7);
parameters.add(p8);

View File

@ -37,8 +37,8 @@ public class BioClimateHSPENTransducer extends BioClimateHSPECTransducer{
List<StatisticalType> parameters = new ArrayList<StatisticalType>();
List<TableTemplates> templateHspec = new ArrayList<TableTemplates>();
templateHspec.add(TableTemplates.HSPEN);
TablesList p7 = new TablesList(templateHspec, "HSPEN_TABLE_LIST", "List of HSPEN tables containing the species for which the salinity will be analyzed", false);
PrimitiveTypesList p8 = new PrimitiveTypesList(String.class.getName(),PrimitiveTypes.STRING, "HSPEN_TABLE_NAMES", "List of HSPEN table names to be used as labels", false);
TablesList p7 = new TablesList(templateHspec, "HSPEN_TABLE_LIST", "list of HSPEN tables containing the species for which the salinity will be analyzed", false);
PrimitiveTypesList p8 = new PrimitiveTypesList(String.class.getName(),PrimitiveTypes.STRING, "HSPEN_TABLE_NAMES", "list of HSPEN table names to be used as labels", false);
parameters.add(p7);
parameters.add(p8);

View File

@ -67,11 +67,11 @@ public class InterpolationTransducer implements Transducerer{
List<TableTemplates> templates = new ArrayList<TableTemplates>();
templates.add(TableTemplates.HCAF);
InputTable p7 = new InputTable(templates, "FirstHCAF", "HCAF table representing the starting point", "hcaf_d");
InputTable p8 = new InputTable(templates, "SecondHCAF", "HCAF table representing the ending point", "hcaf_d_2050");
PrimitiveType p9 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "YearStart", "The year associated to the FirstHCAF parameter","2012");
PrimitiveType p10 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "YearEnd", "The year associated to the SecondHCAF parameter","2050");
PrimitiveType p11 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "NumberOfInterpolations", "Number of Intermediate Interpolation points","2");
InputTable p7 = new InputTable(templates, "FirstHCAF", "the HCAF table representing the starting scenario", "hcaf_d");
InputTable p8 = new InputTable(templates, "SecondHCAF", "the HCAF table representing the ending scenario", "hcaf_d_2050");
PrimitiveType p9 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "YearStart", "the year associated to the FirstHCAF parameter","2012");
PrimitiveType p10 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "YearEnd", "the year associated to the SecondHCAF parameter","2050");
PrimitiveType p11 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, "NumberOfInterpolations", "number of Intermediate Interpolation points","2");
PrimitiveType p12 = new PrimitiveType(Enum.class.getName(), InterpolateTables.INTERPOLATIONFUNCTIONS.values(), PrimitiveTypes.ENUMERATED, "InterpolationFunction", "The interpolation Function to use",""+InterpolateTables.INTERPOLATIONFUNCTIONS.LINEAR);

View File

@ -32,18 +32,20 @@ public class OccurrencePointsDuplicatesDeleter extends OccurrencePointsMerger{
List<TableTemplates> templatesOccurrence = new ArrayList<TableTemplates>();
templatesOccurrence.add(TableTemplates.OCCURRENCE_SPECIES);
// occurrence points tables
InputTable p1 = new InputTable(templatesOccurrence, tableNameF, "The table containing the occurrence points", "");
PrimitiveType p0 = new PrimitiveType(String.class.getName(), null, PrimitiveTypes.STRING, finalTableNameL,"the name of the produced table", "DeletedOcc_");
InputTable p1 = new InputTable(templatesOccurrence, tableNameF, "the table containing the occurrence points", "");
ColumnType p3 = new ColumnType(tableNameF, longitudeColumn, "column with longitude values", "decimallongitude", false);
ColumnType p4 = new ColumnType(tableNameF, latitudeColumn, "column with latitude values", "decimallatitude", false);
ColumnType p5 = new ColumnType(tableNameF, recordedByColumn, "column with RecordedBy values", "recordedby", false);
ColumnType p6 = new ColumnType(tableNameF, scientificNameColumn, "column with Scientific Names", "scientificname", false);
ColumnType p7 = new ColumnType(tableNameF, eventDateColumn, "column with EventDate values", "eventdate", false);
ColumnType p8 = new ColumnType(tableNameF, lastModificationColumn, "column with Modified values", "modified", false);
ServiceType p9 = new ServiceType(ServiceParameters.RANDOMSTRING, finalTableNameF, "Name of the resulting table", "processedOccurrences_");
PrimitiveType p10 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, spatialTolerance, "The tolerance in degree for assessing that two points could be the same", "0.5");
PrimitiveType p11 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, confidence, "The overall acceptance similarity threshold over which two points are the same - from 0 to 100", "80");
ServiceType p9 = new ServiceType(ServiceParameters.RANDOMSTRING, finalTableNameF, "name of the resulting table", "processedOccurrences_");
PrimitiveType p10 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, spatialTolerance, "the tolerance in degree for assessing that two points could be the same", "0.5");
PrimitiveType p11 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, confidence, "the overall acceptance similarity threshold over which two points are the same - from 0 to 100", "80");
List<StatisticalType> inputs = new ArrayList<StatisticalType>();
inputs.add(p0);
inputs.add(p1);
inputs.add(p3);
inputs.add(p4);
@ -78,6 +80,7 @@ public class OccurrencePointsDuplicatesDeleter extends OccurrencePointsMerger{
rightTableName=tableName;
leftTableName=tableName;
finalTableName = config.getParam(finalTableNameF);
finalTableLabel = config.getParam(finalTableNameL);
spatialToleranceValue = Float.parseFloat(config.getParam(spatialTolerance));
confidenceValue = Float.parseFloat(config.getParam(confidence));

View File

@ -25,7 +25,7 @@ public class OccurrencePointsInSeaOnEarth extends OccurrencePointsMerger{
static String tableNameF = "OccurrencePointsTableName";
static String filterTypeF = "FilterType";
String tableName;
public static enum inseasonearth {IN_THE_WATER, ON_EARTH};
public static enum inseasonearth {MARINE, TERRESTRIAL};
inseasonearth filter;
@Override
@ -38,7 +38,7 @@ public class OccurrencePointsInSeaOnEarth extends OccurrencePointsMerger{
ColumnType p3 = new ColumnType(tableNameF, longitudeColumn, "column with longitude values", "decimallongitude", false);
ColumnType p4 = new ColumnType(tableNameF, latitudeColumn, "column with latitude values", "decimallatitude", false);
ServiceType p9 = new ServiceType(ServiceParameters.RANDOMSTRING, finalTableNameF, "Name of the resulting table", "processedOccurrences_");
PrimitiveType p10 = new PrimitiveType(Enum.class.getName(), inseasonearth.values(), PrimitiveTypes.ENUMERATED, filterTypeF, "The filter type",""+inseasonearth.IN_THE_WATER);
PrimitiveType p10 = new PrimitiveType(Enum.class.getName(), inseasonearth.values(), PrimitiveTypes.ENUMERATED, filterTypeF, "The filter type",""+inseasonearth.MARINE);
List<StatisticalType> inputs = new ArrayList<StatisticalType>();
inputs.add(p1);
@ -90,7 +90,7 @@ public class OccurrencePointsInSeaOnEarth extends OccurrencePointsMerger{
// prepareFinalTable();
status = 10;
String generationquery = "";
if (filter==inseasonearth.IN_THE_WATER)
if (filter==inseasonearth.MARINE)
generationquery = String.format(inthesea,finalTableName,tableName,latFld,lonFld);
else
generationquery = String.format(onearth,finalTableName,tableName,latFld,lonFld);

View File

@ -30,6 +30,7 @@ import org.hibernate.SessionFactory;
public class OccurrencePointsMerger implements Transducerer {
static protected String finalTableNameL = "final_Table_Name";
static String longitudeColumn = "longitudeColumn";
static String latitudeColumn = "latitudeColumn";
static String recordedByColumn = "recordedByColumn";
@ -41,6 +42,7 @@ public class OccurrencePointsMerger implements Transducerer {
static String finalTableNameF = "finalTableName";
static String spatialTolerance = "spatialTolerance";
static String confidence = "confidence";
protected List<OccurrenceRecord> records_left;
protected List<OccurrenceRecord> records_right;
@ -55,6 +57,7 @@ public class OccurrencePointsMerger implements Transducerer {
protected String leftTableName;
protected String rightTableName;
protected String finalTableName;
protected String finalTableLabel;
protected float spatialToleranceValue;
protected float confidenceValue;
protected StringBuffer columns;
@ -201,8 +204,10 @@ public class OccurrencePointsMerger implements Transducerer {
List<TableTemplates> templatesOccurrence = new ArrayList<TableTemplates>();
templatesOccurrence.add(TableTemplates.OCCURRENCE_SPECIES);
// occurrence points tables
InputTable p1 = new InputTable(templatesOccurrence, leftTableNameF, "The First table containing the occurrence points", "");
InputTable p2 = new InputTable(templatesOccurrence, rightTableNameF, "The Second table containing the occurrence points", "");
PrimitiveType p0 = new PrimitiveType(String.class.getName(), null, PrimitiveTypes.STRING, finalTableNameL,"the name of the produced table", "MergedOcc_");
InputTable p1 = new InputTable(templatesOccurrence, leftTableNameF, "the First table containing the occurrence points", "");
InputTable p2 = new InputTable(templatesOccurrence, rightTableNameF, "the Second table containing the occurrence points", "");
// string parameters
ColumnType p3 = new ColumnType(leftTableNameF, longitudeColumn, "column with longitude values", "decimallongitude", false);
@ -211,11 +216,12 @@ public class OccurrencePointsMerger implements Transducerer {
ColumnType p6 = new ColumnType(leftTableNameF, scientificNameColumn, "column with Scientific Names", "scientificname", false);
ColumnType p7 = new ColumnType(leftTableNameF, eventDateColumn, "column with EventDate values", "eventdate", false);
ColumnType p8 = new ColumnType(leftTableNameF, lastModificationColumn, "column with Modified values", "modified", false);
ServiceType p9 = new ServiceType(ServiceParameters.RANDOMSTRING, finalTableNameF, "Name of the resulting table", "processedOccurrences_");
PrimitiveType p10 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, spatialTolerance, "The tolerance in degree for assessing that two points could be the same", "0.5");
PrimitiveType p11 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, confidence, "The overall acceptance similarity threshold over which two points are the same - from 0 to 100", "80");
ServiceType p9 = new ServiceType(ServiceParameters.RANDOMSTRING, finalTableNameF, "name of the resulting table", "processedOccurrences_");
PrimitiveType p10 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, spatialTolerance, "the tolerance in degree for assessing that two points could be the same", "0.5");
PrimitiveType p11 = new PrimitiveType(Float.class.getName(), null, PrimitiveTypes.NUMBER, confidence, "the overall acceptance similarity threshold over which two points are the same - from 0 to 100", "80");
List<StatisticalType> inputs = new ArrayList<StatisticalType>();
inputs.add(p0);
inputs.add(p1);
inputs.add(p2);
inputs.add(p3);
@ -264,7 +270,7 @@ public class OccurrencePointsMerger implements Transducerer {
List<TableTemplates> templatesOccurrence = new ArrayList<TableTemplates>();
templatesOccurrence.add(TableTemplates.OCCURRENCE_SPECIES);
// occurrence points tables
OutputTable p = new OutputTable(templatesOccurrence, finalTableName, finalTableName, "The output table containing the processed points");
OutputTable p = new OutputTable(templatesOccurrence, finalTableLabel, finalTableName, "The output table containing the processed points");
return p;
}
@ -282,6 +288,7 @@ public class OccurrencePointsMerger implements Transducerer {
leftTableName = config.getParam(leftTableNameF);
rightTableName = config.getParam(rightTableNameF);
finalTableName = config.getParam(finalTableNameF);
finalTableLabel = config.getParam(finalTableNameL);
spatialToleranceValue = Float.parseFloat(config.getParam(spatialTolerance));
confidenceValue = Float.parseFloat(config.getParam(confidence));

View File

@ -53,7 +53,7 @@ public class MarineAbsencePointsFromAquamapsDistribution extends QueryExecutor {
// PrimitiveType p3 = new PrimitiveType(String.class.getName(), null, PrimitiveTypes.RANDOM, finalTable,"Name of the HCAF table to produce containing Absence Cells","absence_hcaf");
ServiceType p3 = new ServiceType(ServiceParameters.RANDOMSTRING, finalTable,"Name of the HCAF table to produce containing Absence Cells","absence_hcaf");
PrimitiveType p4 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, numberOfPoints,"Number of points to take","20");
PrimitiveType p4 = new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, numberOfPoints,"number of points to take","20");
PrimitiveType p5 = new PrimitiveType(String.class.getName(), null, PrimitiveTypes.STRING, speciesCode,"the species code according to the Fish-Base conventions","Fis-30189");
List<StatisticalType> parameters = new ArrayList<StatisticalType>();