Skip to content

Commit

Permalink
Done with data upload. Uploads real_estate, weather, flights, and cmu
Browse files Browse the repository at this point in the history
dataset automatically.
  • Loading branch information
siddta committed Jan 6, 2017
1 parent f719a02 commit fd3c955
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 122 deletions.
2 changes: 1 addition & 1 deletion build.sh
Expand Up @@ -2,4 +2,4 @@
mvn clean
mvn install
cp lib/*.jar target/zenvisage/WEB-INF/lib/.
cp data target/zenvisage/.
cp -r data target/zenvisage/.
2 changes: 1 addition & 1 deletion run.sh
@@ -1,5 +1,5 @@
#!bin/bash
pkill -f ZvServer
cd target
java -cp "zenvisage/WEB-INF/lib/*:zenvisage-jar-with-dependencies.jar" edu.uiuc.zenvisage.server.ZvServer
java -cp "zenvisage/WEB-INF/lib/*:zenvisage-jar-with-dependencies.jar:classes/data" edu.uiuc.zenvisage.server.ZvServer

34 changes: 26 additions & 8 deletions src/main/java/edu/uiuc/zenvisage/server/ZvServer.java
@@ -1,5 +1,6 @@
package edu.uiuc.zenvisage.server;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -47,8 +48,8 @@ public void start() throws Exception {
*/
public static void main(String[] args) throws Exception {
createMetaTables();
loadDemoDatasets();
ZvServer zvServer = new ZvServer();
zvServer.loadDemoDatasets();
zvServer.start();
}

Expand All @@ -70,18 +71,35 @@ public static void createMetaTables() throws SQLException{
}


public static void loadDemoDatasets() throws SQLException, IOException{
public void loadDemoDatasets() throws SQLException, IOException{
List<String> dataset1 = new ArrayList<String>(); // real_estate
dataset1.add("real_estate");
dataset1.add(this.getClass().getClassLoader().getResource(("real_estate.csv")).getPath());
dataset1.add(this.getClass().getClassLoader().getResource(("real_estate.txt")).getPath());

List<String> dataset2 = new ArrayList<String>(); //weather
dataset2.add("weather");
dataset2.add(this.getClass().getClassLoader().getResource(("weather.csv")).getPath());
dataset2.add(this.getClass().getClassLoader().getResource(("weather.txt")).getPath());

List<String> dataset3 = new ArrayList<String>(); //weather
dataset3.add("flights");
dataset3.add(this.getClass().getClassLoader().getResource(("flights.csv")).getPath());
dataset3.add(this.getClass().getClassLoader().getResource(("flights.txt")).getPath());

//Add values to the list here -- filepath, csv, txt :same for datasets below
// List<String> dataset2 = new ArrayList<String>(); //weather
// List<String> dataset3 = new ArrayList<String>(); //flight
List<String> dataset4 = new ArrayList<String>(); //weather
dataset4.add("cmu");
dataset4.add(this.getClass().getClassLoader().getResource(("cmu_clean.csv")).getPath());
dataset4.add(this.getClass().getClassLoader().getResource(("cmu_clean.txt")).getPath());


// List<String> dataset3 = new ArrayList<String>(); //flight
// List<String> dataset4 = new ArrayList<String>(); //cmu

ZvMain.uploadDatasettoDB(dataset1,false);
// ZvMain.uploadDatasettoDB(dataset2);
// ZvMain.uploadDatasettoDB(dataset3);
// ZvMain.uploadDatasettoDB(dataset4);
ZvMain.uploadDatasettoDB(dataset2,false);
ZvMain.uploadDatasettoDB(dataset3,false);
ZvMain.uploadDatasettoDB(dataset4,false);
}

}
7 changes: 4 additions & 3 deletions src/main/java/edu/uiuc/zenvisage/service/ZvMain.java
Expand Up @@ -137,7 +137,6 @@ public static void uploadDatasettoDB(List<String> names, boolean overwrite) thro
SchemeToMetatable schemeToMetatable = new SchemeToMetatable();

if (names.size() == 3) {
System.out.println("successful upload! "+ names.get(0) +" "+names.get(2) + " "+ names.get(1));
SQLQueryExecutor sqlQueryExecutor = new SQLQueryExecutor();

/*create csv table*/
Expand All @@ -162,15 +161,17 @@ public static void uploadDatasettoDB(List<String> names, boolean overwrite) thro

sqlQueryExecutor.createTable(schemeToMetatable.createTableSQL);
sqlQueryExecutor.insertTable(names.get(0), names.get(1), schemeToMetatable.columns);
System.out.println(names.get(0) + " not exists! Created " + names.get(0) + " from "+names.get(1));
System.out.println(names.get(0) + " not exists! Created " + names.get(0) + " table from "+names.get(1));
System.out.println("Successful upload! "+ names.get(0) +" "+names.get(2) + " "+ names.get(1));

} else if(overwrite) {//
sqlQueryExecutor.dropTable(names.get(0));
sqlQueryExecutor.createTable(schemeToMetatable.schemeFileToCreatTableSQL(names.get(2), names.get(0)));
sqlQueryExecutor.insertTable(names.get(0), names.get(1), schemeToMetatable.columns);
System.out.println(names.get(0) + " exists! Overwrite and create " + names.get(0) + " from "+names.get(1));
}

System.out.println("HERE:"+names.get(0) +" "+ names.get(2) + " "+ names.get(1));

//inMemoryDatabase = createDatabase(names.get(0), names.get(2), names.get(1));


Expand Down
106 changes: 1 addition & 105 deletions src/main/resources/data/seed2.csv
@@ -1,105 +1 @@
data_class,homo_ev,homolumogap_ev,melting_point
alkyl,-10.354,16.374,-49.15
amine,-10.354,16.374,-49.15
alkyl,-9.497,15.837,-114.7
amine,-9.497,15.837,-114.7
halo,-13.141,18.029,-159.15
halo,-16.105,23.184,-162.95
halo,-12.677,15.573,-111.15
halo,-12.993,16.559,-157.95
halo,-13.76,18.425,-180.95
halo,-18.383,29.409,-184.15
halo,-12.605,16.492,-135
halo,-12.627,15.149,-22.85
halo,-12.346,15.609,-63.15
halo,-11.827,17.154,-91.15
halo,-12.158,16.334,-75.09
halo,-12.004,16.863,-42.7
halo,-12.144,15.582,-30.4
halo,-12.149,16.195,-35.25
halo,-9.963,13.233,-84.65
alkene,-9.963,13.233,-84.65
halo,-9.949,12.821,-22.18
alkene,-9.949,12.821,-22.18
alkyl,-12.096,17.081,-98
acetate,-12.096,17.081,-98
alkyl,-12.397,17.291,-79.6
acetate,-12.397,17.291,-79.6
ether,-11.377,17.908,-97.3
aromatic,-11.377,17.908,-97.3
acid,-12.203,17.11,-21.15
ketone,-11.756,16.55,-44.15
ester,-11.756,16.55,-44.15
alkyl,-11.756,16.55,-44.15
alkyl,-12,17.032,-83.15
acetate,-12,17.032,-83.15
acid,-12.084,17.018,-3.45
alkyl,-11.696,16.723,-42.8
acetate,-11.696,16.723,-42.8
alkene,-12.162,18.869,-112.6
ether,-12.162,18.869,-112.6
aromatic,-12.162,18.869,-112.6
aldehyde,-11.528,14.852,-123.15
alkene,-11.735,18.421,-112.13
ether,-11.735,18.421,-112.13
aromatic,-11.735,18.421,-112.13
ether,-12.106,18.467,64
aromatic,-12.106,18.467,64
ether,-11.265,17.666,-119.15
alkyl,-11.265,17.666,-119.15
alcohol,-11.87,18.015,-85.15
alkyl,-11.87,18.015,-85.15
alcohol,-11.658,17.202,25.15
alkyl,-11.658,17.202,25.15
alcohol,-11.59,17.376,-108
alkyl,-11.59,17.376,-108
ether,-10.969,17.145,-108.05
aromatic,-10.969,17.145,-108.05
alkyl,-11.187,15.277,-72.15
acetal,-11.187,15.277,-72.15
alkyl,-11.357,15.553,-97.15
acetal,-11.357,15.553,-97.15
ketone,-11.105,15.419,-86.65
ether,-10.715,17.393,11.85
aromatic,-10.715,17.393,11.85
alcohol,-11.808,17.699,-117.2
alkyl,-11.808,17.699,-117.2
alcohol,-11.859,18.002,-78.2
ether,-11.242,17.507,-85.5
alkyl,-11.242,17.507,-85.5
ether,-8.318,12.232,-23.15
aromatic,-8.318,12.232,-23.15
ether,-11.274,17.395,-105.15
alkane,-11.274,17.395,-105.15
ether,-11.444,17.875,-69.21
alkane,-11.444,17.875,-69.21
alcohol,-11.692,17.45,-77
alcohol,-11.856,17.899,26.85
alkyl,-10.868,15.196,-94.4
ketone,-10.868,15.196,-94.4
aromatic,-11.468,17.381,-19
ketone,-11.468,17.381,-19
alkene,-11.926,17.65,-12.15
alcohol,-11.926,17.65,-12.15
alkene,-11.388,16.926,58.85
alcohol,-11.388,16.926,58.85
alkene,-11.574,17.156,-60
alcohol,-11.574,17.156,-60
amide,-11.255,16.614,2.55
amide,-11.093,16.338,78.85
alkyl,-10.099,15.515,-60.45
amide,-10.099,15.515,-60.45
amide,-11.078,16.356,79.65
pyrrole,-10.458,15.833,25.57
ketone,-10.458,15.833,25.57
amide,-11.062,16.394,115.65
nitrile,-12.273,17.614,-45.15
nitrile,-12.883,16.654,31.85
nitrile,-12.134,17.185,-93.15
nitrile,-11.98,17.17,-96.23
alkyl,-9.838,15.166,18.5
oxide,-9.838,15.166,18.5
sulfur,-9.838,15.166,18.5
alkyl,-11.952,17.36,108.85
sulfur,-11.952,17.36,108.85
ketone,-11.952,17.36,108.85
data_class,homo_ev,homolumogap_ev,melting_pointalkyl,-10.354,16.374,-49.15amine,-10.354,16.374,-49.15alkyl,-9.497,15.837,-114.7amine,-9.497,15.837,-114.7halo,-13.141,18.029,-159.15halo,-16.105,23.184,-162.95halo,-12.677,15.573,-111.15halo,-12.993,16.559,-157.95halo,-13.76,18.425,-180.95halo,-18.383,29.409,-184.15halo,-12.605,16.492,-135halo,-12.627,15.149,-22.85halo,-12.346,15.609,-63.15halo,-11.827,17.154,-91.15halo,-12.158,16.334,-75.09halo,-12.004,16.863,-42.7halo,-12.144,15.582,-30.4halo,-12.149,16.195,-35.25halo,-9.963,13.233,-84.65alkene,-9.963,13.233,-84.65halo,-9.949,12.821,-22.18alkene,-9.949,12.821,-22.18alkyl,-12.096,17.081,-98acetate,-12.096,17.081,-98alkyl,-12.397,17.291,-79.6acetate,-12.397,17.291,-79.6ether,-11.377,17.908,-97.3aromatic,-11.377,17.908,-97.3acid,-12.203,17.11,-21.15ketone,-11.756,16.55,-44.15ester,-11.756,16.55,-44.15alkyl,-11.756,16.55,-44.15alkyl,-12,17.032,-83.15acetate,-12,17.032,-83.15acid,-12.084,17.018,-3.45alkyl,-11.696,16.723,-42.8acetate,-11.696,16.723,-42.8alkene,-12.162,18.869,-112.6ether,-12.162,18.869,-112.6aromatic,-12.162,18.869,-112.6aldehyde,-11.528,14.852,-123.15alkene,-11.735,18.421,-112.13ether,-11.735,18.421,-112.13aromatic,-11.735,18.421,-112.13ether,-12.106,18.467,64aromatic,-12.106,18.467,64ether,-11.265,17.666,-119.15alkyl,-11.265,17.666,-119.15alcohol,-11.87,18.015,-85.15alkyl,-11.87,18.015,-85.15alcohol,-11.658,17.202,25.15alkyl,-11.658,17.202,25.15alcohol,-11.59,17.376,-108alkyl,-11.59,17.376,-108ether,-10.969,17.145,-108.05aromatic,-10.969,17.145,-108.05alkyl,-11.187,15.277,-72.15acetal,-11.187,15.277,-72.15alkyl,-11.357,15.553,-97.15acetal,-11.357,15.553,-97.15ketone,-11.105,15.419,-86.65ether,-10.715,17.393,11.85aromatic,-10.715,17.393,11.85alcohol,-11.808,17.699,-117.2alkyl,-11.808,17.699,-117.2alcohol,-11.859,18.002,-78.2ether,-11.242,17.507,-85.5alkyl,-11.242,17.507,-85.5ether,-8.318,12.232,-23.15aromatic,-8.318,12.232,-23.15ether,-11.274,17.395,-105.15alkane,-11.274,17.395,-105.15ether,-11.444,17.875,-69.21alkane,-11.444,17.875,-69.21alcohol,-11.692,17.45,-77alcohol,-11.856,17.899,26.85alkyl,-10.868,15.196,-94.4ketone,-10.868,15.196,-94.4aromatic,-11.468,17.381,-19ketone,-11.468,17.381,-19alkene,-11.926,17.65,-12.15alcohol,-11.926,17.65,-12.15alkene,-11.388,16.926,58.85alcohol,-11.388,16.926,58.85alkene,-11.574,17.156,-60alcohol,-11.574,17.156,-60amide,-11.255,16.614,2.55amide,-11.093,16.338,78.85alkyl,-10.099,15.515,-60.45amide,-10.099,15.515,-60.45amide,-11.078,16.356,79.65pyrrole,-10.458,15.833,25.57ketone,-10.458,15.833,25.57amide,-11.062,16.394,115.65nitrile,-12.273,17.614,-45.15nitrile,-12.883,16.654,31.85nitrile,-12.134,17.185,-93.15nitrile,-11.98,17.17,-96.23alkyl,-9.838,15.166,18.5oxide,-9.838,15.166,18.5sulfur,-9.838,15.166,18.5alkyl,-11.952,17.36,108.85sulfur,-11.952,17.36,108.85ketone,-11.952,17.36,108.85
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/data/seed2_schema.txt
@@ -1,4 +1,4 @@
data_class:string,indexed,F,F,T,T,F,0,Q
homo_ev:float,unindexed,T,T,F,F,F,0,Q
homolumogap_ev:float,unindexed,T,T,F,F,F,0,Q
melting_point:float,unindexed,T,T,F,F,F,0,Q
data_class:string,indexed,F,F,T,T,F,F,Q
homo_ev:float,unindexed,T,T,F,F,F,F,Q
homolumogap_ev:float,unindexed,T,T,F,F,F,F,Q
melting_point:float,unindexed,T,T,F,F,F,F,C

0 comments on commit fd3c955

Please sign in to comment.