git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@59108 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
515fcf41b3
commit
6bf14fd823
|
@ -259,7 +259,7 @@ public class DBScan implements Clusterer{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void compute() throws Exception {
|
public void compute() throws Exception {
|
||||||
|
try{
|
||||||
if ((config==null)||epsilon==null||minPoints==null||points==null){
|
if ((config==null)||epsilon==null||minPoints==null||points==null){
|
||||||
throw new Exception("DBScan: Error incomplete parameters");
|
throw new Exception("DBScan: Error incomplete parameters");
|
||||||
}
|
}
|
||||||
|
@ -286,10 +286,16 @@ public class DBScan implements Clusterer{
|
||||||
|
|
||||||
BuildClusterTable(outputvector);
|
BuildClusterTable(outputvector);
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
AnalysisLogger.getLogger().debug("ERROR "+e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
finally{
|
||||||
shutdown();
|
shutdown();
|
||||||
status = 100f;
|
status = 100f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void BuildClusterTable(IOObject[] outputvector) throws Exception{
|
protected void BuildClusterTable(IOObject[] outputvector) throws Exception{
|
||||||
|
@ -345,7 +351,7 @@ public class DBScan implements Clusterer{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bufferRows.length()>0){
|
if (bufferRows.length()>0){
|
||||||
// AnalysisLogger.getLogger().trace("DBScan: Inserting Buffer "+DatabaseUtils.insertFromBuffer(OccurrencePointsClusterTable, columnsNames, bufferRows));
|
// AnalysisLogger.getLogger().debug("DBScan: Inserting Buffer "+DatabaseUtils.insertFromBuffer(OccurrencePointsClusterTable, columnsNames, bufferRows));
|
||||||
AnalysisLogger.getLogger().debug("Writing into DB");
|
AnalysisLogger.getLogger().debug("Writing into DB");
|
||||||
DatabaseFactory.executeSQLUpdate(DatabaseUtils.insertFromBuffer(OccurrencePointsClusterTable, columnsNames, bufferRows),dbHibConnection);
|
DatabaseFactory.executeSQLUpdate(DatabaseUtils.insertFromBuffer(OccurrencePointsClusterTable, columnsNames, bufferRows),dbHibConnection);
|
||||||
AnalysisLogger.getLogger().debug("Finished with writing into DB");
|
AnalysisLogger.getLogger().debug("Finished with writing into DB");
|
||||||
|
@ -364,6 +370,7 @@ public class DBScan implements Clusterer{
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
try{
|
try{
|
||||||
AnalysisLogger.getLogger().debug("Closing DB Connection ");
|
AnalysisLogger.getLogger().debug("Closing DB Connection ");
|
||||||
|
if (dbHibConnection!=null)
|
||||||
dbHibConnection.close();
|
dbHibConnection.close();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
AnalysisLogger.getLogger().debug("Could not shut down connection");
|
AnalysisLogger.getLogger().debug("Could not shut down connection");
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class AquamapsSuitable implements SpatialProbabilityDistributionTable{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Algorithm by Aquamaps";
|
return "Algorithm for Suitable Distribution by Aquamaps";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,17 +65,22 @@ public class TestClusterer {
|
||||||
AlgorithmConfiguration config = new AlgorithmConfiguration();
|
AlgorithmConfiguration config = new AlgorithmConfiguration();
|
||||||
config.setConfigPath("./cfg/");
|
config.setConfigPath("./cfg/");
|
||||||
config.setPersistencePath("./");
|
config.setPersistencePath("./");
|
||||||
config.setParam("OccurrencePointsTable","presence_basking_cluster");
|
config.setParam("OccurrencePointsTable","occurrence_species_id5397d3c4_a7eb_4227_adb4_d9d7d36e8b21");
|
||||||
config.setParam("FeaturesColumnNames","centerlat,centerlong");
|
config.setParam("FeaturesColumnNames","recordedby#basisofrecord#locality");
|
||||||
config.setParam("OccurrencePointsClusterTable","occCluster_2");
|
config.setParam("OccurrencePointsClusterTable","occCluster_gp");
|
||||||
config.setParam("epsilon","10");
|
config.setParam("epsilon","10");
|
||||||
config.setParam("minPoints","1");
|
config.setParam("min_points","1");
|
||||||
|
|
||||||
config.setConfigPath("./cfg/");
|
config.setConfigPath("./cfg/");
|
||||||
config.setPersistencePath("./");
|
config.setPersistencePath("./");
|
||||||
config.setNumberOfResources(1);
|
config.setNumberOfResources(1);
|
||||||
config.setAgent("DBSCAN");
|
config.setAgent("DBSCAN");
|
||||||
|
|
||||||
|
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;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,12 +158,16 @@ public class Transformations {
|
||||||
for (int i=0;i<m;i++){
|
for (int i=0;i<m;i++){
|
||||||
sb.append((int)string.charAt(i));
|
sb.append((int)string.charAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
double d = Double.MAX_VALUE;
|
double d = Double.MAX_VALUE;
|
||||||
try{
|
try{
|
||||||
d = Double.valueOf(sb.toString());
|
d = Double.valueOf(sb.toString());
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d>Integer.MAX_VALUE)
|
||||||
|
return (indexString(string.substring(0,3)));
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue