Skip to content

09 — Neo4j projection: the same IR as a property graph #18

Description

@rahlk

Part of #9. Phase 1 — level 1.

Learning goals

Trait objects and writer abstraction (TRPL Object-Oriented Programming Features — a
GraphWriter consumed by both a Cypher-snapshot and a Bolt writer is a textbook trait-object
case), cargo feature flags (neo4j feature gating the neo4rs driver so the default build
stays lean), string escaping discipline.

Task

A neo4j/ module mirroring the sibling analyzers' structure — a pure projection of the in-memory
IR, NOT an ingestion of analysis.json:

  • project.rs (IR → rows), rows.rs (RowBuilder: MERGE semantics, deferred edges kept only if
    the target node materialized — the no-dangling rule), schema.rs (declarative labels/rel-types
    • SCHEMA_VERSION, constraints DERIVED from labels), cypher.rs (snapshot: constraints → scoped
      wipe → batched UNWIND…MERGE), bolt.rs (incremental content-hash diff push, feature-gated).
  • Labels: RustApplication/RustModule/RustSymbol(merge)/RustStruct/RustEnum/RustTrait/ RustCallable/RustCallSite/RustExternal/...; rels RUST_DECLARES/RUST_HAS_METHOD/RUST_CALLS/ RUST_EXTENDS(supertraits+trait impls)/RUST_RESOLVES_TO/... — in lockstep with
    SCHEMA_DECISIONS.md node kinds.
  • CLI: --emit neo4j (graph.cypher, or live push with --neo4j-uri), --emit schema
    (static schema.json, no -i needed), --app-name.

Teacher's notes

  • The conformance test IS the point: the projector may never emit a label/rel/property the
    declarative schema doesn't declare — that test is what stops silent drift.
  • Copy the shape from codeanalyzer-clang/codeanalyzer_clang/neo4j/ (the freshest instantiation)
    and translate the idiom to Rust.

Gate

  • Conformance test green; snapshot renders with constraints + wipe + MERGE batches;
    --emit schema output stable; deferred-edge rule proven by a test (edge to an unemitted
    target is dropped, not dangling).
  • Default cargo build has NO neo4j driver dependency (feature-gate asserted in CI).

Metadata

Metadata

Assignees

Labels

learning-ladderThe escalating-complexity curriculum issueslevel-1Symbol table + resolver call graph

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions