-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunDukeMultiRule.java
More file actions
62 lines (50 loc) · 2.22 KB
/
Copy pathRunDukeMultiRule.java
File metadata and controls
62 lines (50 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import no.priv.garshol.duke.*;
import no.priv.garshol.duke.matchers.PrintMatchListener;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;
public class RunDukeMultiRule{
private static long startTime;
private static long lastEndTime;
public static void main(String[] argv) throws Exception {
startTime = System.currentTimeMillis();
lastEndTime = startTime;
// Read in matching configuration text - scan by line
// Eventually we want to move the config into a transparent location like UI interface or sql
String fileName = "X:\\brandon\\matching_configuration.txt";
System.out.println("FileName: "+ fileName);
Path path = Paths.get(fileName);
Scanner scanner = new Scanner(path);
int inputCount=0;
while(scanner.hasNext()){
//read in line by line
String FileTest = ""+scanner.next()+"";
inputCount++;
String filePath = FileTest;
String newLine = System.getProperty("line.separator");//This will retrieve line separator dependent on OS.
System.out.println(newLine+"Matching config number "+ inputCount + " - " + filePath+newLine);
Configuration config = ConfigLoader.load(filePath);
Processor proc = new Processor(config);
//parameter: showmatches,showmaybe,progress,linkage, properties, pretty
//first parameter showMatches impacts performance
proc.addMatchListener(new PrintMatchListener(false,false, true, false,config.getProperties(),true));
//settings
proc.setPerformanceProfiling(true);
proc.setThreads(5);
//proc.link
proc.link(config.getDataSources(1), config.getDataSources(2), 120000);
//Log Timestamp
long start = System.currentTimeMillis();
System.out.println("Processing time for this rule: " + (System.currentTimeMillis() - lastEndTime)/1000.0 + " seconds");
System.out.println("Total processing time so far: " + (System.currentTimeMillis() - startTime)/1000.0 + " seconds");
lastEndTime = System.currentTimeMillis();
proc.close();
}
scanner.close();
}
}