MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / main

Method main

examples/java/bindings/BasicUsage.java:22–63  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

20public class BasicUsage {
21
22 public static void main(String[] args) {
23 System.out.println("=== GraphLite Java Bindings Example ===\n");
24
25 // Use temporary directory for demo
26 Path tempDir = null;
27 try {
28 tempDir = Files.createTempDirectory("graphlite_java_");
29 System.out.println("Using temporary database: " + tempDir + "\n");
30
31 runExample(tempDir.toString());
32
33 System.out.println("\n=== Example completed successfully ===");
34
35 } catch (GraphLiteException e) {
36 System.err.println("\n[ERROR] GraphLite Error: " + e.getMessage());
37 System.err.println("Error code: " + e.getErrorCode());
38 System.exit(1);
39
40 } catch (Exception e) {
41 System.err.println("\n[ERROR] Unexpected error: " + e.getMessage());
42 e.printStackTrace();
43 System.exit(1);
44
45 } finally {
46 // Cleanup
47 if (tempDir != null) {
48 try {
49 Files.walk(tempDir)
50 .sorted(Comparator.reverseOrder())
51 .forEach(path -> {
52 try {
53 Files.delete(path);
54 } catch (IOException e) {
55 // Ignore
56 }
57 });
58 } catch (IOException e) {
59 // Ignore cleanup errors
60 }
61 }
62 }
63 }
64
65 private static void runExample(String dbPath) {
66 // 1. Open database

Callers

nothing calls this directly

Calls 3

runExampleMethod · 0.95
toStringMethod · 0.80
getErrorCodeMethod · 0.80

Tested by

no test coverage detected