Skip to content

feat: add Ladybug graph database exporter#4

Merged
elbruno merged 8 commits into
elbruno:mainfrom
eduardpaul:feature/exporter_ladybug
May 11, 2026
Merged

feat: add Ladybug graph database exporter#4
elbruno merged 8 commits into
elbruno:mainfrom
eduardpaul:feature/exporter_ladybug

Conversation

@eduardpaul
Copy link
Copy Markdown
Contributor

@eduardpaul eduardpaul commented May 10, 2026

feat: add Ladybug graph database exporter

🚀 Summary

This PR introduces a new exporter for Ladybug, allowing users to export their knowledge graphs into a format optimized for Ladybug's embedded engine and its web-based visualization tool, Ladybug Explorer.

✨ Key Changes

  • New Exporter Implementation: Added `LadybugExporter` which generates a single `.cypher` file containing:
    • DDL: `CREATE NODE TABLE` and `CREATE REL TABLE` statements defining the graph schema.
    • DML: Structured `CREATE` and `MATCH/CREATE` statements for nodes and relationships.
  • Native Schema Mapping:
    • Maps graph nodes to a unified `GraphNode` table and edges to `GraphEdge`.
    • Leverages Ladybug's native `MAP(STRING, STRING)` type for metadata, ensuring better queryability compared to plain JSON strings.
  • CLI Integration: Updated `Graphify.Cli` to support the `--format ladybug` flag.
  • Documentation: Added a detailed `docs/format-ladybug.md` covering installation, import, and visualization using Docker.
  • Test Coverage: Added extensive unit and integration tests to verify Cypher generation and referential integrity.

🛠 Usage

# Generate the Ladybug Cypher script
graphify run ./src --format ladybug

# Import into a Ladybug database
lbug graph.db < graphify-out/graph.ladybug.cypher

✅ Verification Results

  • Unit Tests: `LadybugExporterTests.cs` covering schema generation and property mapping.
  • Integration Tests: Verified end-to-end pipeline execution with Ladybug output.
  • Architecture: Updated `ARCHITECTURE.md` to reflect the new exporter in the project structure.

@elbruno
Copy link
Copy Markdown
Owner

elbruno commented May 11, 2026

Thanks @eduardpaul , this is nice!
Let me take a look and I'll merge it

Add missing Ladybug exporter and CLI routing coverage, including null relationship fallback, edge metadata output, orphan-edge assertions, and dedicated integration output validation. Fix Ladybug metadata query docs to use size(map_extract(...)) checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@elbruno
Copy link
Copy Markdown
Owner

elbruno commented May 11, 2026

Applied the requested follow-up fixes and validated them locally.

What changed:

  • Fixed Ladybug metadata query docs to use size(map_extract(...)) > 0.
  • Added tests for null relationship fallback to RELATED_TO.
  • Added tests for edge metadata emission.
  • Added multi-edge and whitespace output-path coverage.
  • Fixed the orphan-edge test to remove the dead split on a non-existent marker.
  • Added a dedicated Ladybug integration output-shape test.
  • Added PipelineRunner routing coverage for ladybug.

Validation:

  • dotnet test graphify-dotnet.slnx --no-build --verbosity minimal passed locally.
  • Tank reviewer gate: APPROVED.

@elbruno elbruno merged commit 02b8276 into elbruno:main May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants