Copyright © 2025 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply.
The goal of this specification is to provide guidance and good practices to achieve interoperability across different versions or profiles of RDF.
This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C standards and drafts index.
This document was published by the RDF & SPARQL Working Group as a Group Draft Note using the Note track.
Group Draft Notes are not endorsed by W3C nor its Members.
This is a draft document and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to cite this document as other than a work in progress.
The W3C Patent Policy does not carry any licensing requirements or commitments on this document.
This document is governed by the 18 August 2025 W3C Process Document.
TODO write a nice intro
This document uses the following terminology for describing RDF graph syntax, all as defined in the companion RDF Concepts specification [RDF12-CONCEPTS]: appear, asserted triple, basic, blank node, default graph, equivalent, full, named graph, object, predicate, RDF dataset, RDF graph, reifier, subject, triple, triple term.
Should we make this section normative?
This section provides transformations between Full RDF graphs (respectively, RDF datasets) and Basic RDF graphs (respectively, RDF datasets), to provide some level of interoperability between the different classes of Conformance.
Should we go even further and aim to provide interoperability between RDF 1.1 and RDF 1.2 Full?
AT RISK: The Working Group may decide to replace the terms rdf:TripleTerm, rdf:ttSubject, rdf:ttPredicate, and rdf:ttObject used in this section with other terms, possibly in a different namespace.
These transformation are designed to be:
Encoding an RDF graph to ensure that it is consumable by an RDF Basic implementation is called basic encoding it. Basic encoding consists of repeating the following steps until no triple term appears in the graph, and the graph is therefore compliant with RDF Basic: picking a triple term tt that appears in the graph; minting a fresh blank node b (i.e., a blank node not yet in use in the graph); replacing all occurrences of tt appearing in the graph with b; and then adding the following triples to the graph (where s, p, and o are respectively the subject, predicate and object of tt):
rdf:type, rdf:TripleTerm)
rdf:ttSubject, s)
rdf:ttPredicate, p)
rdf:ttObject, o)
Note that this transformation is information preserving only when the input graph either has no triple term appearing in it,
or contains no asserted triple (b, rdf:type, rdf:TripleTerm) where b is a blank node.
Implementations encountering this situation ought to report an error.
This limitation is discussed in Section 3.3 Limitations.
The blank nodes generated to replace triple terms should not be confused with the reifiers that are typically associated with these triple terms.
Basic encoding an RDF dataset consists of basic encoding its default graph and each of its named graph. In this case, the fresh blank node assigned to each triple term must not be used in any graph of the dataset.
A detailed algorithm of the transformation is found in Section 3.4.1 The basic-encode algorithm.
The examples in this section are expressed in the Turtle concrete syntax [RDF12-TURTLE].
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.org/> << ex:s ex:p ex:o >> ex:q "some value".
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.org/> _:r1 rdf:reifies <<( ex:s ex:p ex:o )>>. _:r1 ex:q "some value".
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.org/> _:r1 rdf:reifies _:gen1. _:r1 ex:q "some value". _:gen1 a rdf:TripleTerm ; rdf:ttSubject ex:s; rdf:ttPredicate ex:p; rdf:ttObject ex:o.
Reverting a basic encoded graph to its original form consists of locating
each asserted triple (b, rdf:type, rdf:TripleTerm)
that has a blank node b as its subject,
along with the three associated asserted triples
that have the same blank node b as their subjects, i.e.,
(b, rdf:ttSubject, s),
(b, rdf:ttPredicate, p),
and (b, rdf:ttObject, o);
removing these four triples from the graph;
and replacing all remaining occurrences of b appearing in the graph
with the triple term (s, p, o).
An implementation ought to report an error if, for a given b,
it can not unambiguously determine s, p, or o
(i.e., if one of the properties of b
— rdf:ttSubject, rdf:ttPredicate, or rdf:ttObject —
is missing or duplicated).
An implementation also ought to report an error if the input graph contains
at the same time a triple term and an asserted triple
(b, rdf:type, rdf:TripleTerm)
where b is the same blank node.
Note that none of these situations can occur if the input graph was produced by the basic encoding transformation.
To revert a basic encoded RDF dataset to its original form, the transformation above is applied to its default graph and to each of its named graphs.
Note that this transformation has no effect on any RDF graph or RDF dataset that does not use the rdf:TripleTerm type,
including Full graphs or datasets containing triple terms.
This makes this transformation idempotent as intended.
The two transformations above explicitly do not support graphs or datasets containing at the same time a triple term and an asserted triple
(b, rdf:type, rdf:TripleTerm)
where b is a blank node.
This means that the basic encoding transformation is not strictly universal.
This limitation should not be an issue in practice.
The rdf:TripleTerm type is unlikely to be in used in any published graph or dataset,
as it was not defined prior to this specification.
For this reason, using it would actually have been bad practice.
For future graphs and datasets, this type should be considered to be reserved for use within the basic encoding transformation, and not used otherwise.
This is one reason why this transformation introduces new vocabulary terms
(rdf:TripleTerm, rdf:ttSubject, rdf:ttPredicate, rdf::ttObject),
rather than repurposing the existing reification vocabulary
(rdf:Statement, rdf:subject, rdf:predicate, rdf:object).
Unlike rdf:TripleTerm, rdf:Statement is known to be found in
widely used datasets (e.g., Uniprot),
so reserving its use for the basic encoding transformation was not an option.
Another consequence of this restriction is that implementers will need to be aware and careful when merging graphs in an application that basic encoded graphs or datasets.
The concern is that merging a Full RDF graph containing at least one triple term
with a basic encoded RDF graph (which might contain blank node instances of rdf:TripleTerm)
could result in a "hybrid" graph that cannot be transformed to a consistent Full nor Basic RDF graph.
Therefore, such applications should basic encode every graph prior to merging them.
Conversely, applications supporting RDF Full should make sure to apply the reverse transformation
to any graph that is known or likely to have been basic encoded,
to avoid creating such "hybrid" graphs.
Since these transformations are designed to be idempotent, there is no harm in applying them more than necessary.
The algorithm expects one input variable Gᵢ which is an RDF graph. It returns a Basic RDF graph.
null.rdf:type and o is rdf:TripleTerm, then:"full" then exit with an error."basic"."basic" then exit with an error."full".basic-encode-triple-term passing o as t and M as Mi.This algorithm is responsible for incrementally populating the mapping M and the graph G used internally by the basic-encode algorithm. It receives a triple term as input and processes it recursively (in case its object is itself a triple term). It returns, among other things, the blank node minted to replace the triple term in the transformed Basic RDF graph.
This algorithm expects two input variables: a triple term t, and a map Mᵢ from triple terms to blank nodes. It returns a blank node b, a map Mₒ from triple terms to blank nodes, and a Basic RDF graph G.
basic-encode-triple-term passing o as t and Mᵢ.rdf:type, rdf:TripleTerm), (b, rdf:ttSubject, s), (b, rdf:ttPredicate, p), and (b, rdf:ttObject, o) in G.Write this algorithm
In addition to the editors, the following people have contributed to this specification: Ted Thibodeau Jr
Members of the RDF & SPARQL Working Group Group included Vladimir Alexiev, James Anderson, Amin Anjomshoaa, Julián Arenas-Guerrero, Dörthe Arndt, Bilal Ben Mahria, Erich Bremer, Dan Brickley, Kurt Cagle, Sarven Capadisli, Rémi Ceres, Pierre-Antoine Champin, David Chaves-Fraga, Souripriya Das, Daniil Dobriy, Enrico Franconi, Jeffrey Phillips Freeman, Fabien Gandon, Benjamin Goering, Damien Graux, Adrian Gschwend, Olaf Hartig, Timothée Haudebourg, Ian Horrocks, Gregg Kellogg, Mark Kim, Jose Emilio Labra Gayo, Ora Lassila, Richard Lea, Niklas Lindström, Pasquale Lisena, Thomas Lörtsch, Matthew Nguyen, Peter Patel-Schneider, Thomas Pellissier Tanon, Dave Raggett, Jean-Yves ROSSI, Felix Sasaki, Andy Seaborne, Alan Snyder, Stuart Sutton, Ruben Taelman, Ted Thibodeau Jr, Dominik Tomaszuk, Raphaël Troncy, William Van Woensel, Gregory Williams, Jesse Wright, Achille Zappa, and Antoine Zimmermann.