Skip to content

Interactive Examples

This section contains interactive Jupyter notebooks demonstrating Uni's capabilities across various use cases.

Available Examples

We provide examples in Python, Python with Pydantic OGM, and Rust to match your preferred development style.

Use Cases

Use Case Description Python Pydantic OGM Rust
Supply Chain BOM explosion, cost rollup, defect tracking Python Pydantic Rust
Recommendation Collaborative filtering, vector similarity Python Pydantic Rust
RAG Knowledge graph + vector search for LLM context Python Pydantic Rust
Fraud Detection Cycle detection, shared device analysis Python Pydantic Rust
Sales Analytics Graph traversal with columnar aggregations Python Pydantic Rust

Locy Use Cases

Locy Use Case Description Python Rust
Compliance Remediation Infer exposed vulnerable services with recursive dependency reasoning Python Rust
RBAC Priority Deny-overrides-allow policy modeling using prioritized rules Python Rust
Infrastructure Blast Radius Recursive impact propagation across service call graph Python Rust
Supply Chain Provenance Multi-hop upstream supplier traceability Python Rust
Fraud Risk Propagation Recursive risk spread and clean-account derivation Python Rust
Semiconductor Yield Excursion Triage Real-data manufacturing triage using DERIVE, ASSUME, ABDUCE, and EXPLAIN Python -
Pharma Batch Genealogy (Flagship #2) Batch-risk propagation and risk-first intervention optimization Python -
Cyber Exposure Twin (Flagship #3) Hybrid search + columnar analytics + Locy remediation decisioning Python -

Choosing an API

API Best For Key Features
Python (uni_db) Direct database access, max flexibility Raw Cypher, bulk operations
Pydantic OGM Type-safe models, IDE autocomplete Pydantic validation, query builder, ORM patterns
Rust Performance-critical applications Zero-cost abstractions, compile-time safety

Running the Notebooks

Python Notebooks

# Install dependencies
cd bindings/uni-db
pip install -e .

# Run Jupyter
jupyter notebook examples/

Pydantic OGM Notebooks

# Install uni-pydantic
cd bindings/uni-pydantic
poetry install

# Run Jupyter
poetry run jupyter notebook examples/

Rust Notebooks

Rust notebooks require the evcxr_jupyter kernel:

# Install the Rust Jupyter kernel
cargo install evcxr_jupyter
evcxr_jupyter --install

# Run Jupyter
jupyter notebook examples/rust/

What You'll Learn

Each notebook demonstrates:

  • Schema Design - Defining labels, edge types, and properties
  • Data Ingestion - Bulk loading vertices and edges
  • Cypher Queries - Pattern matching, filtering, aggregations
  • Graph Algorithms - Traversals, path finding, cycle detection
  • Vector Search - Semantic similarity with embeddings

The Pydantic OGM notebooks additionally show:

  • Type-Safe Models - Defining nodes and edges as Pydantic classes
  • Automatic Schema Sync - Generating database schema from models
  • Query Builder - Fluent API for building queries
  • Relationships - Declaring and traversing graph relationships

Source Code

The notebook source files are also available in the repository: