From 4721bfff24f4551880ed12c72cc33979fd99c0e5 Mon Sep 17 00:00:00 2001 From: Yan Levin Date: Mon, 17 Aug 2026 17:53:15 -0500 Subject: [PATCH] reduced logo size in readme and expanded readme examples --- README.md | 27 +++++++++++++++---- .../test/java/org/estore/example/Person.java | 5 ++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b19062e..df3afef 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # In-memory Object Graph Stores - + Implementation of an in-memory object graph store, dubbed ϵStore. Our key innovation is a storage model -- epsilon store -- that equates an @@ -23,24 +23,41 @@ programs. Estore db = new Estore("exampleDb", new EstoreOptions().useUnsafe(false)); db.captureAll(alice); + + // MATCH finds Person objects; RETURN puts them in column p Table result = db.query("MATCH (p:`org.estore.example.Person`) RETURN p"); + + result.print(); + Person p = (Person) result.get("p").get(0); + System.out.println(p.name + ", " + p.age); + System.out.println(p.friend.name); ``` `alice` is an ordinary Java `Person` object (name `"Alice"`, age 28). Its `friend` field points to Bob, and Bob's `friend` field points to Charlie, so the in-memory graph is Alice → Bob → Charlie. `captureAll(alice)` walks that - graph from Alice and stores every reachable object; the query then returns - the captured `Person` nodes. + graph from Alice and stores every reachable object. The query finds those + `Person` objects (`MATCH`) and returns them as a table column named `p` + (`RETURN`). Cells in that table are the same heap objects, so they can be + printed, cast to `Person`, and used like any other Java object — including + following `friend` in ordinary Java. 2. Querying object relationships. ```java Table friends = db.query("MATCH (a:`org.estore.example.Person`)-[:friend]->(b:`org.estore.example.Person`) RETURN a, b"); + + for (int i = 0; i < friends.getSize(); i++) { + Person a = (Person) friends.get("a").get(i); + Person b = (Person) friends.get("b").get(i); + System.out.println(a.name + " → " + b.name); + } ``` - This query follows `friend` references between captured `Person` objects and - returns each matched pair. + `-[:friend]->` follows the `friend` field between captured `Person` objects + and returns each matched pair. The loop casts those cells back to `Person` + and prints the names. ## Using ϵStore in a Maven Project diff --git a/estore/src/test/java/org/estore/example/Person.java b/estore/src/test/java/org/estore/example/Person.java index 2926c49..73e6a3a 100644 --- a/estore/src/test/java/org/estore/example/Person.java +++ b/estore/src/test/java/org/estore/example/Person.java @@ -16,4 +16,9 @@ public Person(String name, int age, Person friend) { this.age = age; this.friend = friend; } + + @Override + public String toString() { + return name + " (" + age + ")"; + } }