You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance README with detailed descriptions of type-safe TinkerPop/Gremlin traversal API and its integration in the @codemix/graph package. Update package descriptions for clarity and consistency.
Copy file name to clipboardExpand all lines: README.md
+27-11Lines changed: 27 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,26 @@
1
1
# @codemix/graph
2
2
3
-
A full type safe,TypeScript-first in-memory property graph database with a Cypher query language parser, multiple index types, and pluggable storage adapters.
3
+
A fully type-safe, TypeScript-first in-memory property graph database with a Cypher query language parser, a **type-safe [TinkerPop](https://tinkerpop.apache.org/) / [Gremlin](https://tinkerpop.apache.org/docs/current/reference/#gremlin)-style traversal API** (`GraphTraversal`), multiple index types, and pluggable storage adapters including a [Yjs](https://yjs.dev/) CRDT-based adapter for collaborative/realtime/offline-first use.
4
+
5
+
This is the knowledge graph database for the [codemix](https://codemix.com/) product intelligence platform.
|[`@codemix/text-search`](./packages/text-search)| 0.0.1 | BM25-based full-text search with English stemming |
13
+
|[`@codemix/y-graph-storage`](./packages/y-graph-storage)| 0.0.1 |[Yjs](https://yjs.dev/) CRDT storage adapter for collaborative/offline-first use |
12
14
13
15
---
14
16
15
17
## `@codemix/graph`
16
18
17
-
A fully typed, in-memory graph database. Vertices and edges are strongly typed against a user-defined schema. Queries are written in a subset of [Cypher](https://neo4j.com/docs/cypher-manual/current/).
19
+
A fully typed, in-memory graph database. Vertices and edges are strongly typed against a user-defined schema. You can query with a subset of [Cypher](https://neo4j.com/docs/cypher-manual/current/)**or** with a fluent, **type-safe [Apache TinkerPop](https://tinkerpop.apache.org/) / [Gremlin](https://tinkerpop.apache.org/docs/current/reference/#gremlin)-style API** — see [`GraphTraversal`](./packages/graph/README.md#type-safe-tinkerpop--gremlin-traversal-api) in the package docs.
18
20
19
21
### Features
20
22
23
+
-**Type-safe TinkerPop / Gremlin traversals** — `GraphTraversal` exposes familiar steps (`V()`, `E()`, `out()`, `in()`, `both()`, `hasLabel()`, `as()` / `select()`, `repeat()` …) with schema-derived typing on paths and properties; pairs with `AsyncGraph.query` for remote execution
21
24
-**Cypher query language** — parsed via a PEG grammar, supporting `MATCH`, `WHERE`, `RETURN`, `CREATE`, `SET`, `DELETE`, `MERGE`, `UNWIND`, `UNION`, `WITH`, multi-statement queries, and more
22
25
-**Strongly typed schema** — vertex/edge labels and their properties are defined once and inferred throughout
23
26
-**Standard Schema validation** — property values are validated using [Standard Schema](https://standardschema.dev/) compatible validators (works with Zod, Valibot, etc.)
The same graph is navigable with a fluent API modeled on [Apache TinkerPop Gremlin](https://tinkerpop.apache.org/docs/current/reference/#gremlin); labels and properties stay typed end-to-end:
78
+
79
+
```typescript
80
+
import { GraphTraversal } from"@codemix/graph";
81
+
82
+
const g =newGraphTraversal(graph);
83
+
for (const path ofg.V().hasLabel("Person").out("knows")) {
84
+
console.log(path.value.get("name"));
85
+
}
86
+
```
87
+
88
+
See the [type-safe TinkerPop / Gremlin traversal API](./packages/graph/README.md#type-safe-tinkerpop--gremlin-traversal-api) section in `@codemix/graph` for the full step reference.
Copy file name to clipboardExpand all lines: packages/graph/README.md
+14-37Lines changed: 14 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# @codemix/graph
2
2
3
-
A fully typesafe, TypeScript-first in-memory property graph database with a Cypher-compatible query language, a fluent traversal API, lazy indexes, and async transport support.
3
+
A fully type-safe, TypeScript-first in-memory property graph database with a Cypher-compatible query language, a **type-safe [Apache TinkerPop](https://tinkerpop.apache.org/) / [Gremlin](https://tinkerpop.apache.org/docs/current/reference/#gremlin)-style traversal API** (`GraphTraversal`), lazy indexes, and async transport support.
4
4
5
5
## Table of Contents
6
6
@@ -19,7 +19,7 @@ A fully type safe, TypeScript-first in-memory property graph database with a Cyp
@@ -44,7 +44,7 @@ A fully type safe, TypeScript-first in-memory property graph database with a Cyp
44
44
45
45
-**TypeScript-first** — schema-derived types flow through the entire API; vertex/edge properties are fully typed.
46
46
-**Cypher-compatible query language** — parse and execute `MATCH … WHERE … RETURN` queries, `UNION`, multi-statement queries, `CREATE`, `SET`, `DELETE`, `MERGE`, `UNWIND`, `CALL`, `FOREACH`, and more.
47
-
-**Fluent traversal API** — a gremlin-inspired builder that produces strongly-typed `TraversalPath` chains (`V().out().hasLabel(…).as(…).select(…)`).
47
+
-**Type-safe TinkerPop / Gremlin traversals** — `GraphTraversal` mirrors familiar Gremlin steps (`V`, `E`, `out` / `in` / `both`, `hasLabel`, `as` / `select`, `repeat`, …) with **schema-derived TypeScript types** on `TraversalPath` and property access, not untyped strings at every hop.
48
48
-**Lazy indexes** — hash, B-tree, and full-text indexes are built on first use and maintained incrementally on every mutation.
49
49
-**Unique constraints** — enforce uniqueness on any indexed property.
50
50
-**Standard Schema validation** — property types are validated via the [Standard Schema](https://github.com/standard-schema/standard-schema) spec (compatible with Zod, Valibot, ArkType, etc.).
"MATCH (p:Person)-[:ACTED_IN]->(m:Movie) WHERE p.name = $name RETURN p.name, m.title",
@@ -330,7 +320,11 @@ procedureRegistry.register({
330
320
331
321
---
332
322
333
-
## Traversal API
323
+
## Type-safe TinkerPop / Gremlin traversal API
324
+
325
+
`GraphTraversal` ([`src/Traversals.ts`](./src/Traversals.ts)) is the programmatic counterpart to Cypher: a **fluent, Gremlin-style** API in the spirit of [Apache TinkerPop](https://tinkerpop.apache.org/) — same mental model as `g.V().out('knows')` in Gremlin — but **fully typed** against your `GraphSchema` so labels, edge directions, and property keys are checked by TypeScript.
326
+
327
+
If you already know Gremlin, the step names and composition will feel familiar; the main difference is that paths carry typed vertices/edges from your schema instead of generic maps.
0 commit comments