Inferensys

Glossary

RDF Mapping (RML)

RDF Mapping Language (RML) is a declarative language for defining custom mapping rules that transform heterogeneous data (CSV, JSON, XML, etc.) into RDF triples for knowledge graph population.
Moody home-office setup in a converted highrise loft, analyst working late with multiple screens showing knowledge graph visualizations, city lights through large windows behind.
SEMANTIC INTEGRATION PIPELINES

What is RDF Mapping (RML)?

RDF Mapping Language (RML) is the declarative standard for transforming heterogeneous raw data into a structured knowledge graph.

RDF Mapping Language (RML) is a declarative, rule-based language for defining custom mappings that transform heterogeneous data from sources like CSV, JSON, XML, and relational databases into RDF triples for knowledge graph population. It extends the W3C's R2RML standard to handle non-relational data, enabling engineers to specify how source fields map to ontology classes, properties, and IRIs in a deterministic, reusable mapping document.

RML operates as the core transformation engine in a semantic ETL pipeline, separating mapping logic from application code for maintainability. Mappers use RML rules to define logical sources, subject maps, and predicate-object maps, which a processor engine executes to generate an RDF knowledge graph. This process is foundational for data integration, creating a unified, queryable semantic layer from disparate enterprise systems.

RDF MAPPING LANGUAGE

Key Features of RML

RML is a declarative, rule-based language that defines how to generate RDF triples from heterogeneous, non-RDF data sources. It is a superset of the W3C-standard R2RML, extending it to handle diverse formats like JSON, XML, and CSV.

01

Declarative Mapping Rules

RML uses a declarative approach, where developers specify what the target RDF structure should be, not how to procedurally create it. Rules are defined in a separate mapping document (often Turtle or JSON-LD) that acts as a blueprint, decoupling the transformation logic from the source data. This makes mappings:

  • Portable and reusable across different data instances.
  • Maintainable, as changes are made in one central document.
  • Predictable, enabling validation and reasoning over the mapping logic itself.
02

Source-Agnostic Data Access

A core extension beyond R2RML is RML's ability to map data from non-relational sources. While R2RML only works with SQL databases, RML processors can connect to and iterate over:

  • Structured files: CSV, TSV.
  • Semi-structured files: JSON, XML.
  • APIs: Data retrieved via HTTP requests.

This is achieved through Logical Sources, which abstract the data access method. A single mapping can even join data across these heterogeneous sources (e.g., linking a CSV row to a JSON object from an API).

03

Term Maps & Function Ontology

RML defines how to generate each part of an RDF triple using Term Maps:

  • Subject Maps: Create the subject IRI or blank node for a resource.
  • Predicate Maps: Define the property (predicate) IRI.
  • Object Maps: Generate the object, which can be an IRI, blank node, or literal value.

To perform complex transformations during mapping, RML integrates with the FnO (Function Ontology). This allows the execution of built-in or custom functions within mapping rules, such as string concatenation, date formatting, or mathematical operations, to derive new values directly.

04

Referencing Objects & Joins

RML supports the creation of relationships between resources through Referencing Object Maps. This is crucial for building a connected graph, not just a flat list of entities. It allows the object of one triple to be the subject of another, defined in a separate mapping rule.

For relational or nested data, RML enables joins using the rr:joinCondition property. This allows a mapping rule to reference data from a different logical source or a nested element by specifying matching keys, effectively performing a graph-like link operation during the mapping process.

05

Standardized & Extensible

RML is a community-driven, open specification maintained by the RML Community. It is formally defined as an ontology (the RML ontology), making the mapping rules themselves machine-readable RDF data. This standardization ensures:

  • Interoperability between different RML processor implementations (e.g., SDM-RDFizer, CARML).
  • Extensibility, as the ontology-based model allows for custom extensions, such as the RML+ rules for more complex data transformations or the integration with domain-specific function libraries.
06

Integration in Semantic Pipelines

RML is a foundational component in Semantic ETL and Knowledge Graph Population pipelines. It typically operates in the Transform phase, sitting between data extraction and loading into a triplestore. An RML mapping document is executed by an RML Processor, which reads the source data, applies the rules, and outputs valid RDF (e.g., N-Triples). This output can then be validated, reasoned over, and loaded. Its role is critical for automating the creation of high-quality, instance-level data (ABox) that conforms to a target ontology (TBox).

FEATURE COMPARISON

RML vs. Other Mapping Approaches

A technical comparison of RDF Mapping Language (RML) against other common data mapping and integration methodologies.

Feature / CapabilityRML (RDF Mapping Language)Direct R2RMLCustom Scripting (e.g., Python)Traditional ETL Tools

Declarative Mapping Language

Native RDF & Knowledge Graph Output

Support for Non-Relational Sources (JSON, XML, CSV)

Limited/Vendor-Specific

Standardized, Portable Mapping Rules

Vendor-Specific

Logical Source Definition & Iterators

Manual Implementation

Vendor-Specific

Referencing Object Maps (Joins)

Manual Implementation

Function Extension Framework (FnO)

Native Language Libraries

Vendor-Specific

Integration with SPARQL & Reasoning Engines

Native

Native

Manual Integration

Limited/Connector-Based

Incremental Graph Update Support

Via SPARQL-Update

Via SPARQL-Update

Manual Implementation

Vendor-Specific

Primary Use Case

Semantic ETL to RDF KGs

Relational DB to RDF

Ad-hoc, Complex Transformations

General Data Warehousing

RDF MAPPING LANGUAGE

Common RML Use Cases

RML is a declarative language for defining custom mapping rules that transform heterogeneous data into RDF triples. These are its primary applications in enterprise knowledge graph construction.

01

Legacy System Integration

RML is used to map data from legacy relational databases and mainframe systems into a modern knowledge graph without altering the source systems. This involves:

  • Defining triples maps that map database tables and columns to RDF classes and properties.
  • Using RML views or SQL queries as logical sources to perform joins and transformations at the mapping level.
  • Generating globally unique IRIs for each entity, enabling linkage with other datasets. This creates a semantic abstraction layer over CRUD-based systems, making their data queryable via SPARQL and integrable with modern applications.
02

Unstructured & Semi-Structured Data Lifting

RML processors can parse JSON, XML, CSV, and Parquet files to extract structured facts. This is critical for integrating application logs, API responses, and data exports.

  • JSON & XML: Use JSONPath and XPath within RML's referenceFormulation to navigate nested structures and arrays.
  • CSV/TSV: Map column headers directly to RDF predicates, often using the file's header row to generate term maps dynamically.
  • The mapping defines how to construct subject IRIs from composite keys (e.g., {customer_id}-{order_date}) and how to handle repeated elements as multiple triples. This transforms document-oriented data into interconnected graph nodes, ready for semantic querying.
03

Data Warehouse to Knowledge Graph

Organizations use RML to convert dimensional models (star/snowflake schemas) in a data warehouse into a rich, semantically typed knowledge graph.

  • Fact and dimension tables are mapped to interconnected RDF resources, preserving business context often lost in flat tables.
  • Slowly Changing Dimensions (SCD) can be mapped to temporal RDF using reification or standard temporal vocabularies.
  • Complex ETL transformation logic (business rules, calculated fields) is encoded within the RML mapping rules using functions (FnO). This exposes aggregated, business-ready data as a graph, enabling complex graph analytics and path-based queries not possible in SQL.
04

Streaming Data Integration

RML mappings can be applied to real-time data streams (e.g., Kafka, Kinesis) for continuous knowledge graph population.

  • A stream processor (e.g., Kafka Connect with an RML SMT) applies the mapping to each message, outputting RDF triples.
  • This supports event-driven architectures where business events (new customer, completed transaction) instantly update the graph.
  • Mappings must handle incremental updates and deletions, often using named graphs to version streamed data. This creates a live knowledge graph that reflects the current state of operational systems, powering real-time decision support.
05

Cross-Dataset Entity Resolution

RML is used in data harmonization pipelines to prepare datasets for entity linking. While RML itself does not perform matching, it standardizes data for downstream resolution tools.

  • Different source schemas for 'Customer' are mapped to a unified target ontology (e.g., schema:Person, org:Organization).
  • Data values are normalized (e.g., phone number formatting, address cleansing) using RML functions during the mapping process.
  • The output is a consistent RDF graph where entities from different sources share the same class and property types, enabling efficient similarity computation and link discovery with tools like Silk or LIMES.
06

Metadata Catalog Generation

RML generates rich, queryable metadata (a knowledge graph about data) by mapping technical metadata from databases, APIs, and files.

  • Source system schemas, column descriptions, data types, and lineage information are mapped to vocabularies like DCAT, VoID, or PROV-O.
  • This creates a semantic data catalog where users can SPARQL-query for data assets based on meaning, not just names.
  • The mappings themselves can be described in RDF using the RML ontology, making the integration pipeline self-documenting and part of the enterprise knowledge graph.
RDF MAPPING LANGUAGE

Frequently Asked Questions

RDF Mapping Language (RML) is a core technology for building enterprise knowledge graphs. These questions address its core mechanics, practical applications, and how it fits within modern semantic data pipelines.

The RDF Mapping Language (RML) is a declarative, rule-based language for defining how data from heterogeneous, non-RDF sources (like CSV, JSON, XML, and relational databases) is transformed into RDF triples to populate a knowledge graph. It works by using a mapping document (often serialized as RDF itself using the RML ontology) that specifies logical sources, subject maps, predicate-object maps, and term generation functions. An RML processor (e.g., the RMLMapper, SDM-RDFizer) executes these rules, extracting data from sources, applying transformations, and generating RDF triples conforming to a target ontology. It extends the W3C's R2RML standard to handle non-relational data formats.

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.