Inferensys

Glossary

Schema Mapping

Schema mapping is the process of defining correspondences or transformation rules between elements of a source data schema and a target graph schema to guide data integration or migration.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
GRAPH DATABASE SCHEMAS

What is Schema Mapping?

Schema mapping is the foundational process for integrating heterogeneous data into a unified graph structure.

Schema mapping is the process of defining precise correspondences, or transformation rules, between the elements of a source data schema and a target graph schema to guide data integration or migration. This involves aligning disparate entity types, attributes, and relationships from sources like relational databases or APIs into the vertex, edge, and property constructs of a property graph or RDF knowledge graph. The output is a formal specification that dictates how raw data is transformed, linked, and enriched to populate a cohesive, queryable graph model.

This mapping is critical for building enterprise knowledge graphs and enabling semantic integration pipelines. It ensures that data from different systems, with varying structures and semantics, can be coherently combined. The process often utilizes graph schema languages or specialized mapping tools to define these rules, which are then executed by ETL processes. Effective schema mapping directly underpins data consistency, supports complex graph-based RAG architectures, and is a prerequisite for reliable semantic reasoning over integrated enterprise data.

CORE CONCEPTS

Key Features of Schema Mapping

Schema mapping is the foundational process for data integration and migration, defining precise correspondences between source and target data structures. These features ensure semantic alignment, data integrity, and automated transformation.

01

Structural Alignment

This involves matching elements from a source schema (e.g., a relational database table) to a target graph schema (e.g., vertex and edge types). The process defines how tabular rows become graph nodes, foreign keys become relationships, and columns become node/edge properties. For example, a Customer table maps to a Customer vertex label, and its OrderID foreign key column maps to a PURCHASED edge connecting to an Order vertex.

02

Semantic Reconciliation

Schema mapping resolves differences in meaning and naming conventions between systems. This includes:

  • Synonym Resolution: Mapping cust_name (source) to customerName (target).
  • Taxonomy Alignment: Determining that a source product_category value of "AUTO" corresponds to the target ontology class VehicleParts.
  • Unit Conversion: Specifying that a source field in miles must be transformed to kilometers in the target. This ensures the integrated data carries consistent, unambiguous meaning.
03

Transformation Rule Specification

Mappings include executable rules for data conversion and enrichment during the migration process. These are often expressed in a declarative mapping language or scripts. Common transformations include:

  • Data Type Casting: string to date.
  • Value Lookup & Enrichment: Using a reference table to convert a country code into a full country name.
  • Concatenation/Splitting: Creating a full name from first_name and last_name fields.
  • Conditional Logic: Applying different rules based on source data values.
04

Cardinality & Relationship Definition

A critical feature is defining how source record associations translate into graph relationships. This specifies:

  • Relationship Direction: Whether an edge is directed from A to B.
  • Relationship Type: The label of the edge (e.g., WORKS_FOR, CONTAINS).
  • Multiplicity: Whether a source record links to one or many target records, defining one-to-one, one-to-many, or many-to-many relationships in the graph. For instance, one Company record may map to many Employee vertices, connected by EMPLOYS edges.
05

Constraint Preservation

The mapping process must preserve or translate data integrity constraints from the source to the target environment. This includes:

  • Uniqueness Constraints: Ensuring a property like email remains unique across all Person vertices.
  • Mandatory Fields: Defining that certain properties cannot be null.
  • Referential Integrity: Ensuring that a relationship's target vertex exists.
  • Data Type & Range Validation: Enforcing that a age property is a positive integer. These are often enforced using target schema features like uniqueness constraints and property data types.
06

Tooling & Automation

Enterprise schema mapping is supported by specialized tools that provide:

  • Visual Mapping Interfaces: Drag-and-drop canvases to link source and target elements.
  • Mapping Document Generation: Auto-creating human- and machine-readable mapping specifications (e.g., in R2RML, RML, or custom JSON/YAML).
  • Impact Analysis: Simulating the effects of a mapping change on existing data.
  • Integration with ETL/ELT Pipelines: Generating executable code for data integration platforms like Apache NiFi, Spark, or specialized graph ETL tools.
DATA MODELING TECHNIQUES

Schema Mapping vs. Related Concepts

A comparison of schema mapping with adjacent data modeling and integration concepts, highlighting their distinct purposes and mechanisms.

Feature / AspectSchema MappingSchema-on-ReadSchema-on-WriteSchema Evolution

Primary Purpose

Defining correspondences between source and target schemas for data integration.

Applying a schema flexibly at query time to interpret raw data.

Enforcing a rigid schema at data ingestion to ensure integrity.

Modifying an existing schema over time to meet new requirements.

Schema Flexibility

High (transforms between defined structures).

Very High (schema is interpretive).

Low (schema is prescriptive).

Medium (requires managing compatibility).

Data Integrity Phase

During the transformation/integration pipeline.

At query execution (integrity is contextual).

At data write/ingestion (integrity is enforced).

During and after schema modification (requires data migration or validation).

Typical Use Case

Migrating relational data to a property graph; building a unified knowledge graph from silos.

Exploring semi-structured log files or JSON documents in a data lake.

Storing transactional records in a relational or ACID graph database.

Adding a new 'middleName' property to an existing 'Person' vertex type.

Governance & Auditability

High (mapping rules are explicit and traceable).

Low (schema interpretation can be ad-hoc).

High (schema is a strict contract).

Medium (requires versioning and change logs).

Performance Impact

One-time transformation cost; optimized target queries.

Query-time interpretation overhead; potential for slow, exploratory queries.

Write-time validation overhead; optimized for fast, predictable reads.

Varies: can require expensive data backfilling or re-indexing.

Key Mechanism

Transformation rules or declarative mappings (e.g., XSLT, custom scripts).

Schema inference or projection (e.g., in Apache Spark, some graph DBs).

Schema constraints and validation (e.g., uniqueness, data types).

Schema alteration DDL (Data Definition Language) statements.

Relation to Graph Schema

Creates the target graph schema (Vertex/Edge Schemas) from source models.

Often used with a graph that has no fixed schema or a very permissive one.

Requires a pre-defined, fixed Graph Schema Language definition.

Operates on an existing Graph Schema Language definition to change it.

SCHEMA MAPPING

Common Schema Mapping Examples

Schema mapping defines the transformation rules between a source data structure and a target graph model. These examples illustrate common patterns for integrating relational, document, and event data into a knowledge graph.

02

JSON Documents to Nested Subgraphs

Semi-structured JSON or document data is mapped by flattening nested objects and arrays into distinct, connected nodes.

  • Root Object becomes a Root Node: The top-level JSON object (e.g., an invoice) becomes a node with a label like Invoice.
  • Nested Objects become Related Nodes: A nested customer object becomes a separate Customer node connected via a HAS_CUSTOMER relationship.
  • Arrays become Lists or Separate Nodes: An array of line items can be modeled as a list property or, more powerfully, as individual LineItem nodes connected via INCLUDES relationships, enabling granular querying.
  • Dynamic Properties are Preserved: The flexible nature of JSON is captured using dynamic property keys on the mapped nodes.
03

Event Streams to Temporal Graphs

Sequential event data from logs or message queues is mapped to capture process flows and state changes over time.

  • Events become Nodes or Relationships: Each event (e.g., UserLoggedIn, PaymentProcessed) can be a node with an Event label, connected to entity nodes via PERFORMED_BY or AFFECTS relationships. Alternatively, the event type can be the relationship itself (e.g., LOGGED_IN).
  • Timestamps are Critical Properties: Event nodes/relationships always include precise timestamp properties.
  • Sequences form Paths: A series of events creates a time-ordered path through the graph, enabling queries like "show the user's session flow."
  • State Snapshots: Periodic state events can create State nodes connected to entities, allowing point-in-time queries.
04

CSV/Flat Files to Entity Graphs

Tabular data from spreadsheets or CSV exports is mapped by interpreting columns as entity attributes and using shared values to infer relationships.

  • Rows become Nodes: Each row typically becomes a node instance.
  • Header Values inform Labels & Properties: Column headers map to property keys. A column like department_name may also imply a node label of Department.
  • Denormalized Values create Links: Repeated values across rows (e.g., a manager_email column present on many employee rows) are used to create REPORTS_TO relationships between Employee nodes by joining on the shared email value.
  • Composite Keys: Unique identifiers are often constructed from a combination of column values when a single primary key is absent.
05

RDF to Property Graph (Bidirectional)

Mapping between the RDF (triple-based) and Property Graph models involves translating semantic web constructs into labeled property structures.

  • RDF Class (rdf:type) becomes a Node Label: A triple ex:Product1 rdf:type ex:Product maps Product1 to a node with label Product.
  • RDF Property becomes a Relationship Type or Node Property: A predicate like ex:manufacturedBy can map to a MANUFACTURED_BY relationship. A datatype property like ex:productName becomes a node property.
  • RDF Literal becomes a Property Value: The object of a datatype property triple provides the value.
  • Blank Nodes are Inlined or Expanded: Complex blank node structures can be mapped to nested properties or expanded into intermediary subgraph nodes.
  • OWL/RDFS Semantics may be Lost: Advanced semantics like owl:inverseOf or rdfs:subClassOf must be explicitly recreated as constraints or inference rules in the property graph.
06

Legacy System Integration via Canonical Model

Multiple disparate source schemas are mapped to a unified, enterprise-defined canonical graph model, decoupling systems from the core knowledge graph.

  • Define a Central Target Schema: First, design an authoritative ontology or property graph schema representing the business domain (the canonical model).
  • Create Source-Specific Mapping Rules: Each legacy system (CRM, ERP, SCM) has a dedicated mapping defining how its unique fields transform into the canonical types and properties.
  • Use Intermediate Nodes for Alignment: Conflicting identifiers for the same entity (e.g., customer IDs) are resolved by mapping both to a single canonical Customer node, often via HAS_SOURCE_ID relationships.
  • Enables Incremental Modernization: New systems can be integrated by mapping to the stable canonical model without altering existing mappings, reducing integration cost and complexity over time.
SCHEMA MAPPING

Frequently Asked Questions

Schema mapping defines the rules and correspondences for transforming data from a source format into a target graph structure. This process is foundational for data integration, migration, and building unified knowledge graphs from disparate systems.

Schema mapping is the process of defining correspondences, transformation rules, and alignments between the elements of a source data schema and a target graph schema. It is a critical step in data integration and ETL (Extract, Transform, Load) pipelines, guiding how structured or semi-structured data from relational databases, JSON documents, or CSV files is transformed into nodes, edges, and properties within a property graph or RDF triplestore. The mapping specifies what source fields become vertex labels, which become relationship types, and how values are converted to ensure semantic consistency in the target knowledge graph.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.