Skip to content

Commit 5c29949

Browse files
committed
fix(graph): implement native object deduplication across GraphContext and wipe database directory on export
1 parent a0212a4 commit 5c29949

20 files changed

Lines changed: 1813 additions & 124 deletions

TestPrinter.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import com.github.javaparser.StaticJavaParser;
2+
import com.github.javaparser.ast.CompilationUnit;
3+
import com.github.javaparser.ast.body.MethodDeclaration;
4+
import java.util.Optional;
5+
6+
public class TestPrinter {
7+
public static void main(String[] args) {
8+
String code = "public class A {\n" +
9+
" public void foo() {\n" +
10+
" System.out.println(\"Hello World\");\n" +
11+
" }\n" +
12+
"}\n";
13+
CompilationUnit cu = StaticJavaParser.parse(code);
14+
cu.findAll(MethodDeclaration.class).forEach(n -> {
15+
System.out.println("--- toString ---");
16+
System.out.println(n.toString());
17+
System.out.println("--- token range ---");
18+
System.out.println(n.getTokenRange().map(Object::toString).orElse("ERR"));
19+
});
20+
}
21+
}

build-standalone.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ rm -rf custom-jre dist
1414
echo "Creating custom minimal JRE..."
1515
jlink --add-modules "$MODULES" --bind-services --strip-debug --no-man-pages --no-header-files --compress=2 --output custom-jre
1616

17-
echo "Packaging with jpackage into standalone executable..."
18-
jpackage --type app-image --name java2graph --input target --main-jar java2graph-1.0-SNAPSHOT-jar-with-dependencies.jar --main-class com.neuvem.java2graph.Main --runtime-image custom-jre --dest dist
17+
jpackage --type app-image --name java2graph --input target --main-jar java2graph-1.0-SNAPSHOT-jar-with-dependencies.jar --main-class com.neuvem.java2graph.Main --runtime-image custom-jre --dest dist --java-options "-Xmx8G"
1918

2019
echo "Done! Standalone binary created at dist/"

compare.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
function query_counts() {
3+
local db=$1
4+
echo "Comparing against $db"
5+
echo "Class count:"
6+
echo "MATCH (n:Class) RETURN count(*);" | lbug "$db" -r | grep -A 1 ''
7+
echo "Method count:"
8+
echo "MATCH (n:Method) RETURN count(*);" | lbug "$db" -r | grep -A 1 ''
9+
echo "Calls count:"
10+
echo "MATCH ()-[r:Calls]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
11+
echo "Extends count:"
12+
echo "MATCH ()-[r:Extends]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
13+
echo "Defines count:"
14+
echo "MATCH ()-[r:Defines]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
15+
echo "Implements count:"
16+
echo "MATCH ()-[r:Implements]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
17+
}
18+
19+
query_counts "/Users/saurabh/logging-log4j2/decypher.db"
20+
query_counts "/Users/saurabh/neuvem/java2graph/decypher.db"

compare_kafka.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
function query_counts() {
3+
local db=$1
4+
echo "Analyzing $db"
5+
echo "Class count:"
6+
echo "MATCH (n:Class) RETURN count(*);" | lbug "$db" -r | grep -A 1 ''
7+
echo "Method count:"
8+
echo "MATCH (n:Method) RETURN count(*);" | lbug "$db" -r | grep -A 1 ''
9+
echo "Calls count:"
10+
echo "MATCH ()-[r:Calls]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
11+
echo "Extends count:"
12+
echo "MATCH ()-[r:Extends]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
13+
echo "Defines count:"
14+
echo "MATCH ()-[r:Defines]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
15+
echo "Implements count:"
16+
echo "MATCH ()-[r:Implements]->() RETURN count(r);" | lbug "$db" -r | grep -A 1 ''
17+
}
18+
19+
query_counts "/Users/saurabh/products/benchmarks/kafka/test/decypher.db"

0 commit comments

Comments
 (0)