10
10
import com .mysql .jdbc .jdbc2 .optional .SuspendableXAConnection ;
11
11
import jdk .nashorn .internal .parser .JSONParser ;
12
12
import org .antlr .v4 .runtime .ANTLRFileStream ;
13
+ import org .antlr .v4 .runtime .ANTLRInputStream ;
13
14
import org .antlr .v4 .runtime .CommonTokenStream ;
14
15
import org .json .JSONObject ;
15
16
16
- import java .io .BufferedReader ;
17
- import java .io .File ;
18
- import java .io .FileReader ;
19
- import java .io .IOException ;
17
+ import java .io .*;
20
18
21
19
22
20
import java .sql .Connection ;
@@ -36,40 +34,27 @@ Sampling, paralleling, condensing, overlapping(DP)
36
34
public class Main {
37
35
38
36
public static void main (String [] args ) throws IOException , SQLException {
39
- // MyBufferedReader myBufferedReader = new MyBufferedReader("src/large.csv");
40
- // String line;
41
- // int count = 0;
42
- // while((line = myBufferedReader.readLine()) != null){
43
- // if(count % 10000 == 0){
44
- // System.out.println(count);
45
- // }
46
- // count++;
47
- // JSONObject object = new JSONObject(line);
48
- // Map<String, Object> map = JsonParser.jsonToMap(object);
49
- // if(map.containsKey("relationship") && !"".equals(map.get("relationship").toString())){
50
- // System.out.println(line);
51
- // }
52
- // }
53
37
54
38
//Parsing this CSV file:
55
- String url = "jdbc:mysql://localhost:3306/graphDB " ;
39
+ String url = "jdbc:mysql://localhost:3306/graphDB_updated " ;
56
40
String fileName = "large.csv" ;
57
41
58
42
String username = "root" ;
59
43
String password = "" ;
60
44
System .out .println ("Connecting to MySQL..." );
61
45
Connection connection = DriverManager .getConnection (url , username , password );
46
+ connection .setAutoCommit (false );
62
47
System .out .println ("MySQL connected." );
63
48
64
49
65
50
// System.out.println("Parsing file...");
66
51
// FileParser fileParser = new FileParser(fileName, connection);
67
- // fileParser.run();
52
+ // fileParser.run(false );
68
53
// System.out.println("Parsing complete.");
69
54
70
55
71
56
System .out .println ("Creating index..." );
72
- QueryIndexer queryIndexer = new QueryIndexer (connection );
57
+ QueryIndexer queryIndexer = new QueryIndexer (connection , false );
73
58
System .out .println ("Index created..." );
74
59
75
60
System .out .println ("Parsing ANTLR query..." );
@@ -81,11 +66,36 @@ public static void main(String[] args) throws IOException, SQLException {
81
66
visitor .setConnection (connection );
82
67
visitor .visit (cypher );
83
68
84
- // MyBufferedReader bufferedReader = new MyBufferedReader("src/small.csv");
85
- // String line = "";
86
- // while ((line = bufferedReader.readLine()) != null){
87
- // System.out.println(line);
69
+
70
+ // while(true){
71
+ // try {
72
+ // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
73
+ // StringBuilder query = new StringBuilder();
74
+ // System.out.println("Enter Query : ");
75
+ // System.out.println("use wq to finish input");
76
+ // while (true) {
77
+ //
78
+ // String input = br.readLine();
79
+ // if ("wq".equals(input)) {
80
+ // break;
81
+ // }
82
+ // query.append(input);
83
+ // }
84
+ // System.out.println("Query : \n" + query.toString());
85
+ // CypherLexer lexer = new CypherLexer(new ANTLRInputStream(query.toString()));
86
+ // CypherParser parser = new CypherParser(new CommonTokenStream(lexer));
87
+ // CypherParser.CypherContext cypher = parser.cypher();
88
+ // CypherCustomVisitor visitor = new CypherCustomVisitor();
89
+ // visitor.setIndexer(queryIndexer);
90
+ // visitor.setConnection(connection);
91
+ // visitor.visit(cypher);
92
+ //
93
+ // } catch (Exception e) {
94
+ // e.printStackTrace();
88
95
// }
96
+ // }
97
+
98
+
89
99
}
90
100
91
101
}
0 commit comments