1 Why Neo4j?
ShaDey Inc.'s current physical data model is a star schema with 24 entities and 24 relationships, optimised for aggregation queries: "What were total sales by store last quarter?" But several critical business problems are traversal problems, where the answer lies in walking chains of relationships across multiple hops. Star schemas answer the first efficiently; Neo4j's native graph storage and index-free adjacency answer the second in milliseconds. Neo4j stores relationships as direct physical pointers between nodes, meaning traversal cost is proportional to the result set, not the total data volume.
| Characteristic | Star Schema (Current PDM) | Neo4j (Proposed) |
|---|---|---|
| Optimised For | Aggregation, GROUP BY, SUM, AVG | Traversal, path finding, impact analysis |
| Query Pattern | "Total revenue by store for Q4" | "Which customers are affected if Supplier X fails?" |
| Join Depth | Efficient at 1-3 joins | Efficient at 3-15+ hops |
| Schema | Fixed star/snowflake with SCD Type 2 | Neo4j Labeled Property Graph with node labels, relationship types, and property constraints |
| Relationship Cost | Expensive (hash joins at query time) | Free via index-free adjacency (Neo4j stores relationships as direct physical pointers) |
| ShaDey Entities | All 24 entities (6 dims, 5 facts, 10 DPs, 3 ML) | Subset: dims + facts as Neo4j nodes with labels, new relationship types |
| Technology | PostgreSQL / Snowflake / Redshift | Neo4j Enterprise (Cypher query language, APOC library, Graph Data Science) |
2 Supply Chain Risk Propagation
When a supplier has a quality failure, delivery disruption, or capacity constraint, ShaDey Inc. needs to instantly understand the blast radius: which products, stores, open orders, and ultimately which customers are affected. In the relational model this requires joining supplier → product → sales_order → customer across fact tables. In Neo4j, it is a single Cypher traversal that leverages index-free adjacency to walk the chain in constant time per hop.
Scenario: TexFab Industries, a key textile supplier, fails a quality inspection on a batch of fabric. The procurement team needs to know within seconds: (1) which finished products use this fabric, (2) which stores stock those products, (3) which open orders are at risk, and (4) which VIP customers have pending orders.
RDBMS Challenge: In the current star schema, this requires a 5-table join chain: supplier → product → inventory → store plus supplier → product → sales_txn → sales_order → customer. With millions of rows in fact tables, this query takes 30-60 seconds and requires careful index tuning.
Neo4j Solution: A single Cypher traversal walks the relationship chain in under 100ms, regardless of total data volume. Neo4j's native graph storage engine uses index-free adjacency, meaning each node physically points to its neighbours. Traversal cost is O(relationships followed), not O(total rows). Combined with Neo4j's property indexes on name and status fields, the initial node lookup is sub-millisecond.
3 Customer 360 & Recommendation Network
ShaDey Inc.'s dp_cust360 data product aggregates metrics per customer. But cross-customer intelligence requires graph traversal: "customers who bought X also bought Y", "which customers have similar purchase patterns to this churning VIP?", and "which promotions resonate with this customer's peer group?"
Scenario: A VIP Gold customer with $12,000 annual spend shows declining purchase frequency. The retention team needs to know: (1) which similar customers already churned, (2) what those customers bought before churning, (3) which promotions successfully re-engaged similar customers, and (4) real-time product recommendations based on peer purchases.
RDBMS Challenge: Computing customer similarity requires self-joining sales_txn millions of rows against itself, grouping by customer pairs, and calculating overlap metrics. This is a batch operation that runs overnight, making it useless for real-time POS recommendations.
Neo4j Solution: Customer-to-customer SIMILAR_TO relationships are precomputed using Neo4j Graph Data Science (GDS) library algorithms like Node Similarity or K-Nearest Neighbours and written back as relationship properties. At query time, traversing the similarity network in Cypher is O(k) where k is the number of similar customers, returning recommendations in single-digit milliseconds. Neo4j GDS also provides community detection (Louvain, Label Propagation) to identify natural customer clusters beyond RFM segmentation.
4 Data Lineage & Governance
ShaDey Inc.'s governance framework defines a 4-layer certification model (CDM → LDM → PDM → Pipelines) with quality gates at each transition. The critical question during the SAP ECC → S/4HANA migration is: "If MARA changes to a new structure, which data products, dashboards, ML models, and downstream consumers break?" This is a lineage traversal problem.
Scenario: During the S/4HANA migration, SAP table MARA (material master) undergoes structural changes. The data engineering team needs to instantly identify every downstream consumer: which ETL pipelines read MARA, which PDM columns are derived from it, which data products (dp_prodcat, dp_salesdaily, dp_invpos) are affected, and which ML models (dp_demand, aiml_features) would produce incorrect predictions.
RDBMS Challenge: Lineage metadata is typically scattered across ETL tool catalogs, data dictionaries, and documentation. Even when centralised, querying "all downstream consumers N hops away" requires recursive CTEs that are expensive and hard to maintain.
Neo4j Solution: Every source table, column, transformation, data product, and consumer is a labeled node in Neo4j. Lineage relationships (FEEDS, TRANSFORMS, BUILDS, CONSUMED_BY) form a directed acyclic graph. Impact analysis is a single variable-length Cypher pattern *1..6 from the changed node. Neo4j's APOC library provides additional path expansion procedures (apoc.path.expandConfig) for fine-grained traversal control, and its built-in visualisation in Neo4j Browser makes lineage graphs immediately explorable by data stewards.
| ECC Source | S/4HANA Change | Downstream Impact (Graph Traversal) |
|---|---|---|
| MARA / MAKT / MARC | Product master simplified, MBEW merged | product → dp_prodcat → dp_salesdaily → dp_demand → aiml_features |
| MSEG / MKPF | Replaced by MATDOC | inventory → dp_invpos → dp_demand (reorder signals break) |
| BSEG / BKPF | Replaced by ACDOCA (Universal Journal) | sales_txn → dp_netsales → dp_salesdaily → dp_storean |
| KNA1 / KNB1 | Replaced by BUT000 (Business Partner) | customer → dp_cust360 → dp_custseg → aiml_features |
| KONV | Replaced by PRCD_ELEMENTS | promotion → dp_promoeff → sales_txn pricing columns |
5 Product Substitution & Assortment Networks
When a product goes out of stock or is discontinued, ShaDey Inc. needs to recommend substitutes that overlap with the same customer segments. This requires traversing product-category-customer relationships to find alternatives that satisfy similar preferences, not just products in the same category.
Scenario: ShaDey Inc.'s best-selling winter coat is out of stock at 12 stores. The merchandising team needs: (1) which other coats satisfy the same customer segment, (2) whether those substitutes are in stock at the affected stores, (3) whether recommending Product B will cannibalise Product C's sales, and (4) category gaps where no substitute exists.
Neo4j Solution: Products, categories, customer segments, and stores form a rich labeled property graph in Neo4j. Cypher traversals like Product → PREFERRED_BY → Segment → PREFERS → Product find customer-validated substitutes. Checking Product → IN_STOCK_AT → Store confirms availability. Neo4j GDS's Node Similarity algorithm quantifies product overlap by shared customer base, and the Jaccard coefficient on customer edges directly identifies cannibalization risk.
6 Order Fulfillment Path Optimisation
ShaDey Inc.'s dp_orderfulf data product tracks days-to-ship and on-time delivery flags. But optimising which distribution centre fulfils which store for which order is a shortest-path problem across the logistics network, a native graph operation.
Scenario: ShaDey Inc.'s East Coast distribution centre is temporarily offline due to severe weather. 340 pending orders need to be rerouted to the next-best fulfilment location based on product availability, shipping cost, and delivery SLA constraints.
Neo4j Solution: The logistics network (DCs, stores, regions, carrier routes) is modelled as a weighted property graph in Neo4j. Each relationship carries cost, transit_days, and capacity properties. Neo4j Graph Data Science (GDS) library provides Dijkstra's shortest-path and A* algorithms as native procedures. The gds.shortestPath.dijkstra call finds the optimal rerouting for each order in real time, returning both total cost and the full path of intermediate nodes.
7 Dual Architecture: Star Schema + Neo4j
Neo4j complements ShaDey Inc.'s existing star schema. The data warehouse remains the analytical backbone for aggregation, rollups, and historical trend analysis. Neo4j handles real-time traversal, impact analysis, and relationship-intensive queries where join depth exceeds three hops. Data flows from SAP through the CDC pipeline into both systems. Neo4j's Kafka connector or custom APOC load procedures ingest change events, while the Neo4j Bolt protocol serves sub-50ms query responses to application layers.
| Query Type | Routed To | Example |
|---|---|---|
| Aggregation / Rollup | Star Schema DW | Monthly revenue by store, YoY growth, inventory turnover |
| Historical Trend | Star Schema DW | SCD Type 2 customer history, price change timeline |
| Impact Analysis | Neo4j (Cypher) | Supplier failure blast radius, migration impact, lineage |
| Similarity / Recommendation | Neo4j (GDS) | Customer peers, product substitutes, cross-sell |
| Path Optimisation | Neo4j (GDS) | Fulfilment routing, shortest delivery path |
| Prediction / Scoring | ML Feature Store | Demand forecast, customer segmentation, churn risk |
8 Implementation Priority
Ranked by business impact, alignment with existing data model entities, and implementation complexity. Phase 1 use cases map directly to entities already modelled in the PDM and solve problems where the current RDBMS architecture requires expensive multi-hop joins.
PDM Entity Coverage by Use Case
| PDM Entity | Supply Chain | Customer Net. | Lineage | Substitution | Fulfilment |
|---|---|---|---|---|---|
| customer | Affected | Core node | Downstream | Segment link | Destination |
| product | Core node | Purchase edge | Downstream | Core node | Line item |
| supplier | Core node | Source | |||
| store | Stocked at | Downstream | Availability | Core node | |
| promotion | Response edge | ||||
| sales_order | At-risk orders | Core node | |||
| inventory | Stock check | Downstream | Availability | ||
| shipment | Core node | ||||
| dp_cust360 | Enrichment | Downstream | |||
| dp_custseg | Segmentation | Downstream | Segment match | ||
| dp_prodcat | Downstream | Category link | |||
| dp_invpos | Stockout signal | Downstream | Stock check | ||
| dp_demand | Downstream | ||||
| aiml_features | Similarity | Downstream |
9 Graph Modeling Across the Platform
Neo4j's graph approach extends across ShaDey Inc.'s advanced data modeling modules. The patterns shown here: relationship traversal, impact analysis, multi-hop reasoning, and algorithmic graph operations. These appear in multiple contexts across the platform. Explore how Neo4j integrates with other modeling paradigms and governance frameworks.
The Medallion Architecture module demonstrates how ShaDey Inc. converts relational Bronze/Silver/Gold layers into Neo4j graph structures, including temporal edge modeling for tracking how product-supplier relationships evolve over time.
Data Vault 2.0's Hub-Satellite-Link pattern maps naturally to graph structures. The Data Vault module shows how Neo4j can visualize and validate vault model relationships, detect anti-patterns, and trace lineage through Raw and Business Vault layers.
Domain-Driven Design bounded contexts become explicit graph partitions in Neo4j. The DDD module demonstrates how anti-corruption layers between domains can be modeled as typed relationships with validation rules.
KPI dependency DAGs from the Semantic Layer module are natively graph structures. Neo4j enables impact analysis when upstream metrics change, and feature store lineage tracking for ML model governance.
The Enterprise Governance module shows how Neo4j tracks model versioning, naming rule enforcement, and semantic drift detection across the enterprise data catalog.
Identity resolution graphs from the CRM module use Neo4j to link customer identities across SAP, Salesforce, and Shopify, enabling probabilistic matching and survivorship logic visualization.