Chapter 19 · Composite Databases, Multiple Databases, Federation, and Data-Domain Boundaries
Domain Decomposition, Graph Ownership, Shared Reference Data, and Governance Across Graphs
Decompose AtlasMart by business ownership rather than arbitrary labels, define shared-reference and identity contracts, and govern schema, security, versioning, backup, and change across independently operated graphs.
AtlasMart can technically split Catalog, Customers and Orders,
but technology does not decide who may change
productId, how a Product rename propagates, which
domain may retain customer PII, or who restores a constituent
after corruption. Without governance, proxy IDs drift,
duplicated fields become contradictory, and a “federated graph”
becomes three incompatible schemas. This lesson makes ownership
executable.
Every cross-domain field needs one authoritative owner, a compatibility contract, and an explicit copy/freshness policy. “Shared” must not mean “nobody owns it.”
Learning outcomes
Decompose AtlasMart domains by business invariants, write ownership and lifecycle rather than table/label count.
Define stable identity and proxy contracts for Customer/Product references across graphs.
Choose replication/read-model policies for shared reference data with explicit freshness and deletion semantics.
Govern RBAC, schema/index changes, backups and version compatibility per constituent.
Design migration, reconciliation and rollback mechanisms that detect cross-domain drift.
Reproducible Chapter 19 lab baseline
Current self-managed Neo4j is 2026.07.1; current
5.26 LTS is 5.26.30. The course remains on Java
21 or 25, explicit CYPHER 25 for
version-sensitive examples, and Python driver 6.3. The
mandatory chapter lab uses three disposable Neo4j Community
2026.07.1 instances because Community can host exactly one
standard database per DBMS. No runtime output or latency value
in these lessons is claimed to have been executed during
generation; deterministic expected rows are fixture invariants
and timings must be measured by the learner.
Self-managed
Community Edition can have exactly one standard
database. Self-managed
Enterprise Edition can have multiple standard
databases; CREATE DATABASE and composite-database
administration are Enterprise features and are not available
on Aura. Composite databases are Enterprise-only and
explicitly unavailable on Aura. Therefore the free learning
path uses separate Community DBMS instances and
application-side federation; optional Enterprise commands are
labeled and must not be mistaken for Community or Aura
behavior.
| Term | Mechanism-first meaning |
|---|---|
| standard database | A physical Neo4j database that contains one graph in Neo4j 2026.07; it is an execution context and transaction domain. |
| DBMS | A Neo4j database-management process/deployment that hosts the system database plus the standard databases allowed by its edition. |
| system database | Built-in metadata/security database used for database, alias, server and access administration; it does not contain AtlasMart domain graph data. |
| multiple databases | Several standard databases managed by one Enterprise DBMS; separation is stronger than labels but still shares DBMS/server resources and operations. |
| composite database | Enterprise logical execution/federation context containing aliases to constituent graphs; it stores no graph data independently. |
| constituent | A local or remote standard database exposed inside a composite through a namespaced alias. |
| local alias | Alias whose target standard database is in the same DBMS. |
| remote alias | Alias whose target is another Neo4j DBMS over a driver connection and whose authentication/security is governed at that remote boundary. |
| federated query | One Cypher query whose graph-specific subqueries read from more than one constituent. |
| location transparency | The caller uses a logical constituent name while the alias determines whether its target is local or remote; latency/failure locality is not magically erased. |
| proxy node | A deliberately duplicated identity-only node used to join facts across disjoint graphs because Neo4j relationships cannot span graphs. |
| transaction domain | The set of graph updates that can commit atomically together. A standard database is one transaction domain; a composite permits multi-graph reads but updates only one constituent per transaction. |
| tenant boundary | A technical/operational separation choice for tenant data. Database separation does not automatically provide CPU/memory/noisy-neighbor isolation, billing isolation, or legal compliance. |
| domain ownership | The team/system accountable for a fact’s schema, invariants, writes, recovery and lifecycle—not merely the graph where a convenient copy exists. |
| Community instance | Purpose | HTTP | Bolt | Container | Volume |
|---|---|---|---|---|---|
| catalog | Product/catalog source of truth | 7574 | 7767 | atlasmart-ch19-catalog | atlasmart-ch19-catalog-data |
| orders | Order facts plus CustomerRef/ProductRef proxies | 7575 | 7768 | atlasmart-ch19-orders | atlasmart-ch19-orders-data |
| customers | Customer source of truth | 7576 | 7769 | atlasmart-ch19-customers | atlasmart-ch19-customers-data |
| Assumption | Pinned value / rule |
|---|---|
| deployment | Three isolated local Community containers on one workstation; this simulates domain separation, not a composite database |
| database | Each Community DBMS uses its single standard database named neo4j |
| auth | Synthetic lab-only neo4j / atlasmart-course-2026 credential; never use it outside the disposable lab |
| TLS | Loopback lab uses bolt:// for simplicity; remote production aliases/drivers require verified TLS and credential governance |
| plugins | No APOC or GDS required |
| indexes | Uniqueness constraints on domain IDs only; no cross-database constraint exists |
| graph size | Tiny deterministic fixture: 3 products, 3 customers, 3 orders, 4 line items/proxy references |
| failure injection | Stop one disposable instance or add an application-side artificial delay; no destructive network or disk fault is required |
| Enterprise option | Commands are examples for a licensed self-managed Enterprise environment and are not executed by the free path |
| Aura | Composite databases and self-managed CREATE DATABASE are not taught as Aura capabilities |
1. Domain decomposition starts from invariants
| Domain | Authoritative facts | Writes it owns | Cross-domain inputs |
|---|---|---|---|
| Catalog | Product name/category/current price/availability metadata | product lifecycle and current merchandising facts | supplier/inventory feeds if applicable |
| Customers | Customer profile/tier/preferences under policy | profile and customer lifecycle | consent/identity-provider facts |
| Orders | Order status, line quantity, charged unit price, payment/shipment references | order lifecycle and immutable commercial history | customerId/productId identity references |
If an Order must remain legally/auditably understandable after a Product is deleted or renamed, Orders should own the historical display snapshot required by that policy. That intentional denormalized fact is not the same as claiming Orders owns current Catalog truth.
2. Identity governance is the federation backbone
| Contract item | Rule | Evidence/test |
|---|---|---|
| customerId | immutable, globally unambiguous within AtlasMart identity namespace | uniqueness constraint in Customers; CustomerRef uniqueness in Orders |
| productId | stable catalog identity; never recycle for a different product | Catalog uniqueness + ProductRef uniqueness |
| orderId | Orders-owned immutable identity | Orders uniqueness; downstream events include it |
| operation/event IDs | idempotency and reconciliation identity across async workflows | consumer records/rejects duplicate operation IDs |
Neo4j element IDs are database-local identifiers and are not a domain-wide business identity contract. Use explicit stable business keys for cross-graph proxy matching.
3. Shared reference data has four strategies
| Strategy | Example | Consistency/failure profile | Governance requirement |
|---|---|---|---|
| query owner live | Orders endpoint looks up Product name in Catalog | fresh but coupled to Catalog latency/availability | timeouts, degradation semantics, access contract |
| intentional snapshot | Order line stores productNameAtPurchase | historically stable, intentionally stale | field name/meaning makes snapshot semantics explicit |
| materialized read model | Orders/Reporting maintains ProductSummary | bounded staleness, decoupled reads | event/checkpoint, rebuild, reconciliation, deletion policy |
| duplicate source of truth | both domains freely edit productName | conflicting truth | avoid |
4. Security is per boundary
Optional Enterprise composite RBAC does not create one blanket privilege over every constituent. Access to the composite and each target database must be granted appropriately. For remote aliases, the remote DBMS applies the remote principal’s permissions. Data-domain governance should therefore publish a matrix of service identity → composite access → constituent access → graph operations → procedures.
// OPTIONAL Enterprise example; exact role naming is an AtlasMart design choice.
CYPHER 25
CREATE ROLE atlasmart_reader IF NOT EXISTS;
GRANT ACCESS ON DATABASE atlasmart TO atlasmart_reader;
GRANT ACCESS ON DATABASE `atlasmart-catalog` TO atlasmart_reader;
GRANT ACCESS ON DATABASE `atlasmart-orders` TO atlasmart_reader;
GRANT ACCESS ON DATABASE `atlasmart-customers` TO atlasmart_reader;
GRANT MATCH {*} ON GRAPH `atlasmart-catalog` TO atlasmart_reader;
GRANT MATCH {*} ON GRAPH `atlasmart-orders` TO atlasmart_reader;
GRANT MATCH {*} ON GRAPH `atlasmart-customers` TO atlasmart_reader;
SHOW ROLE atlasmart_reader PRIVILEGES;
| Security question | Owner |
|---|---|
| Who can query Customer PII? | Customers security/data owner |
| Can Orders service read all Customer fields? | Only fields/graph privileges required by its contract; use a dedicated read model/API if finer isolation is needed |
| Who rotates remote alias credentials? | platform/security owner with secret manager and tested rollover |
| Who can alter composite aliases? | restricted DBMS administration role; alias changes can redirect traffic/data access |
5. Schema and version changes need compatibility windows
| Change | Safe rollout idea | Rollback evidence |
|---|---|---|
| add Product field | additive change; old consumers ignore it | old query suite still passes |
| rename productId | do not flip abruptly; dual-read/write migration or new versioned ID contract | proxy reconciliation and backfill counters |
| Cypher feature only on newer constituent | upgrade/preflight all participating DBMS versions before query adoption | feature matrix + fallback query |
| alias retarget local→remote | canary connectivity/TLS/auth/latency, then controlled switch | old target retained and reconciliation/checkpoint captured |
Current documentation describes compatibility as effectively limited by the intersection of features available on the composite DBMS and its participating constituents. Treat mixed-version federation as a tested deployment matrix, not “it should probably work.”
6. Backup/recovery is domain-owned and reconciled
| Recovery artifact | Catalog | Customers | Orders |
|---|---|---|---|
| backup/dump | its data-bearing database | its data-bearing database | its data-bearing database |
| restore validation | product count/IDs/schema | customer count/IDs/policy fields | order counts/line totals/proxy IDs |
| cross-domain reconciliation | every active ProductRef resolves or has approved tombstone | every CustomerRef resolves or has approved deletion/tombstone rule | no orphan proxy violates business policy |
The composite does not contain Product/Customer/Order graph data. A DR plan must inventory and restore constituents, alias metadata/credentials, security configuration and then verify cross-domain identity/invariants.
7. Reconciliation query set
CYPHER 25
MATCH (cr:CustomerRef)<-[:PLACED_BY]-(o:Order)
RETURN cr.customerId AS customerId, count(o) AS orderCount
ORDER BY customerId;
MATCH (pr:ProductRef)<-[li:CONTAINS]-(o:Order)
RETURN pr.productId AS productId,
count(li) AS lineCount,
sum(li.quantity) AS units
ORDER BY productId;
# Pseudocode deliberately uses stable business IDs, not element IDs.
owner_product_ids = set(fetch_catalog_product_ids())
proxy_product_ids = set(fetch_order_product_ref_ids())
print("missing in catalog", sorted(proxy_product_ids - owner_product_ids))
print("unused in orders", sorted(owner_product_ids - proxy_product_ids))
# A difference is evidence to classify, not automatically an error: tombstones/history may be valid.
8. Governance acceptance checklist
Check your understanding
- What makes a field safe to copy across domains?
- Why are element IDs poor federation keys?
- Does composite RBAC automatically grant every constituent?
- What must a restore drill verify after each constituent comes back?
- How should mixed-version constituent support be decided?
Review the answers
1. Its owner, semantic meaning, freshness/immutability, deletion policy and reconciliation rule are explicit.
2. They are database-local implementation identifiers rather than stable cross-domain business identities.
3. No. Access is defined for the composite and constituents; remote targets enforce their remote principal rules.
4. Local invariants plus cross-domain proxy/identity reconciliation and application behavior.
5. By a tested compatibility/feature matrix across the composite DBMS, constituents, Cypher and drivers—not assumption.
Production judgment
| Decision surface | Production questions |
|---|---|
| graph/workload fit | Does domain separation reduce ownership/capacity coupling, or does it turn the dominant traversal into repeated remote joins? |
| correctness | Which invariants remain atomic inside one graph, and which become asynchronous/application-coordinated across domains? |
| model/cardinality/degree | Which high-degree relationships must remain local for traversal cost and invariant enforcement? Which references are safe as proxy keys? |
| latency | How much p95/p99 is local graph work versus remote constituent/network/application join time? What happens during remote tail spikes? |
| transactions/concurrency | Which writes must commit together? Composite transactions may read many graphs but update only one constituent; plan compensating/outbox workflows elsewhere. |
| memory/resources | Do multiple databases share a DBMS resource envelope? Do separate instances need independent memory/page-cache/process budgets and capacity headroom? |
| CPU/disk/network | Does federation move filtering to constituents or ship excessive rows across network boundaries? Are region/zone egress and serialization material? |
| indexes/constraints | Are stable IDs constrained and indexed independently on each owning/proxy graph? No cross-graph relationship or uniqueness constraint exists. |
| driver | Are database/alias names explicit, drivers long-lived, timeouts/retries bounded, and per-domain timings correlated? |
| security/tenant risk | Are ACCESS/MATCH/procedure rights granted on every required constituent? How are remote credentials/OIDC forwarding, TLS and tenant boundaries governed? |
| backup/recovery | Can every constituent be restored and reconciled independently? A composite alias layer is not a backup of its target stores. |
| observability | Can operators attribute latency/errors to the root composite scope and each local/remote constituent without hiding network waits? |
| testing/failure injection | Have one-domain-down, stale proxy, version mismatch, denied constituent, slow remote graph and ambiguous cross-service write cases been tested safely? |
| version/edition/Aura | Is the design pinned to self-managed Enterprise composite support? What is the fallback for Community/Aura or mixed-version constituents? |
| licensing/cost/migration | Does federation justify Enterprise/ops/network cost, and can the split be rolled back or re-partitioned without breaking identity contracts? |
Summary and next step
Domain boundaries are now backed by owners, IDs, copy semantics, privileges, versions and recovery rules. Lesson 5 combines the chapter into an architecture review that decides which AtlasMart relationships stay local, which become federated references, and when the split should be rejected.
Authoritative references
- Current Neo4j versions — Current self-managed release 2026.07.1 and 5.26.30 LTS snapshot.
- Database administration — Current database/transaction-domain model and the one-standard-database Community versus multi-database Enterprise boundary.
- Create standard databases — Enterprise-only self-managed CREATE DATABASE semantics and system-database administration.
- Show databases — SHOW DATABASES fields including type, role, writer, status, aliases and constituents.
- Composite database concepts — Enterprise-only, unavailable-on-Aura composite semantics, local/remote constituents, compatibility, transactions and proxy-node federation.
- Create composite databases — CREATE COMPOSITE DATABASE and current default Cypher language behavior.
- Query composite databases — USE/CALL graph selection, graph functions, update restrictions, root-scope limits and runtime behavior.
- Composite aliases — Local and remote constituent aliases, SHOW ALIASES evidence, namespace rules and alias limitations.
- Standard aliases — Local/remote alias behavior, credentials, access visibility and current OIDC-forwarding option for remote aliases.
- Composite RBAC — Access must be granted to the composite and constituents; remote constituents enforce remote-user RBAC.
- Composite tutorial — Official federation/sharding example and proxy-node model.
- Database alias command syntax — Current SHOW/CREATE/ALTER alias command forms.
- Cypher USE clause — Current graph-selection clause semantics for composite/federated queries.
- Python driver manual — Official driver lifecycle, sessions, parameters, database selection and application-side orchestration.
- Backup and restore — Operational reminder that constituent data stores—not a composite alias layer—are the recovery units.