# Condensed Representation of RDF and its Application on Graph Versioning

Jey Puget Gil, Emmanuel Coquery, John Samuel, Gilles Gesquière

<figure><img src="image_1.png" /></figure>

## To cite this version:

Jey Puget Gil, Emmanuel Coquery, John Samuel, Gilles Gesquière. Condensed Representation of RDF and its Application on Graph Versioning. 2025. hal-05175454v2

HAL Id: hal-05175454

https://hal.science/hal-05175454v2

Preprint submitted on 8 Oct 2025

HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Condensed Representation of RDF and its Application on Graph Versioning

Jey Puget Gil

jey.puget-gil@liris.cnrs.fr

Université Claude Bernard Lyon 1, CNRS, INSA Lyon,
LIRIS, UMR 5205

Villeurbanne, FRANCE

John Samuel

john.samuel@cpe.fr

CPE Lyon, CNRS, INSA Lyon, Université Claude Bernard
Lyon 1, Université Lumière Lyon 2, Ecole Centrale de
Lyon, LIRIS, UMR 5205

Villeurbanne, FRANCE

Emmanuel Coquery

emmanuel.coquery@univ-lyon1.fr

Université Claude Bernard Lyon 1, CNRS, INSA Lyon,
LIRIS, UMR 5205

Villeurbanne, FRANCE

Gilles Gesquière

gilles.gesquiere@univ-lyon2.fr

Université Lumière Lyon 2, CNRS, Université Claude

Bernard Lyon 1, INSA Lyon, Ecole Centrale de Lyon, LIRIS,
UMR 5205

Villeurbanne, FRANCE

## ABSTRACT

Evolving phenomena, often complex, can be represented using knowledge graphs, which have the capability to model heterogeneous data from multiple sources. Nowadays, a considerable amount of sources delivering periodic updates to knowledge graphs in various domains is openly available. The evolution of data is of interest to knowledge graph management systems, and therefore it is crucial to organize these constantly evolving data to make them easily accessible and exploitable for analysis. In this article, we will present and formalize the condensed representation of these evolving graphs and propose a new solution called QuaQue that allows querying across multiple versions of graphs and we also present the results of our benchmark comparing our solution against existing approaches.

## Paper Artifact Availability:

The source code has been made available at https://github.com/VCityTeam/ConVer-G. The detailed results are available at https://zenodo.org/records/17198832.

# 1 INTRODUCTION AND MOTIVATIONS

## 1.1 Data evolution and versioning

Time is a fundamental aspect of data, and the need for temporal data management[11] has been recognized for a long time. Temporal snapshots of data help to understand the evolution of data over time and are essential for various applications, such as historical data analysis, trend analysis, and data quality assessment.

While our requirement emerged from urban data management, where temporal data management is highly significant. The challenge of managing evolving data is present in many domains, including but not limited to urban studies, biomedical research, and software engineering. In these fields, data is frequently updated, extended, or corrected, and it is crucial to track and analyze these changes effectively. For example, in biomedical research, tracking changes in ontologies or patient records over time is important; in software engineering, managing the evolution of code or documentation as RDF graphs is increasingly common. The growing availability of open and periodically released data enables researchers to

study complex phenomena with incremental changes[4, 8, 14, 17]. A comprehensive understanding of dynamic elements—such as population growth, infrastructure development, or evolving scientific knowledge—is crucial for effective management and analysis in these domains.

To address these challenges, we propose the use of versioning to refer to data at different points or periods of time. The versioning of scientific data enables the exploitation and reproducibility of experiments and analyses[12]. Versioning captures the state of the data at a given point or period in time, facilitating reproducibility, integrity, and the ability to restore previous versions in case of errors. It also supports experimentation with different analytical approaches by allowing easy switching between data versions.

Knowledge graphs, and in particular RDF graphs, are increasingly used to represent evolving data in a variety of domains[24]. By incorporating versioning into these knowledge graphs, it becomes possible to capture concurrent viewpoints and the evolution of entities over time[17]. This enables the representation of different states of the data, providing a comprehensive view of its evolution. Our approach leverages knowledge graphs from heterogeneous sources (concurrent viewpoints) at different periods of time (hereafter, referred to as versions).

## 1.2 Improving the comprehension of data evolution

In many domains, data is continuously evolving as new information becomes available, corrections are made, or entities change over time. This constant evolution creates challenges for data management systems that need to track and analyze these changes effectively. Additionally, the growing volume of data collected from multiple sources and at different temporal granularities adds complexity to the task of managing and understanding data evolution.

To achieve effective management of evolving data and ensure reproducibility of experiments and analyses, we identified the following requirements for our system:

* **R1: Managing and querying multiple graphs and their different versions:** Our system should allow users to query multiple knowledge graphs from one or more sources and
access their different versions simultaneously. This capability enables comprehensive analysis and comparison of data evolution over time.

* **R2: Linking versioned data with metadata:** It is crucial to establish a connection between versioned data and their associated metadata. This linking provides valuable context and additional information about the data, enhancing its usability and interpretability. For example, when tracking changes to a biomedical record or a software artifact, metadata could include the source, method, and date of observation, allowing users to better understand and validate the data's provenance and reliability.

* **R3: Isolating and querying individual graph versions:** Our system must provide a mechanism to isolate and query specific versions of a knowledge graph independently. This capability allows users to focus their analysis on particular versions without interference from other versions, enabling precise examination of the data at specific snapshots.

By addressing these requirements, our system aims to empower researchers and practitioners in diverse fields to gain deeper insights into data dynamics, facilitate informed decision-making, and ensure the reproducibility and reliability of scientific experiments and analyses. Although our focus in this article is on the formalization of versioned RDF graphs, the principles and mechanisms we present are generic and can be applied to any domain where RDF data evolves over time.

In this article, to address the above requirements, we present the formalization of flat and condensed representations and querying of evolving knowledge graphs. We also present our proposed solution that uses and compares both representations using benchmark data. The state of the art in entity versioning is detailed in Section 2. Section 3 presents the necessary preliminaries and notations. Section 4 presents the contributions of our work: datasets using flat and condensed models, algebra for handling query operators and the resulting data in flat and condensed representations. In Section 5, we briefly present our implementation—QuaQue (part of the ConVer-G system)[9]—and compare the results obtained for flat and condensed representations. Section 6 concludes the article with a discussion of the limitations and possible enhancements to our proposed work.

## 2 STATE OF THE ART - VERSIONING

Resources evolve over time and hence the statements associated to describe them. Version control systems [30], for example, handle this evolution of data (or code) by associating a tag and a timestamp to a snapshot of the data at a given instant of time. This supplementary information associated to a snapshot, referred to as a version can be used to not only represent the state of the data at any given point of time, but also to understand the evolution of data over a period of time. As mentioned by Bayoudhi et al. [2], versioning is a critical aspect of management in a project, allowing developers to track changes to the elements, manage different versions, and collaborate with other team members. For the sake of familiarity, we will use the word versioning to this process of adding information like timestamp, tag to snapshots of one or more resources and their associated statements at any given moment of time. In this

<table><caption>**Table 1: Comparison of code and data versioning**</caption><thead><tr><th>Characteristics</th><th>Code versioning</th><th>Data versioning</th></tr></thead><tbody><tr><td>Object</td><td>Files</td><td>Datasets (structured, unstructured, etc.)</td></tr><tr><td>Granularity</td><td>Lines of code, files</td><td>Data, entire datasets</td></tr><tr><td>Primary goals</td><td>History, collaboration, branching</td><td>Reproducibility, provenance, experimentation,</td></tr><tr><td>Tools</td><td>Git, Mercurial, SVN</td><td>DVC, Pachyderm, Machine Learning platforms</td></tr></tbody></table>

section, we will take a look at different approaches of versioning. Table 1 summarizes these results.

### 2.1 Code versioning

Version control systems [30] such as Git, Mercurial, Subversion, CVS, and Bazaar are commonly used for managing the evolution of source code. However, these solutions are not specifically designed for data versioning, especially for structured data [18] and have certain limitations for efficient querying [3, 16, 29]. Apart from some exceptions, like Git LFS, they don't provide adequate support for large files and versioned data queries. Therefore, they may not be the ideal choice for managing data versioning in a project.

### 2.2 Dataset versioning

#### 2.2.1 Independent copies (IC). 
This approach allows querying data as it existed in a specific version. Example: Which buildings were present in the city at a particular version?

A common approach to dataset versioning is to maintain independent copies (snapshots) of the data for each version. Tools such as Qri [22], Quit Store [1], GeoGig [21], and UrbanCo2Fab [16] follow this strategy, often leveraging Git-based mechanisms. While this method simplifies version management and enables straightforward retrieval of any version by checking out its corresponding snapshot, it has notable limitations. In particular, querying across multiple versions simultaneously is inefficient, as each query requires materializing the full state of the relevant versions. This restricts the ability to perform cross-version analysis or answer queries that span several versions. Similarly, machine learning data management tools such as DVC, DagsHub, and Weights and Biases provide robust tracking and collaboration features for structured data, but do not support efficient querying across multiple snapshots, making them unsuitable for use cases requiring multi-version queries.

#### 2.2.2 Timestamp-based versioning (TB). 
This representation allows querying data as it existed at a specific point in time. Example: Which buildings were present in the city at a particular version?

A common approach to data versioning is to associate each record with a timestamp or a validity interval, as seen in temporal or bitemporal tables [13]. This method enables querying data as it existed at a specific point in time or within a given interval. While effective for linear histories, timestamp-based versioning is limited when handling concurrent changes, such as branches or
forks, which are typical in collaborative environments and version control systems. As a result, it may not fully support scenarios requiring representation of multiple, diverging timelines.

### 2.2.3 Change-based versioning (CB).
This representation enables retrieval of the differences between two versions. Example: Which buildings were added or removed between two versions?

Change-based versioning systems like Delta Lake and Apache Hudi store changes made to data as changes, allowing for efficient querying at different versions. A prominent system for versioning RDF (Resource Description Framework) data is OSTRICH [20] (Offset-enabled TRIple store for CHangesets). It employs a change-based storage model that combines an initial, full snapshot of the data at version 0 with a sequence of aggregated changesets. In this model, each subsequent version *i* is stored as the total changes relative to the initial snapshot (*u*₀,ᵢ), rather than the change from the preceding version (*u*ᵢ₋₁,ᵢ). This architecture is adapted for Version Materialization (VM) queries, as any version can be reconstructed by applying just one change to the initial snapshot.

However, we did not use OSTRICH for several reasons that align with its documented limitations. First, OSTRICH's native architecture is based on a single change chain representing a temporally ordered sequence of revisions, which means it only supports a linear version history and does not handle branching or forking. Our use case requires support for concurrent versions to represent different viewpoints of urban evolution. Second, the aggregated changesets in OSTRICH grow monotonically with every new version, leading to prohibitive ingestion times for archives with very long histories, even when the changes between versions are small.

### 2.2.4 Fragment-based versioning (FB).
This approach enables random access to different versions by managing indexes of file fragments for each version. This archiving policy stores snapshots of each changed fragment of an archive. These fragments can be defined at any level of granularity, such as individual graphs within a dataset. An index is maintained to reference which specific fragments belong to any given version of the dataset. This approach avoids the need to store full, independent copies for each version, and in contrast to change-based systems, it does not require the reconstruction of versions by applying a series of change operations. The Quit Store implements this policy by treating modified files within its Git repository as the fragments to be versioned.

## 2.3 Querying versioned data

This subsection reviews how different systems implement versioning, the types of queries they support, and the consequences for managing knowledge graphs. The following analysis compares existing solutions and highlights the need for advanced versioning models that address complex, multi-version scenarios. We adopt the query types defined by Ruben Taelman in the OSTRICH system [20], which offer a comprehensive framework for querying versioned data.

### 2.3.1 Version materialization (VM).
We consider version materialization as a means to create and manage distinct versions of knowledge graphs. This approach allows for the reconstruction of any specific version. This is particularly linked with the concept of (IC).

### 2.3.2 Delta materialization (DM).
Delta materialization is a technique used in databases and data management systems to track and retrieve changes in query results between two versions of data.

Instead of recomputing the entire result of a query for both versions, DM focuses on computing the delta—the set of changes (additions and deletions) in the query result that occurred between two versions. This is especially useful when data changes incrementally and you want to know only what has changed, not the full result.

### 2.3.3 Version query (VQ).
A version query annotates each result of query *Q* with the specific versions of the RDF archive *A* in which that result appears. This allows users to see not only the query results, but also the history of when each result was valid across different versions of the data.

### 2.3.4 Cross-version query (CV).
A cross-version query typically refers to a database or information retrieval operation that compares or joins the results of two queries executed on different versions of a dataset. This allows you to analyze changes, differences, or relationships between data across versions.

### 2.3.5 Change materialization (CM).
Change Materialization returns a list of versions in which a given query produces consecutively different results. In other words, CM identifies the specific versions where the output of changes compared to the previous version, highlighting points of modification or evolution in the data across versions. This is useful for tracking when and how the results of a query are affected by changes in the underlying knowledge graph.

OSTRICH supports all query types, but its native capabilities are limited to single triple pattern queries. To execute full SPARQL queries, an additional query engine such as GLENDA [15] is required. Furthermore, OSTRICH relies on a linear sequence of integer revision numbers for versioning, whereas our use case demands a more flexible model capable of representing arbitrary relationships between versions, such as those found in a version graph.

This work builds on concepts from version control systems [1, 19, 20, 22, 30] and extends them to knowledge graphs. We introduce a "condensed representation" for querying with SPARQL, where the graph is modeled as a set of quads annotated with the versions in which they are valid. Our main contributions include the formalization of this condensed representation for evolving knowledge graphs and the development of an algebra for query operators and the resulting data in both flat and condensed forms.

Table 9 in Appendix summarizes the capabilities of different versioning tools with respect to the types of queries they support.

# 3 PRELIMINARIES AND NOTATIONS

In this section, we will present the key concepts and notations related to representing knowledge graphs in the form of RDF and querying them using the SPARQL query language.

## 3.1 RDF context representation

For the sake of simplicity, we considered the following RDF context representation based on the W3C definitions [25]:

3.1.1 *Literal*. A literal denotes resources of the real world.
* l, l₁, l₂... a literal

* L, L₁, L₂... a finite set of literals

* L the infinite set of all literals

### 3.1.2 IRI
Internationalized Resource Identifier (IRI) is a Unicode string, analogous to Uniform Resource Identifiers (URI), and used to identify resources (e.g., http://example.org/resource/Paris is an IRI identifying the resource "Paris").

* i, i₁, i₂... an IRI

* I, I₁, I₂... a finite set of IRI

* I the infinite set of all IRIs

### 3.1.3 Blank Node
Not all resources and the relationships can be explicitly named and are represented as blank nodes indicating the existence of something. To handle blank nodes, we use Skolemization [10], a technique that replaces blank nodes with generated IRIs. This allows us to treat blank nodes as regular resources with globally unique identifiers, enabling better integration and querying of RDF data.

### 3.1.4 Terms
Terms are used to refer to IRIs or literals.

* t, t₁, t₂... a term

* T, T₁, T₂... a finite set of terms

* T the infinite set of all terms

* T = {L, I} where:

- L ⊊ T

- I ⊊ T

- L ∩ I = ∅

### 3.1.5 Triples
An RDF triple is a statement about a resource that consists of three parts: a subject, an object, and a predicate. The subject is an IRI that represents the resource being described. The object can be an IRI or a literal that represents the value of the property. The predicate is an IRI that represents the relationship between the subject and the object.

<figure><img src="image_3.png" /><figcaption>Figure 1: Example of a RDF triple</figcaption></figure>

* tr = (t_s, t_p, t_o) an RDF triple where:

- t_s ∈ I is a subject

- t_p ∈ I is a predicate

- t_o ∈ T is an object

* TR, TR₁, TR₂... a finite set of triples

* TR the infinite set of all triples

### 3.1.6 Graphs
An RDF graph is a set of RDF triples. It represents a collection of resources and the relationships between them. An RDF graph can be named or unnamed by a resource. An unnamed graph is called the default graph.

### 3.1.7 Quads
A quad is a statement that consists of four parts: all triple elements (the subject, the predicate, the object), and the graph name. The graph name is an IRI that represents the context in which the triple is defined.

* q = (t_s, t_p, t_o, t_g) an RDF quad

<figure><img src="image_4.png" /><figcaption>Figure 2: Example of a named graph</figcaption></figure>

* Q, Q₁, Q₂... a finite set of quads

* Q the infinite set of all quads

* t_g ∈ T_g where T_g ⊆ I, t_g is the graph name and T_g is the set of all graph names

### 3.1.8 Datasets
A dataset *d* is a collection of graphs. A dataset can contain zero or more named graphs, each of which contains a set of RDF triples. A dataset can also contain a default graph, which is a set of triples that are not associated with any specific graph name.

### 3.1.9 Versioning
A version is a snapshot of the RDF data at a given point in time. We define the following versioning representation:

* v, v₁, v₂... a version

* V, V₁, V₂... a finite set of versions

* V the infinite set of all versions

Because the RDF data model is atemporal as explained in the "RDF and Change over Time" paragraph of the W3C RDF 1.1 Concepts and Abstract Syntax [25], we consider the versioning of RDF data as a set of versions.

## 3.2 SPARQL queries

SPARQL [26] is a declarative programming language used to query data stores containing a set of triples or quads.

### 3.2.1 Variables
A SPARQL variable is a placeholder for a value that is not known beforehand. It allows querying for information without having to specify the exact values the user is looking for. Variables are denoted by a question mark "?" or a dollar sign "$", immediately followed by a string without any white space characters.

* var, var₁, var₂... a SPARQL variable

* VAR, VAR₁, VAR₂... a finite set of SPARQL variables

* VAR the infinite set of all SPARQL variables

### 3.2.2 Query
A SPARQL query is a formal language expression used to retrieve and manipulate data stored in RDF format, according to the W3C definition [26].

* qu, qu₁, qu₂... a SPARQL query

* QU, QU₁, QU₂... a finite set of SPARQL queries

* QU the infinite set of all SPARQL queries

**SPARQL expression.** A SPARQL expression refers to a part of a SPARQL query that computes or filters values within the query. We note:

* e, e₁, e₂... a SPARQL expression

* E, E₁, E₂... a finite set of SPARQL expressions

* E the infinite set of all SPARQL expressions

SPARQL expression can be:
* A term *t* (e.g., 10) is an expression if $t \in \mathcal{T}$

* A variable *var* (e.g., ?x) is an expression if $var \in VAR$

* A function $f(e_1, ..., e_n)$ is an expression, if *f* is a function and $\forall i \in \{1, ..., n\}, e_i$ is a SPARQL expression (e.g., AVG(*e*) where *e* is a SPARQL expression)

* $e_1 \neq e_2$ is an expression if $e_1$ and $e_2$ are expressions

SPARQL expressions are used to:

* Combine values from different RDF triples to form more complex patterns (e.g., triple patterns, basic graph patterns, or subqueries)

* Filter results based on conditions (e.g., using the FILTER keyword)

* Transform data using functions like mathematical operations, string manipulation, or logical operators (e.g., CONCAT, STRLEN...)

**Solution mapping.** A solution mapping is a mapping between variables and RDF terms. It is used to represent the results of a SPARQL query. We note $m: \mathcal{VAR} \to \mathcal{T}$ a solution mapping that maps a set of variables to a set of RDF terms and $\mathcal{M}$ an infinite set of solution mappings.

**Solution sequence.** A solution sequence is a sequence of solution mappings. We denote a solution sequence as $seq = [m_1, ..., m_n]$ where each $m_i$ is a solution mapping.

# 4 CONTRIBUTIONS

In this section, we present our contributions (Figure 3). Firstly, we present the key extensions to the RDF model discussed in Section 3 and the resulting dataset models. We discuss in detail the flat and condensed models of representation with examples. We then show how these datasets can be queried with the existing operators of the SPARQL query. Finally, we present the necessary formalisms and theorems to show how such queries can be evaluated.

## 4.1 RDF versioning definitions

4.1.1 Versioned IRI. In order to represent the versioning of IRI, we introduce the concept of a versioned IRI. A versioned IRI is an IRI that is associated with a version. We define the following versioned IRI representation:

* Let $VI: \mathcal{V} \times \mathcal{I} \to \mathcal{VI}$ be a bijective function.

* We note $vi, vi_1, vi_2...$ the elements of $\mathcal{VI}$, referred to as versioned IRI

* We note $VI, VI_1, VI_2...$ a finite set of versioned IRI

Let $v \in \mathcal{V}, t_g \in \mathcal{I}$ and $vi \in \mathcal{VI}$. We define the reverse functions of $VI$:

$$ 
\begin{aligned}
VI_v^{-1}(vi) &= v \Leftrightarrow \exists t_g VI(v, t_g) = vi \\
VI_{t_g}^{-1}(vi) &= t_g \Leftrightarrow \exists v VI(v, t_g) = vi
\end{aligned} 
\quad (1) 
$$

4.1.2 Versioned quad. A versioned quad $vq = (t_s, t_p, t_o, t_g, v)$ is a quintuplet where the quad $(t_s, t_p, t_o, t_g)$ is valid at the version *v*. We denote $VQ, VQ_1, VQ_2...$ a finite set of versioned quads and $\mathcal{VQ}$ an infinite set of versioned quads.

4.1.3 Versioned dataset. A versioned dataset is a dataset that contains a set of versioned graphs. A versioned graph is a graph that contains a set of RDF triples associated to a versioned named graph

built with a version and a graph. By convention, default graphs are assigned a special name, such as default, to distinguish them from named graphs.

4.1.4 Dataset representation. Consider a RDF context containing data and its associated metadata. We define the dataset function such that holds all the versioned quads stored in the database: $d = 2^{\mathcal{VQ}}$. We note $V(d)$ the set of versions in the dataset.

The figure 3 provides an overview of the different levels of representation and processing within our framework. It highlights the relationships between the dataset, query, algebra, evaluation, and results, as well as the possible transformations between flat and condensed forms at each stage. The main aspects illustrated in the figure are as follows:

* **Dataset level:** the figure illustrates that the dataset can be represented in either a flat or condensed form, and that it is possible to convert between these two representations using the condensation and flattening functions.

* **Query:** A SPARQL query is represented in a flat algebra, which is the original query written by the user. The compile function returns the flat algebra of the query.

* **Algebra level:** it shows the representation of the algebra in both flat and condensed forms, as well as the translation process from the flat algebra (derived from the original SPARQL query) to the condensed algebra using the translate function.

* **Evaluation level:** it illustrates the evaluation of the algebra. Taking the associated dataset and algebra, it shows the evaluation of the algebra in both flat and condensed forms. The evaluation process is represented by the eval relationship, which indicates that the evaluation can be performed on either representation.

* **Results level:** it depicts the representation of results in both flat and condensed forms, and the represent relationship that enables conversion between these representations, again using the condense and flatten functions.

<figure><img src="image_5.png" /><figcaption>Figure 3: Dataset, algebra and results representation</figcaption></figure>

## 4.2 Dataset models

Let us explore the different dataset models that we will use in our work. The following sections define a flat model and a condensed
model for dataset versioning. To illustrate these concepts, we begin with an example that will be referenced throughout the paper for demonstration purposes.

**Example 4.1.** Let's assume that we have a dataset representing concurrent points of view about the height of some buildings. In Table 2, we present two versions (v:1 and v:2) with quads. The column *Named graph* consists of two named graphs corresponding to the data coming from two sources named, Gr-Lyon and IGN.

<table><caption>**Table 2: Flat model of the versioned dataset**</caption><thead><tr><th>Subject</th><th>Predicate</th><th>Object</th><th>Named graph</th><th>Version</th></tr></thead><tbody><tr><td>ex:bldg#1</td><td>height</td><td>10.5</td><td rowspan="2">ng:Gr-Lyon</td><td rowspan="3">v:1</td></tr><tr><td>ex:bldg#2</td><td>height</td><td>9.1</td></tr><tr><td>ex:bldg#1</td><td>height</td><td>11</td><td>ng:IGN</td></tr><tr><td>ex:bldg#1</td><td>height</td><td>10.5</td><td>ng:IGN</td><td></td></tr><tr><td>ex:bldg#1</td><td>height</td><td>10.5</td><td>ng:Gr-Lyon</td><td>v:2</td></tr><tr><td>ex:bldg#3</td><td>height</td><td>15</td><td></td><td></td></tr></tbody></table>

Table 3 represents all the versioned IRI of the dataset. In this example, each IRI starting with vi: are images (results) of the pair (version, named graph) produced by the function VI (Versioned IRI).

<table><caption>**Table 3: Versioned IRI of the dataset**</caption><thead><tr><th>Version</th><th>Named graph</th><th>Versioned IRI</th></tr></thead><tbody><tr><td rowspan="2">v:1</td><td>ng:Gr-Lyon</td><td>vi:1</td></tr><tr><td>ng:IGN</td><td>vi:2</td></tr><tr><td rowspan="2">v:2</td><td>ng:Gr-Lyon</td><td>vi:3</td></tr><tr><td>ng:IGN</td><td>vi:4</td></tr></tbody></table>

**4.2.1 Flat model.** We define the flat model as a representation of a dataset as a set of quintuplets. In this model, each triple is augmented with two additional elements: the name of the graph corresponding to the data source, and the version information.

**Example 4.2.** Table 2 represents the flat model of the dataset. $d_F: \mathcal{I} \times \mathcal{I} \times \mathcal{T} \times \mathcal{I} \times \mathcal{V}$ designates the relation such as the quad $(t_s, t_p, t_o, t_g)$ is valid in the version $v$.

The supplementary information related to the named graphs and versions is stored separately in a metadata table. Table 4 shows this metadata for the flat model in Table 2. For example, in Table 3 the first row indicate that vi:1 is a versioned IRI of the named graph Gr-Lyon and belongs to version 1. It could also be used to store supplementary information such as provenance, authorship, or other metadata relevant to the versioned dataset.

**4.2.2 Condensed model.** $d_C: \mathbb{N} \times \mathbb{N} \times \mathbb{N} \times \mathbb{N} \to 2^V$ is a function that takes four identifiers that are bound to an RDF quad and returns a set of finite elements of $\mathcal{V}$ such that $2^V$ represents a set of finite versions where the quad is valid.

**Example 4.3.** The table 5 represents the condensed model of the versioned dataset (simplified by replacing the identifiers by their values). The first row, for example states that the triple present in

<table><caption>**Table 4: Metadata of the flat model**</caption><thead><tr><th>Subject</th><th>Predicate</th><th>Object</th><th>N. graph</th><th>Version</th></tr></thead><tbody><tr><td rowspan="2">vi:1</td><td>version-of</td><td>ng:Gr-Lyon</td><td rowspan="6">ng:Metadata</td><td rowspan="6">v:0</td></tr><tr><td>in-version</td><td>1</td></tr><tr><td rowspan="2">vi:2</td><td>version-of</td><td>ng:IGN</td></tr><tr><td>in-version</td><td>1</td></tr><tr><td rowspan="2">vi:3</td><td>version-of</td><td>ng:Gr-Lyon</td><td rowspan="2"></td></tr><tr><td>in-version</td><td>2</td></tr><tr><td rowspan="2">vi:4</td><td>version-of</td><td>ng:IGN</td><td rowspan="2"></td></tr><tr><td>in-version</td><td>2</td></tr></tbody></table>

<table><caption>**Table 5: Condensed model of the versioned dataset**</caption><thead><tr><th>Subject</th><th>Predicate</th><th>Object</th><th>N. Graph</th><th>Versions</th></tr></thead><tbody><tr><td>ex:bldg#1</td><td>height</td><td>10.5</td><td>ng:Gr-Lyon</td><td>{v:1, v:2}</td></tr><tr><td>ex:bldg#2</td><td>height</td><td>9.1</td><td>ng:Gr-Lyon</td><td>{v:1}</td></tr><tr><td>ex:bldg#1</td><td>height</td><td>11</td><td>ng:IGN</td><td>{v:1}</td></tr><tr><td>ex:bldg#3</td><td>height</td><td>15</td><td>ng:Gr-Lyon</td><td>{v:2}</td></tr><tr><td>ex:bldg#1</td><td>height</td><td>10.5</td><td>ng:IGN</td><td>{v:2}</td></tr></tbody></table>

the named graph Gr-Lyon is valid in versions v:1 and v:2. Each entry of this table can be replaced by the identifiers listed in Appendix 10.

Metadata plays a role in our approach, particularly for managing concurrent snapshots or concurrent viewpoints. By associating a constant version $v: \emptyset$ to all metadata, we ensure that version information and relationships between versions remain consistent and accessible across the entire dataset. This is especially important when dealing with branching version histories or multiple concurrent viewpoints, as the metadata helps track and organize these complex relationships. While this means metadata is not condensed and can only be represented in the flat model, this design choice provides a stable foundation for managing versioned data across different temporal and conceptual dimensions.

**4.2.3 Model relationships.**

**Definition 4.4 (Condensation).** Consider a flat dataset $d_F = \mathcal{I} \times \mathcal{I} \times \mathcal{T} \times \mathcal{I} \times \mathcal{V}$. We can condense the dataset $d_F$ into the dataset $d_C = \mathcal{I} \times \mathcal{I} \times \mathcal{T} \times \mathcal{I} \to 2^V$. The condensation function $C$ takes a quad and returns the set of versions in which that quad exists. This function is defined as:

$$C = (t_s, t_p, t_o, t_g) \mapsto \{v \mid (t_s, t_p, t_o, t_g, v) \in d_F\}$$

The domain of $C$ is the set of quads in the dataset $d_F$ where the quad occurs at a set of versions such that: $\mathcal{D}(C) = \{(t_s, t_p, t_o, t_g) \mid \exists v(t_s, t_p, t_o, t_g, v) \in d_F\}$.

**Definition 4.5 (Flattening).** Let $d_C = \mathcal{I} \times \mathcal{I} \times \mathcal{T} \times \mathcal{I} \to 2^V$ be a dataset. We can flatten the dataset $d_C$ into the dataset: $d_F = \mathcal{I} \times \mathcal{I} \times \mathcal{T} \times \mathcal{I} \times \mathcal{V}$. The flattening function $F$ is defined as:

$$F = \{(t_s, t_p, t_o, t_g, v) \mid v \in d_C(t_s, t_p, t_o, t_g)\}$$

The domain of $F$ is the set of versioned quads in the dataset $d_C$ where the quad exists in each version according to the condensed model: $\mathcal{D}(F) = \{(t_s, t_p, t_o, t_g, v) \mid \exists v \in d_C(t_s, t_p, t_o, t_g)\}$.
**THEOREM 4.6** ($C \circ F(d_F) = d_F$). *Given a flat model $d_F$, its image by the composition of the C and the F functions is equal to the flat model.*

**PROOF.** We want to prove the following equivalence: $C \circ F(d_F) = d_F$. This means we need to prove:

* On the one hand, that $C \circ F(d_F) \subseteq d_F$;

* On the other hand, that $d_F \subseteq C \circ F(d_F)$.

In other words, we need to show that every element of $C \circ F(d_F)$ belongs to $d_F$, and conversely, every element of $d_F$ belongs to $C \circ F(d_F)$.

Let the versioned quad $(t_s, t_p, t_o, t_g, v) \in d_F$ such that $v \in C(d_F)(t_s, t_p, t_o, t_g)$, then $(t_s, t_p, t_o, t_g, v) \in F(C(d_F))$.

Let $(t_s, t_p, t_o, t_g, v) \in F(C(d_F))$, then $v \in C(d_F)(t_s, t_p, t_o, t_g) = \{v' | (t_s, t_p, t_o, t_g, v') \in d_F\}$. □

**THEOREM 4.7** ($F \circ C(d_C) = d_C$). *Given a condensed model $d_C$, its image by the composition of the F and the C functions is equal to the condensed model.*

**PROOF.** We want to prove the following equivalence: $F \circ C(d_C) = d_C$. This means we must prove:

* For every element of $F \circ C(d_C)$, there exists a corresponding element in $d_C$;

* For every element of $d_C$, there exists a corresponding element in $F \circ C(d_C)$.

In other words, we show equality by proving both inclusions.

Let $V^C = C(F(d_C))(t_s, t_p, t_o, t_g)$, so $V^C = \{v | (t_s, t_p, t_o, t_g, v) \in F(d_C)\} = \{v | v \in d_C(t_s, t_p, t_o, t_g)\} = d_C(t_s, t_p, t_o, t_g)$. □

## 4.3 SPARQL algebra

A SPARQL query algebra provides a formal framework for representing SPARQL queries [7]. It also defines the execution semantics by translating the high-level query syntax into a series of operations that an RDF query engine can process. We use $\mathcal{A}$ to denote the SPARQL algebras set. This paper will present two types of algebra: a condensed algebra and a flat algebra that will be respectively noted as $\mathcal{A}_C$ and $\mathcal{A}_F$. Based on the SPARQL algebra proposed by [7, Cyganiak, Richard, A relational algebra for SPARQL], we modified the SPARQL Algebra to take into account graph versioning to allow us to query them. An initial proposition was made by [6, Cuevas, Hogan] to represent queries over RDF Archives. We have taken this proposition as a basis to define what we call *the flat SPARQL algebra*.

**4.3.1 Flat SPARQL algebra.** The flat SPARQL algebra contains operators that define its expressive power. For example, the quad pattern $QP_F(?s, ?p, ?o, ?g)$ retrieves triples matching the triple pattern $TP_F(?s, ?p, ?o)$ within a versioned graph ?g, and is considered syntactic sugar for the graph operator, as shown by [6, Cuevas, Hogan]. The JOIN operator $\bowtie_F(e_1, e_2)$ combines results from two expressions based on common variable bindings, while the FILTER operator $\sigma_F(\mathcal{E}, e)$ restricts results according to filter functions over variable bindings. The UNION operator $\cup_F(e_1, e_2)$ merges results from two expressions into a single set. The DIFF operator $\setminus_F(e_1, e_2, e_3)$ computes the difference between two sets of solutions, conditioned by an additional expression, and is essential for defining the OPTIONAL

operator. The OPTIONAL operator $\bowtie_F(e_1, e_2, e_3)$ extends the join by including all results from the first expression and, where possible, matching results from the second, returning nulls otherwise. Finally, the aggregation operator groups results based on variables and supports operations such as count, sum, average, min, and max, typically used with the GROUP BY clause in SPARQL queries.

**4.3.2 Condensed algebra.** The condensed algebra provides operators tailored for querying over all versions of a graph in a compact representation. The quad pattern $QP_C(?s, ?p, ?o, ?g)$ retrieves triples matching the triple pattern $TP_F(?s, ?p, ?o)$ across all versioned graphs ?g. The condensed algebra includes optimized aggregation operators that can process data across versions. For example, aggregation operators can leverage optimizations such as count-views (as defined by Sarah Cohen [5]) to efficiently compute aggregate values over versioned data without having to materialize each version separately.

**4.3.3 Variable representation.** SPARQL queries are composed of operators and contain variables whose representations need to be defined. The variable representation is used to determine its behavior in the query and how it is processed in the algebra.

It is important to note that in our current formalization, we do not handle cases where there are variable clashes. Variable clashes occur when two variables with the same name but different scopes or contexts are used within the same query, leading to ambiguity and potential errors in query evaluation. By not addressing these clashes, we assume that all variables are uniquely named within their respective scopes. This simplification allows us to focus on the core aspects of our model and its algebraic semantics without the added complexity of variable disambiguation. However, in a more robust formalization, mechanisms to detect and resolve such clashes would be necessary to ensure the correctness and reliability of query results. In our formalization, each variable in a SPARQL query is assigned a *variable representation* that determines how its value is interpreted and manipulated during query evaluation. Figure 4 illustrates the hierarchy and relationships between the different representations.

<figure><img src="image_6.png" /><figcaption>**Figure 4: Hierarchy of variable representations in SPARQL algebra**</figcaption></figure>

A variable representation is a type that is assigned to a variable in a SPARQL query.

* We note:

- $r, r_1, r_2, \dots$ a variable representation

- $R, R_1, R_2, \dots$ a set of variable representations

- $\mathcal{R}$ an infinite set of variable representations

* We define four variable representations:

- **value** $v$, where variable's bound to a term

- **id** $i$, where variable's bound to a term identifier

- **condensed** $\zeta$, where variable's bound to a list of versioned named graph identifiers
- **unbound graph** $\psi$, where variable's bound to the list of all versioned named graph identifiers

**Definition 4.8 (Variable representation).** Let a bounded total order of variable representations defined as follows: $(\{v, t, \zeta, \psi\}, \le_r)$ where:

* $\{v, t, \zeta, \psi\}$ is the set of elements

* $\le_r$ is the total order relation with:

- $\psi \le_r \zeta \le_r t \le_r v$

- $v$ is the greatest element

- $\psi$ is the least element

This total order serves as a guide to determine the variable representation of the output of a SPARQL operator. For any two representations $r_1, r_2$, we write $r_1 <_r r_2$ to denote their minimum according to $\le_r$.

**Definition 4.9 (Environment).** Let the environment $\Gamma: \mathcal{V}\mathcal{A}\mathcal{R} \to \mathcal{R}$ be a partial function that maps a variable to a variable representation. It is represented as a set of pairs (var, r) where var is a variable and r is a variable representation. We note $\mathcal{D}(\Gamma)$ the domain of the function $\Gamma$.

**Definition 4.10 (Domain of a set of environments).** Let $\Delta$ be a set of environments. We note:

* $\Delta, \Delta_1, \Delta_2, \dots$ a finite set of environments

* $\mathcal{D}(\Delta) = \{\mathcal{D}(\Gamma) | \Gamma \in \Delta\}$ the set of domains of all environments in $\Delta$

**Definition 4.11 (Lower environment of a variable).** $\sqcap_\Delta : 2^\Delta \to \mathcal{V}\mathcal{A}\mathcal{R} \to \Delta$ is a function that takes a set of environments and a variable and returns the environment where the variable is reduced to the lowest representation. It is defined as follows:

$$ 
\begin{aligned}
\mathcal{D}(\sqcap_\Delta(\Delta)) &= \cap \{\mathcal{D}(\Gamma) | \Gamma \in \Delta\} \\
\sqcap_\Delta(\Delta)(\mathit{var}) &= r \mid \forall \Gamma \in \Delta, \\
& \quad r \le_r \Gamma(\mathit{var}) \wedge \forall r', (\forall \Gamma \in \Delta r' \le_r \Gamma(\mathit{var})) \Rightarrow r' \le_r r
\end{aligned}
\quad (2) $$

**Definition 4.12 (Logical provability of an environment).** Logical provability, denoted by $\vdash$, is a relation between an environment $\Gamma$ and an expression $e$ such that $\Gamma \vdash e$ holds if and only if, under the assumptions and variable representations specified by $\Gamma$, the expression $e$ is well-typed and can be evaluated according to the typing rules of the algebra.

**LEMMA 4.13 (GREATEST ENVIRONMENT TYPING).** Let $\Delta$ a set of environments and $e$ is an expression. If $\forall \Gamma \in \Delta, \Gamma \vdash e$, then $\exists r' (\Delta) \vdash e$.

In our approach, SPARQL operators impose constraints on variable representations. Let's take the FILTER operator as an example. When using comparison operators (like `<`, `>`, `=`, `!=`) in a FILTER clause, we can only compare actual values - we cannot compare condensed graph identifiers ($\zeta$) or internal identifiers ($t$) directly. Therefore, when using FILTER, we must promote any variables of type $\zeta$ or $t$ to the $v$ representation by resolving them to their actual values. This promotion ensures the variables can be properly compared in filter conditions. In the case of the JOIN operator, it is necessary for the joined variables to be of the same type in order to apply the appropriate join operation. If the variables are of different types, they need to be promoted to a common type.

**Definition 4.14 (Optimal representation).** We note that $R^*(e)$ is the optimal environment for the expression $e$. It is the environment where all the variables are promoted to the lowest representation. We define the function $R^*: \mathcal{E} \to (\mathcal{V}\mathcal{A}\mathcal{R} \to \mathcal{R})$ such that:

$$ R^*(e) = \sqcap_\Delta (\{\Gamma \mid \Gamma \vdash e\}) \quad (3) $$

**Example 4.15.** Let's consider the SPARQL query 1 below.

**Query 1: Get all the building heights for a specific named graph**

```sql
SELECT ?height WHERE {
  GRAPH ?vng {
    ?s building:height ?height
  }
  ?vng v:is-version-of ng:Gr-Lyon .
}
```

The optimal environment at the quad pattern operator is $\{(?(s, t), ?(height, t), ?(vng, \zeta)\}$.

**Definition 4.16 (Value translation).** Let $\tau_{r \to r'}(value_R(r))$ be a function that returns the set of values in the representation $r'$ that are equivalent to the value in the representation $r$. The function $\tau_{r \to r'}(value_R(r))$ is defined as:

$$ 
\begin{aligned}
\tau_{\psi \to \zeta}(\bullet) &= \{(n, V) \mid \mathit{itov}(n) \in \mathcal{T}_g \wedge V \subseteq V(d)\} \\
\tau_{\zeta \to t}((n, V)) &= \{n' \mid \forall v \in V, \mathit{VI}(v, \mathit{itov}(n)) = \mathit{itov}(n')\} \\
\tau_{t \to v}(n) &= \{\mathit{itov}(n)\}
\end{aligned}
\quad (4) $$

**Definition 4.17 (Type downgrade of a variable's mapping).** Let $\downarrow_{r \to r'}^{var}(m)$ be a function that returns the condensed mappings where the variable *var* is reduced to the representation $r'$. The function $\downarrow_{r \to r'}^{var}(m)$ is defined as:

$$ 
\begin{array}{l@{\qquad}l}
\downarrow_{\Gamma \to \Gamma'}^{var}(m) = [m'] & \\
\quad \begin{cases} m'(var') = m(var') & \text{if } var' \neq var' \\ m'(var) \in \tau_{\Gamma(var) \to \Gamma'(var)}(m(var)) & \text{otherwise} \end{cases} & (5)
\end{array}
$$

**Definition 4.18 (Type reduction of a solution sequence).** Let $\downarrow_{r \to r'}^{var}(seq)$ be a function that returns the condensed solution sequence where the variable *var* is reduced to the representation $r'$. The function $\downarrow_{r \to r'}^{var}(seq)$ is defined as:

$$ \downarrow_{\Gamma \to \Gamma'}^{var}(seq) = \|_{m \in seq} (\downarrow_{r \to r'}^{var}(m)) \quad (6) $$

**Definition 4.19 (Condensed solution sequence's variable translation).** The translation function $\downarrow_{\Gamma \to \Gamma'}^{var}$ is used to translate the variable representation of a solution sequence from an environment $\Gamma$ to another environment $\Gamma'$. It is defined as follows:

$$ 
\begin{aligned}
\downarrow_{\Gamma \to \Gamma'}^{var}(seq) &= \downarrow_{\Gamma \to \Gamma'}^{var} ([m_1, \dots, m_n]) \\
&= \downarrow_{\Gamma(var) \to \Gamma'(var)}^{var}(m_1) \| \dots \| \downarrow_{\Gamma(var) \to \Gamma'(var)}^{var}(m_n) \\
&= \|_{m \in seq} (\downarrow_{\Gamma(var) \to \Gamma'(var)}^{var}(m))
\end{aligned}
\quad (7) $$

Where $\|$ is the concatenation operator that concatenates two solution sequences, and $\|$ is the function that concatenates all the solution sequences in the list.
**Definition 4.20 (Environment transformation).** The environment transformation function $\downarrow_r: ((\mathcal{V}\mathcal{A}\mathcal{R} \to \mathcal{R}) \times (\mathcal{V}\mathcal{A}\mathcal{R} \to \mathcal{R})) \to (\mathcal{A}_C \to \mathcal{A}_C)$ is used to transform the variable representation to a target representation. This function takes two environments (i.e., two ways of associating variables to representations) and constructs a transformation that converts all variables from the old environment to the new environment. For each variable whose representation changes, a specific translation operation is applied to that variable. All these operations are then composed to obtain the overall transformation. It is defined as follows:

$$ \downarrow_r (\Gamma, \Gamma') = \bigcirc_{\{\text{var} | \Gamma(\text{var}) \neq \Gamma'(\text{var})\}} \downarrow_{\Gamma \to \Gamma'}^{\text{var}} \quad \text{if } \Gamma <_r \Gamma' \quad (8) $$

**4.3.4 Metadata operators.** The metadata operators are used to manipulate and query the metadata associated with versioned named graphs. These operators work together to provide fine-grained control over which versions and graphs are included in query results. They are particularly useful when working with versioned RDF datasets where we need to access data from specific versions or named graphs. A detailed ontology of the versioning operators is shown in Figure 5 in the appendix.

**Versioned IRI restriction operator.** Given a SPARQL GRAPH operator, we can restrict the versioned graph to match a specific versioned IRI. The versioned IRI restriction operator `vi-restriction` is used in conjunction with the `GRAPH` keyword in SPARQL queries.

`vi-restr` is a function that takes a versioned IRI and returns the singleton that contains the couple `(n, V)` where `n` is the identifier of the named graph, `V` the singleton containing the variable associated to the versioned named graph, and `itov` the function that converts an RDF identifier to its value.

The expression of this operator is defined as follows:

$$ \begin{aligned} \text{vi-restr: } VI &\to 2^{(\mathbb{N} \times 2^V)} \\ \text{vi-restr: } vi &\mapsto \{(n, \{v\}) \mid VI(v, t_g) = vi \land itov(n) = t_g\} \end{aligned} \quad (9) $$

**Example 4.21.** We can restrict the versioned graph using a versioned IRI shown in the SPARQL query 2 defined below. This query retrieves all the building heights for a specific versioned named graph `<vng:Gr-Lyon-v1>`.

### Query 2: Get all the building heights for a specific versioned graph

```sql
SELECT ?height WHERE {
  GRAPH <vng:Gr-Lyon-v1> {
    ?s building:height ?height
  }
}
```

**Graph restriction operator.** Given a SPARQL GRAPH operator, we can restrict the graph by setting the named graph. The graph restriction operator `vngs-of` is used in conjunction with the triple pattern inside the metadata graph in SPARQL queries.

**Example 4.22.** We can restrict the graph by setting the named graph linked to the versioned graph shown in the SPARQL query 1 previously defined. This query retrieves all the building heights for a specific named graph `ng:Gr-Lyon`.

Given the flat dataset in Table 2, the result of this query is: `[{height ↦ 10.5}, {height ↦ 9.1}, {height ↦ 10.5}, {height ↦ 15}]`.

$$ \begin{aligned} \text{vngs-of: } \mathcal{T}_g &\to 2^{(\mathbb{N} \times 2^V)} \\ \text{vngs-of: } t_g &\mapsto \{(n, V) \mid \text{itov}(n) = t_g\} \end{aligned} \quad (10) $$

**Version restriction operator.** Given a SPARQL GRAPH operator, we can restrict the version by setting the version. The version restriction operator `vngs-in` is used in conjunction with the triple pattern inside the metadata graph in SPARQL queries.

$$ \begin{aligned} \text{vngs-in: } \mathcal{V} &\to 2^{(\mathbb{N} \times 2^V)} \\ \text{vngs-in: } v &\mapsto \{(n, \{v\}) \mid \text{itov}(n) = t_g \land t_g \in \mathcal{T}_g\} \end{aligned} \quad (11) $$

**Example 4.23.** We can restrict the version by setting the version linked to the versioned graph described in the SPARQL query 3 below. This query retrieves all the building heights for a specific version `v:1`.

### Query 3: Get all building heights for a specific version

```sql
SELECT ?height WHERE {
  GRAPH ?vng {
    ?s building:height ?height
  }
  ?vng v:in-version v:1 .
}
```

The result of this query is: `[{height ↦ 10.5}, {height ↦ 9.1}]`.

### 4.3.5 Typing rules.

**Expression typing.** $\Gamma \vdash e : r$, if assuming that the variables are representable as defined in $\Gamma$, $e$ can evaluate to a value that can be represented by $r$.

The expression typing rules determine the variable representation of a SPARQL expression. We define the SPARQL expressions typing rules. A premise (judgment) is a statement or an assertion on a given abstract syntax tree. An inference rule denoted by (Rule) is given by $\frac{P_1, \dots, P_n}{\text{Conc}}$ where $P_1, \dots, P_n$ are the premises and Conc is the conclusion (composed of one judgment).

$$ \begin{array}{l} \text{Terms: } \displaystyle\frac{}{\Gamma \vdash e : v} \quad \text{where } e \in \mathcal{T} \\ \text{Variables: } \displaystyle\frac{}{\Gamma \vdash x : r} \quad \text{where } x \in \text{VAR and } \Gamma(x) = r \\ \text{Functions: } \displaystyle\frac{\Gamma_1 \vdash e_1 : v, \dots, \Gamma_n \vdash e_n : v}{\Gamma \vdash f(e_1, \dots, e_n) : v} \quad \text{where } f \text{ is a function} \quad (12) \end{array} $$

$$ \text{Equality: } \frac{\Gamma \vdash e_1 : r, \Gamma \vdash e_2 : r}{\Gamma \vdash e_1 = e_2 : v} \quad \text{where } t \leq_r r $$

The equality rule is used to determine the variable representation of the equality and inequality operators. Those operators take two expressions as input and returns a boolean value (considered as a `v`). The two expressions need to be of the same type and at least an `t` to be able to compare them.

**Operators typing.** The typing rules are used to determine the variable representation of the output of a SPARQL operator. In this paper we define typing rules for selected SPARQL operators.

$$ \begin{aligned} (QP \text{ with IRI}) : &\frac{}{\Gamma \vdash QP(s, p, o, x)} \quad \text{and } x \in \mathcal{T} \\ (QP \text{ with variable}) : &\frac{}{\Gamma \vdash QP(s, p, o, x)} \quad \text{if } x \in \mathcal{D}(\Gamma) \end{aligned} \quad (13) $$
### Query 4: Concatenation of the building names by height where the height is greater than 10

Example 4.24. SELECT ?height (GROUP_CONCAT(CONCAT("B.", ?b); separator=",") AS ?concatbuilding) WHERE {
GRAPH ?vng {
    ?b height ?height .
}
FILTER(?height > 10)
} GROUP BY ?height

For certain aggregations, we need to convert the aggregated variables into v to be able to perform the aggregation operations. For example, for a sum operation, we need to convert the t variables into v to be able to perform the operation. Let's consider the SPARQL query in Listing 4. The grouping attributes are ?height and the aggregate is GROUP_CONCAT(CONCAT("B.", ?b); separator=","). The variable ?height is of type t and the variable ?b is of type v.

The equation below presents several typing rules for algebraic operations in formal logic. Each rule describes how an expression can be typed based on its environment and the sub-expressions or values it contains. For each rule, the premises are the conditions that must be met for the rule to apply, and the conclusion is the type of the expression.

$$
\begin{align*}
\text{Join}(\triangleright\downarrow) & : \frac{\Gamma \vdash e_1, \Gamma \vdash e_2}{\Gamma \vdash \triangleright\downarrow (e_1, e_2)} \\
\text{Filter}(\sigma) & : \frac{\Gamma \vdash e, \Gamma \vdash c : v}{\Gamma \vdash \sigma(e, c)} \\
\text{Union}(\cup) & : \frac{\Gamma \vdash e_1, \Gamma \vdash e_2}{\Gamma \vdash \cup(e_1, e_2)} \\
\text{Diff}(\setminus) & : \frac{\Gamma \vdash e_1, \Gamma \vdash e_2, \Gamma \vdash e_3}{\Gamma \vdash \setminus(e_1, e_2, e_3)} \\
\text{Optional}(\triangleright\downarrow) & : \frac{\Gamma \vdash e_1, \Gamma \vdash e_2, \Gamma \vdash e_3}{\Gamma \vdash \triangleright\downarrow(e_1, e_2, e_3)} \tag{14} \\
\text{Projection}(\Pi) & : \frac{\Gamma \vdash e}{\Gamma \vdash \Pi(e, \{var_1, \dots, var_n\})} \\
\text{GroupBy}(\text{Gr}) & : \frac{\forall 1 \le i \le m, \Gamma \vdash e_i : v, \Gamma \vdash e}{\Gamma \vdash \text{Gr}(\{e'_1, \dots, e'_m\}, e)} \\
\text{Aggregation}(\text{Agg}) & : \frac{\forall 1 \le i \le n, \Gamma \vdash e_i : v, \Gamma \vdash \text{Gr}}{\Gamma \vdash \text{Agg}(\{e_1, \dots, e_n\}, \text{AggFun}, S, \text{Gr})} \\
\text{AggregateJoin}(\text{AggJ}) & : \frac{\forall 1 \le i \le k, \Gamma \vdash \text{Agg}_i}{\Gamma \vdash \text{AggJ}(\text{Agg}_1, \dots, \text{Agg}_k)}
\end{align*}
$$

Example 4.25. Let's consider the SPARQL query above 4. The term 10 in the FILTER expression is of type v.

Example 4.26. Let's consider the SPARQL query in Listing 4. The function FILTER is of type v because the expression ?height > 10 is of type v. The variable ?height is of type v because it needs to compare it with the term 10. In this case, the function ">" is a function that takes two terms as input and returns a boolean value (considered as a v).

### 4.3.6 Operators translation.
As shown in Figure 3, the dataset is stored in a condensed model. In order to evaluate a SPARQL query on this condensed dataset, we need to translate the input SPARQL query to another query language in order to make it compatible with the condensed model. For this purpose, we will now define the

translation functions for the SPARQL operators of the flat algebra to the condensed algebra. The translation of these operators are done with the function τ and is defined as:

The translation of the flat quad pattern to the condensed quad pattern is straightforward. It doesn't require any variable type transformation.

$$ \tau(QP_F(s, p, o, g)) =QP_C(s, p, o, g) \quad (15) $$

The translation of the flat join operator is done by promoting the variables to the lowest common representation between the two expressions.

$$
\begin{align}
\tau(\triangleright\downarrow_F (e_1, e_2)) &= \triangleright\downarrow_C (\downarrow_r (R^*(e_1), \Gamma)(\tau(e_1)), \downarrow_r (R^*(e_2), \Gamma)(\tau(e_2))) \nonumber \\
&\quad \text{where } \Gamma = R^*(\triangleright\downarrow_F (e_1, e_2)) \tag{16}
\end{align}
$$

The translation of the flat filter operator is straightforward and doesn't require any variable type transformation because they are already in the lowest common representation in the flat algebra.

$$ \tau(\sigma_F(\mathcal{E}, e)) = \sigma_C(\mathcal{E}, \tau(e)) \quad (17) $$

The translation of the flat optional operator is done by promoting the variables to the lowest common representation between the two joined expressions and the filter expression.

$$
\begin{align}
\tau(\triangleright\downarrow_F (e_1, e_2, e_3)) &= \triangleright\downarrow_C ( \nonumber \\
&\quad \downarrow_r (R^*(e_1), \Gamma)(\tau(e_1)), \nonumber \\
&\quad \downarrow_r (R^*(e_2), \Gamma)(\tau(e_2)), \nonumber \\
&\quad \downarrow_r (R^*(e_3), \Gamma)(\tau(e_3))) \tag{18} \\
&\quad \text{where } \Gamma = R^*(\triangleright\downarrow_F (e_1, e_2, e_3)) \nonumber
\end{align}
$$

The translation of the flat union operator is done by promoting the variables to the lowest common representation such that the variables are of the same type.

$$
\begin{align}
\tau(\cup_F(e_1, e_2)) &= \cup_C (\downarrow_r (R^*(e_1), \Gamma)(\tau(e_1)), \downarrow_r (R^*(e_2), \Gamma)(\tau(e_2))) \nonumber \\
&\quad \text{where } \Gamma = R^*(\cup_F(e_1, e_2)) \tag{19}
\end{align}
$$

The translation of the flat group operator requires promoting the grouping variables to their lowest common representation, ensuring compatibility across all group expressions. The translation is defined as follows:

$$
\tau(Gr_F(\mathcal{E}_n, e)) = Gr_C( \{\downarrow_r (R^*(e_1), \Gamma)(\tau(e_1)), \dots, \downarrow_r (R^*(e_n), \Gamma)(\tau(e_n))\}, \tau(e)) \quad (20)
$$

The translation of the flat aggregation operator involves promoting each aggregated expression to the appropriate representation in the target environment. The translation is defined as follows:

$$
\tau(Agg_F(\mathcal{E}_n, AggFun_F, S, Gr_F)) = Agg_C(\{\downarrow_r (R^*(e_1), \Gamma)(\tau(e_1)), \dots, \downarrow_r (R^*(e_n), \Gamma)(\tau(e_n))\}, \tau(AggFun_F), S, \tau(Gr_F)) \quad (21)
$$

The translation of the flat aggregate join operator is performed by translating each aggregated expression individually and then
combining them using the condensed aggregate join operator. The translation is defined as follows:

$$ \tau(\text{Agg}_F(\text{Agg}_{F1}, \dots, \text{Agg}_{Fn})) = \text{Agg}_C(\tau(\text{Agg}_{F1}), \dots, \tau(\text{Agg}_{Fn})) \qquad (22) $$

## 4.4 SPARQL query evaluation

### 4.4.1 Algebra semantics.

**Solution mapping.** We define four partial functions:

* $m^v: \mathcal{V}AR \to value_R(v)$ that maps a set of variables to a set of RDF terms as defined in the "Solution mappings" of SPARQL Query language for RDF [27].

* $m^i: \mathcal{V}AR \to value_R(i)$ that maps a set of variables to a set of term identifiers.

* $m^\zeta: \mathcal{V}AR \to value_R(\zeta)$ that maps a set of variables to a set of pairs composed of a term identifier and finite sets of versions. This solution mapping is called versioned solution mapping.

* $m^\psi: \mathcal{V}AR \to value_R(\psi)$ that maps a set of variables to the singleton that contains all the versioned named graphs denoted $\{\bullet\}$.

We note $m$ the function that returns the instances of a variable in a solution mapping in the representation $r$. The function $m$ is defined as: $m = value_R(r)$ where $value_R$ is the domain of the solution mapping such that $value_R(v) = T$, $value_R(i) = N$, $value_R(\zeta) = N \times 2^V$ and $value_R(\psi) = \{\bullet\}$. We consider a mapping valid when all variables appear only in one representation. The domain of each representation is disjoint such that $value_R(v) \cap value_R(i) = \emptyset$, $value_R(v) \cap value_R(\zeta) = \emptyset$, $value_R(v) \cap value_R(\psi) = \emptyset$, $value_R(i) \cap value_R(\zeta) = \emptyset$, $value_R(i) \cap value_R(\psi) = \emptyset$ and $value_R(\zeta) \cap value_R(\psi) = \emptyset$.

**Definition 4.27 (Expression).** An expression is composed of terms, variables and filter functions. We inductively define $\mathcal{E}$ as:

$$ \left\{ \begin{array}{ll} t \in \mathcal{E} & \text{if } t \in \mathcal{T} \\ \text{var} \in \mathcal{E} & \text{if } \text{var} \in \text{VAR} \\ g(e_1, \dots, e_n) \cup_i \text{VAR}'_i & \text{if } e_i \in \mathcal{E} \\ & \text{and } g \text{ is a filter function with arity } n. \\ & \text{OR/2, AND/2 and NOT/1} \\ & \text{are filter functions} \end{array} \right. \qquad (23) $$

**Flat algebra semantics.** The function $eval_F(d_F, e)$ evaluates a SPARQL expression $e$ over a flat dataset $d_F$ and returns a solution sequence $[m_1^v, \dots, m_n^v]$.

**Definition 4.28 (Evaluation of an expression).** We build values according to the interpretation of the "Effective Boolean Value" [26] that is used to calculate the result of a filter expression such that $t \in \text{values}$ if $t \sim \text{EBV true} \lor t \sim \text{EBV false}$. We consider also that $\emptyset \in \text{values}$.

The function $[[t]]: value$ is a function that returns the value of a term $t$ and the function $[[g/n]]: value^n \to value$ is a function that returns the value of a filter function $g/n$ applied to $n$ values. They

are defined as follows:

$$ eval_e(t, m^v) = [[t]] $$

$$ eval_e(\text{var}, m^v) = \begin{cases} m^v(\text{var}) & \text{if } \text{var} \in \mathcal{D}(m^v) \\ \text{null} & \text{otherwise} \end{cases} $$

$$ eval_e(g(e_1, \dots, e_n), m^v) = [[g/n]](eval_e(e_1, m^v), \dots, eval_e(e_n, m^v)) $$

$$ eval_e(e, m) = eval_e(e, m^v) $$

$$ eval_e(\text{card}, m^v) = 1 $$

$$ eval_e(\text{card}, m) = \prod_{\text{var} \in m^\zeta} |m^\zeta(\text{var})| \times \prod_{\text{var} \in m^\psi} |m^\psi(\text{var})| \qquad (24) $$

**Example 4.29.** Let's consider the SPARQL query 4. The interpretation of the filter expression is $[[?height > 10]] = [[?height]] > 10$. Then, the evaluation of the filter is $eval_e(?height > 10, m^v) = [[?height]] > 10$. The result of the filter is $values = \{\text{true, false}\}$.

**LEMMA 4.30 (INVARIANCE UNDER MAPPING EQUIVALENCE).** Let $m_1, m_2$ be two mappings such that:

$$ \begin{array}{l} \forall \text{var} \in \text{VAR}, (m_1(\text{var}) = m_2(\text{var}) \lor \\ \qquad (\text{var} \notin \mathcal{D}(m_1) \land \text{var} \notin \mathcal{D}(m_2))) \\ \forall e_i \in \mathcal{E}, eval_e(m_1) = eval_e(m_2) \end{array} \qquad (25) $$

INVARIANCE UNDER MAPPING EQUIVALENCE. We proceed by induction on the structure of the expression $\mathcal{E}$. First, consider the case where the expression is a variable $\text{var}$ and $\text{var} \notin \mathcal{D}(m_1)$:

$$ \text{var} \notin \text{dom}(m_2) \land eval_e(\text{var}, m_1) = \text{null} \land eval_e(\text{var}, m_2) = \text{null} \qquad (26) $$

Next, consider the case where the expression is a variable $\text{var}$ and $\text{var} \in \mathcal{D}(m_1)$:

$$ \begin{array}{l} eval_e(\text{var}, m_1) = m_1(\text{var}) \land eval_e(\text{var}, m_2) = m_2(\text{var}) \land \\ \qquad m_1(\text{var}) = m_2(\text{var}) \end{array} \qquad (27) $$

□

**Definition 4.31 (Evaluation of a list of expressions).** We define the function $eval_\mathcal{E}(\mathcal{E}_n, m)$ that evaluates a list of expressions $\mathcal{E}_n$ as:

$$ \begin{align} eval_\mathcal{E}(\mathcal{E}_n, m) &= eval_\mathcal{E}(\{e_1, \dots, e_n\}, m) \tag{28} \\ &= [eval_\mathcal{E}(e_1, m), \dots, eval_\mathcal{E}(e_n, m)] \end{align} $$

**Definition 4.32 (Flat grouping function).** The function $Gr_F(\mathcal{E}_n, \Omega)$ is defined as:

$$ \begin{align} Gr_F(\mathcal{E}_n, \Omega) &= \{eval_\mathcal{E}(\mathcal{E}_n, m^v) \to [m'^v | m'^v \in \Omega, \nonumber \\ & \qquad eval_\mathcal{E}(\mathcal{E}_n, m'^v) = eval_\mathcal{E}(\mathcal{E}_n, m^v)] | m^v \in \Omega\} \tag{29} \end{align} $$

**Example 4.33.** After compiling query 4 and applying it to the dataset 2, the function $Gr_F(\mathcal{E}_n, \Omega) = Gr_F(?height, \Omega)$, where $\Omega$ is shown in Table 6.

**Definition 4.34 (Flat aggregation function).** We define the function $Agg_F(\mathcal{E}_n, AggFun_F, S, Gr_F)$ that creates the results list of an aggregation function. It is defined as:

$$ \begin{align} Agg_F(\mathcal{E}_n, AggFun_F, S, Gr_F) = \nonumber \\ AggFun_F([eval_\mathcal{E}(\mathcal{E}_n, m) | m \in \mathcal{D}(Gr_F)], S) \end{align} \qquad (30) $$

Where $\mathcal{E}$ is the list of expressions, $AggFun_F$ is the aggregation function and $S$ a partial function passed to $AggFun_F$ representing the parameters of the aggregation function.
<table><caption>**Table 6:** Value of Ω before evaluating the flat group operation for query 4 on dataset 2.</caption><thead><tr><th rowspan="2">ψ</th><th rowspan="2">ζ</th><th rowspan="2">l</th><th colspan="3">ν</th></tr><tr><th>?b</th><th>?height</th><th>?vng</th></tr></thead><tbody><tr><td></td><td></td><td></td><td>ex:bldg#1</td><td>10.5</td><td>vi:1</td></tr><tr><td></td><td></td><td></td><td>ex:bldg#1</td><td>10.5</td><td>vi:4</td></tr><tr><td></td><td></td><td></td><td>ex:bldg#1</td><td>10.5</td><td>vi:3</td></tr><tr><td></td><td></td><td></td><td>ex:bldg#1</td><td>11</td><td>vi:2</td></tr><tr><td></td><td></td><td></td><td>ex:bldg#3</td><td>15</td><td>vi:3</td></tr></tbody></table>

**Definition 4.35 (Flat aggregate join function).** The result of the aggregation is a mapping of the variables to the result of the aggregation function. We note $\mathcal{A}\mathcal{E} ::= \text{Agg}(\mathcal{E}_n, \text{AggFun}, S, \text{Gr})$ the expressions of aggregation. $\text{Agg}_{J_F}(\mathcal{A}\mathcal{E}_n) = [\text{agg}_i \to \text{val}_i | k \in \{k' | \exists 1 \le j \le n, k' \in \mathcal{D}(\text{Agg}_{F_j})\}, \forall 1 \le i \le n, (k \to \text{val}_i) \in \text{Agg}_{F_i}]$.

**Example 4.36.** The result of the aggregate join $(\text{Agg}_{J_F}(\mathcal{A}\mathcal{E}_n))$ can be represented as follows:

<table><caption>**Table 7:** Result of $\text{Agg}_{J_F}(\mathcal{A}\mathcal{E}_n)$ for the example.</caption><thead><tr><th rowspan="2">ψ</th><th rowspan="2">ζ</th><th rowspan="2">l</th><th colspan="2">ν</th></tr><tr><th>?1</th><th>?2</th></tr></thead><tbody><tr><td></td><td></td><td></td><td>10.5</td><td>B.ex:bldg#1,B.ex:bldg#1,B.ex:bldg#1</td></tr><tr><td></td><td></td><td></td><td>11</td><td>B.ex:bldg#1</td></tr><tr><td></td><td></td><td></td><td>15</td><td>B.ex:bldg#3</td></tr></tbody></table>

**Definition 4.37 (Flat compatibility function).** $m_1^v \sim_F m_2^v$ is a function that checks if two solution mappings are compatible. It is defined as:

$$m_1^v \sim_F m_2^v = \forall \text{var} \in \mathcal{D}(m_1^v) \cap \mathcal{D}(m_2^v), m_1^v(\text{var}) = m_2^v(\text{var}) \quad (31)$$

In order to evaluate the join of two quads patterns, we need to define the merge function $\vee_F$ of two mappings. The combination function is defined as:

$$\begin{aligned} \vee_F(m_1^v, m_2^v) &= m^v | m_1^v \sim_F m_2^v \wedge \forall x \in \mathcal{D}(m_1^v) \cap \mathcal{D}(m_2^v), \\ m^v(x) &= \begin{cases} m_1^v(x), & \text{if } x \in \mathcal{D}(m_1^v) \\ m_2^v(x), & \text{otherwise} \end{cases} \end{aligned} \quad (32)$$

The evaluation functions of those graph patterns are defined in the appendix B.3.1.

**Condensed algebra semantics.** The function $\text{eval}_C(d_C, E)$ evaluates a SPARQL expression E over a condensed dataset $d_C$ and produces a sequence of condensed solution mappings $[m_1, \dots, m_n]$.

**Definition 4.38 (Condensed grouping function).** The grouping function $\text{Gr}_C(\mathcal{E}, \Omega)$ is defined as:

$$\text{Gr}_C(\mathcal{E}, \Omega) = \{\text{eval}_\mathcal{E}(\mathcal{E}_n, m) \to [m' | \\ m' \in \Omega, \text{eval}_\mathcal{E}(\mathcal{E}_n, m') = \text{eval}_\mathcal{E}(\mathcal{E}_n, m)] | m \in \Omega\} \quad (33)$$

**Example 4.39.** After compiling query 4 and applying it to the dataset 5, the function $\text{Gr}_C(\mathcal{E}, \Omega) = \text{Gr}_C((?\text{height}), \Omega)$, where $\Omega$ is shown in Table 8.

<table><caption>**Table 8:** Value of Ω before evaluating the condensed group operation for query 4 on dataset 5.</caption><thead><tr><th rowspan="2">ψ</th><th rowspan="2">ζ</th><th colspan="3">l</th><th rowspan="2">ν</th></tr><tr><th>?vng</th><th>?b</th><th>?height</th></tr></thead><tbody><tr><td></td><td></td><td>(6, {v:1, v:2})</td><td>1</td><td>2</td><td></td></tr><tr><td></td><td></td><td>(7, {v:2})</td><td>1</td><td>2</td><td></td></tr><tr><td></td><td></td><td>(7, {v:1})</td><td>1</td><td>3</td><td></td></tr><tr><td></td><td></td><td>(6, {v:2})</td><td>4</td><td>5</td><td></td></tr></tbody></table>

**Definition 4.40 (Condensed aggregation function).** Let's define the function $\text{Agg}_C(\mathcal{E}_n, \text{AggFun}_C, S, \text{Gr}_C)$ that creates a list of result of an aggregation function. It is defined as:

$$\begin{aligned} \text{Agg}_C(\mathcal{E}_n, \text{AggFun}_C, S, \text{Gr}_C) = & \\ & \text{AggFun}_C([\text{eval}_\mathcal{E}([e'_1, \dots, e'_n, \text{card}], m) | m \in \Omega], S) \end{aligned} \quad (34)$$

**Definition 4.41 (Condensed aggregate join function).** After the group by operation, we can apply the aggregation function to the results list. The function is defined as:

$$\begin{aligned} \text{Agg}_C(\mathcal{A}\mathcal{E}_n) = & [\text{agg}_i \to \text{val}_i | \\ & k \in \{k' | \exists 1 \le j \le n, k' \in \mathcal{D}(\text{Agg}_{C_j})\}, \\ & \forall 1 \le i \le n, (k \to \text{val}_i) \in \text{Agg}_{C_i}] \end{aligned} \quad (35)$$

**Definition 4.42 (Condensed compatibility function).** It checks compatibility by requiring that, for each component of the mappings, the values or identifiers are equal for shared variables, condensed elements have the same graph and overlapping version sets, and unbound graphs are equal for common keys. In summary, two mappings are compatible if all their shared domains agree according to these criteria. It is defined as:

$$\begin{aligned} m_1 \sim_C m_2 &= \forall x \in \mathcal{D}(m_1^v) \cap \mathcal{D}(m_2^v), m_2^v(x) = m_2^v(x) \wedge \\ & \forall x \in \mathcal{D}(m_1^t) \cap \mathcal{D}(m_2^t), m_1^t(x) = m_2^t(x), \\ & \forall x \in \mathcal{D}(m_1^\zeta) \cap \mathcal{D}(m_2^\zeta), \\ & m_1^\zeta(x) = (t_{g1}, V_1), m_2^\zeta(x) = (t_{g2}, V_2), t_{g1} = t_{g2}, \\ & V_1 \cap V_2 \neq \emptyset, \forall x \in \mathcal{D}(m_1^\psi) \cap \mathcal{D}(m_2^\psi), m_1^\psi(x) = m_2^\psi(x) \end{aligned} \quad (36)$$

A basic graph pattern inside a graph can be interpreted as a join of two quad patterns. In order to evaluate the join of two quad patterns, we need to define the combination of two mappings $m_1, m_2$. This equation describes how to merge two mappings by defining the resulting values for each common domain based on the values of the original mappings. The combination function is
defined as:

$$
\begin{align}
\forall_C (m_1, m_2) &= m \mid m_1 \sim_C m_2 \land \forall x \in \mathcal{D}(m_1^v) \cap \mathcal{D}(m_2^v), \nonumber \\
m^v(x) &= \begin{cases} m_1^v(x), & \text{if } x \in \mathcal{D}(m_1^v) \\ m_2^v(x), & \text{otherwise} \end{cases} \nonumber \\
\forall x \in \mathcal{D}(m_1^t) \cap \mathcal{D}(m_2^t), \nonumber \\
m^t(x) &= \begin{cases} m_1^t(x), & \text{if } x \in \mathcal{D}(m_1^t) \\ m_2^t(x), & \text{otherwise} \end{cases} \nonumber \\
\forall x \in \mathcal{D}(m_1^\zeta) \cap \mathcal{D}(m_2^\zeta), \nonumber \\
m^\zeta(x) &= \begin{cases} m_1^\zeta(x), & \text{if } x \in \mathcal{D}(m_1^\zeta) \setminus \mathcal{D}(m_2^\zeta) \\ m_2^\zeta(x), & \text{if } x \in \mathcal{D}(m_2^\zeta) \setminus \mathcal{D}(m_1^\zeta) \\ (t_{g1}, V_1 \cap V_2), & \text{otherwise} \end{cases} \nonumber \\
&\quad \text{where } m_1^\zeta(x) = (t_{g1}, V_1) \land m_2^\zeta(x) = (t_{g2}, V_2) \nonumber \\
\forall x \in \mathcal{D}(m_1^\psi) \cap \mathcal{D}(m_2^\psi), m^\psi(x) &= m_1^\psi(x) \tag{37}
\end{align}
$$

The compatibility function ~ and the merge function $\vee_C$ are used to evaluate the join expression. The evaluation functions of those graph patterns are defined in the appendix B.3.2.

### 4.4.2 Results equivalence.

**Definition 4.43 (Represents).** Let $v_m(\mathbf{var}) : \mathcal{V}\mathcal{A}\mathcal{R} \to 2^T$ be a function that returns the set of terms for a variable in the mapping $m$. We consider the injective function $\mathit{itov}$ to be given as the evaluation of a $m^t$ to a $m^v$. The function $v_m(\mathbf{var})$ is defined as: $v_m(\mathbf{var}) =$

$$
\left\{
\begin{array}{ll}
\{m^v(\mathbf{var})\}, & \text{if } \mathbf{var} \in \mathcal{D}(m^v) \\
\{\mathit{itov}(m^t(\mathbf{var}))\}, & \text{if } \mathbf{var} \in \mathcal{D}(m^t) \\
\{\mathbf{VI}(v, t_g) \mid (t_g, V) = m^\zeta(\mathbf{var}) \land v \in V\}, & \text{if } \mathbf{var} \in \mathcal{D}(m^\zeta) \\
\{\mathbf{VI}(v, t_g) \mid v \in \mathcal{V} \land t_g \in \mathcal{T}_g\}, & \text{if } \mathbf{var} \in \mathcal{D}(m^\psi)
\end{array}
\right.
\tag{38}
$$

**Example 4.44.** Let $m = \{m^v \mapsto (), m^t \mapsto (?b \mapsto 4, ?height \mapsto 5), m^\zeta \mapsto (?vng \mapsto (6, \{v:2\})), m^\psi \mapsto ()\}$.

Then $v_m(?b) = \{\text{ex:bldg\#3}\}, v_m(?height) = \{15\}, v_m(?vng) = \{\mathbf{VI}(v:2, 6) = \mathbf{vi} : 3\}$.

**Definition 4.45 (Flattening of a condensed solution mapping).** We write $m_F$ the mapping that is of the form $m_F \in d_F(t_s, t_p, t_o, t_g, v)$. Let $\Xi$ be a function that returns the sequence of all flat solution mappings for a condensed solution mapping. The function $\Xi$ is defined as:

$$
\Xi(m) = [m_F \mid \mathcal{D}(m_F) = \mathcal{D}(m^v) \cup \mathcal{D}(m^t) \cup \mathcal{D}(m^\zeta) \cup \mathcal{D}(m^\psi) \land \\ \forall \mathbf{var} \in \mathcal{D}(m_F), m_F(\mathbf{var}) \in v_m(\mathbf{var})] \tag{39}
$$

**Definition 4.46 (Permutation of a sequence).** Let $\pi(\mathbf{seq})$ the function that returns all the permutations of a sequence where $S_n$ is the symmetric group on $n$ elements, i.e., the set of all permutations from the set $\{1, \dots, n\}$ to itself. The function $\pi$ is defined as: $\pi(\mathbf{seq}) = \pi([m_1, \dots, m_n]) = \{[m_{\sigma(1)}, \dots, m_{\sigma(n)}] \mid \sigma \in S_n\}$.

**LEMMA 4.47 (CANONICAL REPRESENTATION OF AN EVALUATION).** If $\mathit{seq}_F \cong \mathit{eval}_C(d_C, e)$ then $\mathit{seq}_F \cong \mathit{eval}_C(d_C, \downarrow_r(\Gamma, \Gamma')(e))$.

The proof is provided in Appendix B.3.3.

**THEOREM 4.48 (EVALUATION EQUIVALENCE).** Let a flat algebra $A_F$, a condensed algebra $A_C$ such that $A_C = \tau(A_F)$ and a dataset $d$

and its associated representations $d_F$ and $d_C$ then $\mathit{eval}_F(d_F, A_F) \cong \mathit{eval}_C(d_C, \tau(A_F))$.

The proof is provided in Appendix B.3.3.

# 5 FROM THEORETICAL FOUNDATIONS TO BENCHMARKS

## 5.1 Implementation of ConVer-G

The ConVer-G system is composed of several components that work together to provide a comprehensive solution for versioned knowledge representation and querying. The Quads loaDer (QuaDer) component is responsible for loading versions of graphs into the system. The Quads Query (QuaQue) component handles the querying of versioned graphs using either the condensed or the flat algebra.

In its current implementation, core operators are available, including the condensed quad pattern, join, filter, union, optional and aggregation. The translation function is implemented to convert SPARQL queries involving these patterns from the flat algebra into the condensed algebra for execution.

Rather than storing version sets as explicit lists, we encode them as bitstrings, where each bit position corresponds to a specific version. A set bit indicates the presence of that version in the set. This representation enables set operations—such as intersection (bitwise AND) and union (bitwise OR)—which are usefull for the condensed join operator. For example, joining two quads valid in versions {$v:1, v:5$} and {$v:1, v:10$} involves a simple bitwise AND of their bitstrings, instantly yielding the intersection {$v:1$}. This approach eliminates the need for iteration over version lists.

To compare different methods for querying multiple versions of knowledge, we benchmarked our condensed representation. This allowed us to evaluate and contrast the approaches for querying multiple versions simultaneously.

The benchmark measured query times, memory usage, and space consumption for both the condensed and flat representations. These tests provided insights into the strengths and weaknesses of each model regarding resource usage and performance.

Experiments were conducted on the LIRIS platform PAGODA https://projet.liris.cnrs.fr/pagoda/latest/, which offers a stable, high-performance, and controlled environment to ensure reliable results. We used Argo Workflows, deployed on the PAGODA Kubernetes cluster, to automate and manage experiment pipelines efficiently. A dataset with fixed numbers of versions, products, and steps was used to ensure consistency across runs, and a fixed memory limit was set for comparability.

The benchmarking environment provided 156 virtual CPU cores and 896GB of RAM, distributed across three HPE Proliant servers (DL380 and DL385 models), each with two AMD EPYC 7443 processors (24 cores per processor, 2.85GHz, 200W).

The environment was configured as follows:

* Cluster provider: RKE2.

* Kubernetes version: 1.30.7+rke2r1.

* Architecture: Amd64.

The benchmark used these parameters:

* Number of versions in the dataset (Ve): [5,20,50,100].
* **Number of steps (St):** [0,5,10]. This determined the number of products (i.e., quads) added to the dataset in each version.

These parameters were chosen to cover a broad range of scenarios and ensure the results reflect real-world use cases. A cartesian product of the parameters generated the configurations. For each configuration, an experiment was run and results recorded. The benchmark results are available in the following sections, and for reproducibility, the source code used to conduct the benchmark is available at https://github.com/VCityTeam/UD-knowledge-evolution-experiment.

Each experiment deployed the components in a Kubernetes-controlled environment, allowing precise management of memory and CPU resources. Resource allocations for each component were:

* **Processor:** Virtual CPU core request: 1, Virtual CPU core limit: 2.

* **Memory allocation:** Request - 4GB, Limit - 8GB.

## 5.2 Model - Space usage

The condensed representation may use less space than the flat model. We conducted experiments to compare the space usage of both models. Three plots illustrate performance and resource usage for different types of knowledge graphs: non-evolutive, evolutive, and highly evolutive. These visualizations provide further insight into the comparative analysis. To ensure validity, only experiments completed without errors were included.

Results show that the Postgres-condensed approach consistently uses the least space across all configurations. For instance, with 50 versions and 10 steps, Postgres-condensed uses about 841MB, compared to 2333MB for Postgres-flat, 3091MB for Blazegraph, and 13148MB for Jena. This trend holds for smaller datasets: with 5 versions and 10 steps, Postgres-condensed uses 34MB, while Postgres-flat uses 74MB, Blazegraph 86MB, and Jena 195MB.

As the number of versions and steps increases, space usage grows for all systems, but much more slowly for Postgres-condensed. Blazegraph and Jena show the steepest increases, especially for highly evolutive datasets.

## 5.3 Dataset query time

For the same query, the condensed representation is expected to be faster than the flat one. We conducted experiments to compare query times for both models.

A set of 17 queries was designed to evaluate system performance, covering both non-aggregative and aggregative use cases. Each query was executed 200 times, with the first 20 runs discarded to account for system warm-up, ensuring only stabilized measurements were analyzed. Each experiment ran every query multiple times on each component to ensure statistical significance and account for variability.

Benchmark results for both non-aggregative and aggregative queries reveal clear trends. For non-aggregative queries, QuaQue-flat consistently achieves the lowest median query times in all configurations, often outperforming other systems by a significant margin. Blazegraph and Jena TDB generally have higher query times, with performance degrading as the number of versions and

steps increases. QuaQue-condensed, while not as fast as QuaQue-flat for non-aggregative queries, remains competitive and scales better than Blazegraph and Jena TDB.

For aggregative queries, performance is more nuanced. QuaQue-flat often provides the best median times, but in some configurations, QuaQue-condensed approaches or surpasses its performance. This suggests that the choice between condensed and flat representations depends on the query type and dataset characteristics. As datasets become more complex, the performance gap between QuaQue-flat and other systems widens, especially for non-aggregative queries.

In summary, the flat representation is generally optimal for non-aggregative queries, while the condensed representation can be advantageous for certain aggregative queries and scales better in terms of space usage. Blazegraph and Jena TDB are less efficient in both query time and scalability compared to the specialized QuaQue implementations. QuaQue-flat queries are faster because they operate on a simple, pre-processed table and use **Hash Joins**, ideal for bulk processing. QuaQue-condensed queries are slower due to complex data transformations performed on the fly, which can mislead the query planner and result in inefficient **Nested Loop** plans, leading to suboptimal performance under real workloads.

# 6 DISCUSSION

Our formalization provides a solid foundation for understanding and handling RDF versioning in a condensed representation. While our primary motivation and examples have focused on urban data management, the approach is generalizable to a wide range of domains where versioned knowledge graphs are relevant, such as biomedical informatics, digital humanities, software engineering, and scientific data management. Any application that requires querying, and provenance tracking of evolving RDF datasets with different POVs can benefit from the condensed representation and associated algebra. Furthermore, several theoretical limitations need to be addressed in future works.

## 6.1 Integration with Existing RDF Infrastructure

Our formalization is designed to be compatible with existing RDF standards and infrastructure. The condensed algebra can be implemented as an extension to current RDF stores and SPARQL engines, enabling backward compatibility and incremental adoption. Integration with standards such as PROV [28] would facilitate interoperability and provenance tracking. Furthermore, the translation layer from standard SPARQL to the condensed algebra allows users to leverage familiar query languages while benefiting from the performance and storage optimizations of the condensed model. By aligning our ontology and implementation with established RDF tools and protocols, our approach can be seamlessly incorporated into existing workflows and infrastructures, broadening its impact across multiple domains.

## 6.2 RDF standards and expressiveness

6.2.1 *Integration with Existing RDF Standards.* Our formalization has not been fully integrated with existing RDF standards and tools. This would involve aligning our versioning ontology with standards
like PROV [28] and implementing our model in popular RDF query engines.

### 6.2.2 *Handling of Variable Clashes*
Our current formalization does not address variable clashes, which can lead to ambiguity and errors in query evaluation. A more robust approach would involve mechanisms to detect and resolve such clashes.

### 6.2.3 *Blank node handling*
Our formalization does not address the handling of blank nodes, which are a common feature of RDF data. A more comprehensive model would need to include mechanisms for dealing with blank nodes in versioned data.

### 6.2.4 *Limited Expressiveness of the Versioning Model*
Our model is based on a snapshot-based versioning approach, which may not be suitable for all use cases. For example, it cannot handle continuous changes or temporal intervals effectively.

## 6.3 Solution Sequences and modifiers needs

Projection modifier has been considered in our formalization. However, other modifiers such as Offset, Limit, Order, Distinct, and Reduced are not yet supported. These modifiers are essential for many query scenarios and will be considered in future work.

## 6.4 Condensed representation limitations

### 6.4.1 *Complexity of the Condensed Representation*
While the condensed representation offers potential storage and query optimization benefits, it also introduces complexity in terms of model manipulation and query translation.

### 6.4.2 *Abstraction of the level of compression.*

**Finite set of compression levels.** Our formalization uses a finite set of compression levels. This means that we have defined a limited number of compression levels that our system can handle. While this approach is sufficient for many use cases, it has certain limitations. A formalization that generalizes the typing of variables for any representation could be more advantageous. By allowing more flexible typing, we could support a wider range of compression levels, including intermediate levels or levels defined dynamically based on the specific needs of the application.

**From a bounded total order to a bounded lattice.** Our formalization uses a bounded total order to represent the variable representations. While this approach is sufficient for many use cases, it has certain limitations. A formalization that uses a bounded lattice could be more advantageous. By allowing more flexible typing, we could support a wider range of compression levels, including intermediate levels or levels defined dynamically based on the specific needs of the application.

## ACKNOWLEDGMENTS

This work *Condensed representation of RDF and its application on graph versioning* is supported and funded by the IADoc@UDL (Université de Lyon, Universite Claude Bernard Lyon 1) and LIRIS UMR 5205. We also acknowledge the BD team and the Virtual City Project [23] members for their invaluable advice and assistance. We thank the anonymous reviewers for their constructive comments that helped improve the quality of this paper.

## REFERENCES

[1] Natanael Arndt. 2020. *Distributed Collaboration on Versioned Decentralized RDF Knowledge Bases*. Ph.D. Dissertation. Universität Leipzig. https://doi.org/10.33968/9783966270205-00

[2] Leila Bayoudhi, Najla Sassi, and Wassim Jaziri. 2020. A survey on versioning approaches and tools. In *International Conference on Intelligent Systems Design and Applications*. Springer, 1155–1164.

[3] Laurent Bulteau, Pierre-Yves David, and Florian Horn. 2023. The Problem of Discovery in Version Control Systems. In *Proceedings of the XII Latin-American Algorithms, Graphs and Optimization Symposium (LAGOS 2023)*. Elsevier, Huatulco, Oaxaca, Mexico, 209–216. https://doi.org/10.1016/j.procs.2023.08.231

[4] Kanishk Chaturvedi, Carl Stephen Smyth, Gilles Gesquière, Tatjana Kutzner, and Thomas H. Kolbe. 2017. Managing Versions and History Within Semantic 3D City Models for the Next Generation of CityGML. In *Advances in 3D Geoinformation, Alias Abdul-Rahman (Ed.). Springer International Publishing, Cham, 191–206*. https://doi.org/10.1007/978-3-319-25691-7_11

[5] Sara Cohen, Werner Nutt, and Yehoshua Sagiv. 2006. Rewriting queries with arbitrary aggregation functions using views. *ACM Transactions on Database Systems (TODS)* 31, 2 (2006), 672–715.

[6] Ignacio Cuevas and Aidan Hogan. 2020. Versioned Queries over RDF Archives: All You Need is SPARQL?. In *MEPDaW@ ISWC*. 43–52.

[7] Richard Cyganiak. 2005. A relational algebra for SPARQL. *Digital Media Systems Laboratory HP Laboratories Bristol. HPL-2005-170* 35, 9 (2005).

[8] Helen Eriksson, Jing Sun, Väino Tarandi, and Lars Harrie. 2021. Comparison of versioning methods to improve the information flow in the planning and building processes. *Transactions in GIS* 25, 1 (Feb. 2021), 134–163. https://doi.org/10.1111/tgis.12672

[9] Jey Puget Gil, Emmanuel Coquery, John Samuel, and Gilles Gesquiere. 2024. ConVer-G: Concurrent versioning of knowledge graphs. arXiv:2409.04499 [cs.DB] https://arxiv.org/abs/2409.04499

[10] Aidan Hogan, Marcelo Arenas, Alejandro Mallea, and Axel Polleres. 2014. Everything you always wanted to know about blank nodes. *Journal of Web Semantics* 27-28 (Aug. 2014), 42–69. https://doi.org/10.1016/j.websem.2014.06.004

[11] Christian Søndergaard Jensen and Richard T Snodgrass. 2009. Temporal Database. In *Encyclopedia of Database Systems*. Springer, 2957–2960.

[12] Jens Klump, Lesley Wyborn, Mingfang Wu, Julia Martin, Robert R Downs, and Ari Asmi. 2021. Versioning data is about more than revisions: A conceptual framework and proposed principles. *Data Science Journal* 20, 1 (2021), 12.

[13] Krishna Kulkarni and Jan-Eike Michels. 2012. Temporal features in SQL:2011. *SIGMOD Rec.* 41, 3 (oct 2012), 34–43. https://doi.org/10.1145/2380776.2380786

[14] Tatjana Kutzner, Kanishk Chaturvedi, and Thomas H. Kolbe. 2020. CityGML 3.0: New Functions Open Up New Applications. *PFG - Journal of Photogrammetry, Remote Sensing and Geoinformation Science* 88, 1 (Feb. 2020), 43–61. https://doi.org/10.1007/s41064-020-00095-z

[15] Olivier Pelgrin, Ruben Taelman, Luis Galárraga, and Katja Hose. 2023. GLENDA: querying RDF archives with full SPARQL. In *European Semantic Web Conference*. Springer, 75–80.

[16] John Samuel, Sylvie Servigne, and Gilles Gesquière. 2018. Urbanco2fab: comprehension of concurrent viewpoints of urban fabric based on git. *ISPRS Annals of the Photogrammetry, Remote Sensing and Spatial Information Sciences* 4 (2018), 65–72.

[17] John Samuel, Sylvie Servigne, and Gilles Gesquière. 2020. Representation of concurrent points of view of urban changes for city models. *Journal of Geographical Systems* (Feb. 2020). https://doi.org/10.1007/s10109-020-00319-1

[18] Atle Frenvik Sveen. 2020. *GeomDiff* — an algorithm for differential geospatial vector data comparison. *Open Geospatial Data, Software and Standards* 5, 1 (Dec. 2020), 3. https://doi.org/10.1186/s40965-020-00076-4

[19] Wouter Swierstra and Andres Löh. 2014. The Semantics of Version Control. In *Proceedings of the 2014 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software* (Portland, Oregon, USA) (Onward! 2014). Association for Computing Machinery, New York, NY, USA, 43–54. https://doi.org/10.1145/2661136.2661137

[20] Ruben Taelman, Miel Vander Sande, Joachim Van Herwegen, Erik Mannens, and Ruben Verborgh. 2019. Triple storage for random-access versioned querying of RDF archives. *Journal of Web Semantics* 54 (2019), 4–28.

[21] GeoGig team. 2024. GeoGig - Geospatial Distributed Version Control System. https://github.com/locationtech/geogig

[22] Qri team. 2024. Qri CLI. https://github.com/qri-io/qri

[23] VCity Team. 2024. VCity project website. https://projet.liris.cnrs.fr/vcity/

[24] Diego Vinasco-Alvarez, John Samuel, Sylvie Servigne, and Gilles Gesquière. 2021. Towards a semantic web representation from a 3D geospatial urban data model. In *SAGEO 2021, 16ème Conférence Internationale de la Géomatique, de l'Analyse Spatiale et des Sciences de l'Information Géographique*. 227–238. https://hal.science/hal-03240567/file/SAGEO_2021.pdf

[25] W3C. 2024. RDF 1.1 Concepts and Abstract Syntax. https://www.w3.org/TR/rdf11-concepts/
[26] W3C. 2024. SPARQL 1.1 Query Language. https://www.w3.org/TR/sparql11-query/

[27] W3C. 2024. SPARQL Query Language for RDF. https://www.w3.org/TR/rdf-sparql-query/

[28] W3C. 2025. PROV-Overview. https://www.w3.org/TR/prov-overview/

[29] Gunce Su Yilmaz and Jens Dittrich. 2025. Generic Version Control: Configurable Versioning for Application-Specific Requirements. In *Proceedings of the 15th Annual Conference on Innovative Data Systems Research (CIDR 2025)*. CIDR, Amsterdam, The Netherlands, 24. https://vldb.org/cidrdb/papers/2025/p24-yilmaz.pdf

[30] Nazatul Nurlisa Zolkifli, Amir Ngah, and Aziz Deraman. 2018. Version Control System: A Review. *Procedia Computer Science* 135 (2018), 408–415. https://doi.org/10.1016/j.procs.2018.08.191 The 3rd International Conference on Computer Science and Computational Intelligence (ICCSCI 2018) : Empowering Smart Technology in Digital Era for a Better Life.
# A STATE OF THE ART - VERSIONING

## A.1 Dataset versioning

<table><caption>Table 9: Comparison of versioning tools by archiving policies and query capabilities and area of application</caption><thead><tr><th rowspan="2">Tool</th><th rowspan="2">Area of application</th><th colspan="4">Archiving Policies</th><th colspan="3">Query Capabilities</th></tr><tr><th>IC</th><th>CB</th><th>TB</th><th>FB</th><th>VQ</th><th>CV</th><th>CM</th></tr></thead><tbody><tr><td>Qri</td><td>Dataset versioning</td><td>✓</td><td>✓</td><td></td><td></td><td>✓</td><td></td><td></td></tr><tr><td>GeoGig</td><td>Geospatial versioning</td><td>✓</td><td>✓</td><td></td><td></td><td>✓</td><td></td><td></td></tr><tr><td>UrbanCo2Fab</td><td>Urban data versioning</td><td>✓</td><td>✓</td><td>✓</td><td></td><td>✓</td><td>✓</td><td>✓</td></tr><tr><td>W&B</td><td>ML experiment tracking</td><td>✓</td><td></td><td></td><td></td><td>✓</td><td></td><td></td></tr><tr><td>DVC</td><td rowspan="2">ML dataset versioning</td><td>✓</td><td>✓</td><td></td><td></td><td>✓</td><td></td><td></td></tr><tr><td>DagsHub</td><td>✓</td><td></td><td>✓</td><td></td><td>✓</td><td></td><td></td></tr><tr><td>Delta Lake</td><td rowspan="2">Data lake versioning</td><td>✓</td><td>✓</td><td>✓</td><td></td><td>✓</td><td></td><td></td></tr><tr><td>Hudi</td><td>✓</td><td>✓</td><td>✓</td><td></td><td>✓</td><td></td><td></td></tr><tr><td>stardog</td><td rowspan="4">RDF store versioning</td><td>✓</td><td></td><td></td><td></td><td>✓</td><td></td><td></td></tr><tr><td>Quit Store</td><td></td><td></td><td></td><td></td><td>✓</td><td></td><td></td></tr><tr><td>OSTRICH</td><td>✓</td><td>✓</td><td></td><td>✓</td><td>✓</td><td>✓</td><td></td></tr><tr><td>ConVer-G</td><td></td><td></td><td></td><td>✓</td><td>✓</td><td>✓</td><td>✓</td></tr></tbody></table>

**Legend:** IC: Independent Copies, CB: Change-Based, TB: Timestamp-Based, FB: Fragment-Based. VQ: Version Queries, CV: Cross-Version Queries, CM: Change Materialization.

# B CONTRIBUTIONS

## B.1 Dataset models

<table><caption>Table 10: Association of the identifiers with their values</caption><thead><tr><td>identifier</td><td>Value</td></tr></thead><tbody><tr><td>1</td><td>ex:bldg#1</td></tr><tr><td>2</td><td>10.5</td></tr><tr><td>3</td><td>11</td></tr><tr><td>4</td><td>ex:bldg#3</td></tr><tr><td>5</td><td>15</td></tr><tr><td>6</td><td>ng:Gr-Lyon</td></tr><tr><td>7</td><td>ng:IGN</td></tr><tr><td>8</td><td>ex:bldg#2</td></tr><tr><td>9</td><td>height</td></tr></tbody></table>

## B.2 Versioning ontology

## B.3 Algebra semantics

### B.3.1 Flat algebra semantics.

Quad pattern.

$$ eval_F(d_F, QP) = \begin{cases} eval_F(d_F, QP_F(?s, ?p, ?o, ?ag)) = [m | \exists t_g \exists v, m(?ag) = VI(v, t_g) \land (m(?s), m(?p), m(?o), t_g, v) \in d_F] \\ \text{if } ?ag \text{ is a variable} \\ eval_F(d_F, QP_F(?s, ?p, ?o, ag)) = [m | \exists t_g \exists v, VI(v, t_g) = ag \land (m(?s), m(?p), m(?o), t_g, v) \in d_F] \\ \text{if } ag \text{ is an IRI} \end{cases} \quad (40) $$
<figure><img src="image_7.png" /><figcaption>Figure 5: Versioning ontology</figcaption></figure>

Join.

$$ eval_F(d_F, \triangleright) = eval_F(d_F, \triangleright_F(e_1, e_2)) = \Omega \qquad (41) $$

$$ \mathcal{D}(\Omega) = [m \mid \exists m_1, \exists m_2 m_1 \in \Omega_1, m_2 \in \Omega_2, m = \forall_F(m_1, m_2)] $$

$$ \Omega(m) = \sum_{m_1 \in \mathcal{D}(\Omega_1), m_2 \in \mathcal{D}(\Omega_2), m = \forall_F(m_1, m_2)} \Omega_1(m_1) \times \Omega_2(m_2) $$
Union.

$$ eval_F(d_F, \cup) = eval_F(d_F, \cup_F(e_1, e_2)) = eval_F(d_F, e_1) \parallel eval_F(d_F, e_2) \qquad (42) $$

Filter.

$$ eval_F(d_F, \sigma) = eval_F(d_F, \sigma_F(\mathcal{E}, e)) = [m \in eval_F(d_F, e) \wedge eval_e(\mathcal{E}, m) \sim_{EBV} true] \qquad (43) $$

Difference.

$$ eval_F(d_F, \setminus) = eval_F(d_F, \setminus_F(e_1, e_2, e_3)) = \Omega \qquad (44) $$

$$ \mathcal{D}(\Omega) = [m \mid m \in \Omega_1, \forall m_2 \in \Omega_2, \Omega_1 = eval_F(d_F, e_1), \Omega_2 = eval_F(d_F, e_2), \left\{ \begin{array}{l} \neg(m \sim_F m_2) \\ m \sim_F m_2 \wedge eval_e(\{e_3\}, \vee_F(m, m_2)) \sim_{EBV} false \end{array} \right. ] \\ \Omega(m) = \setminus_F(\Omega_1, \Omega_2, e_3)(m) = \Omega_1(m) $$

Left outer join (optional).

$$ eval_F(d_F, \succ) = eval_F(d_F, \succ_F(e_1, e_2, e_3)) = eval_F(d_F, \cup_F(\sigma_F(\{e_3\}, \succ_F(e_1, e_2)), \setminus_F(e_1, e_2, e_3))) \qquad (45) $$

Group by.

$$ eval_F(d_F, Gr) = eval_F(d_F, Gr_F(\mathcal{E}_n, \Omega)) = eval_F(d_F, Gr_F(\mathcal{E}_n, eval_F(d_F, e))) \qquad (46) $$

Aggregation.

$$ eval_F(d_F, Agg) = eval_F(d_F, Agg_F(\mathcal{E}_n, AggFun_F, S, Gr_F)) = eval_F(d_F, Agg_F(\mathcal{E}_n, AggFun_F, S, eval_F(d_F, Gr_F))) \qquad (47) $$

Aggregate join.

$$ eval_F(d_F, AggJ) = eval_F(d_F, AggJ_F(\mathcal{A}\mathcal{E}_n)) = eval_F(d_F, AggJ_F(Agg_1, \dots, Agg_k)) \\ = eval_F(d_F, AggJ_F eval_F(d_F, Agg_1), \dots, eval_F(d_F, Agg_k))) \qquad (48) $$

### B.3.2 Condensed algebra semantics.

Quad pattern.

$$ eval_C(d_C, QP) = \left\{ \begin{array}{l} eval_C(d_C, QP_C(?s, ?p, ?o, ?ag)) = \begin{cases} [m \mid \exists t_g \exists V, m^c(?ag) = (t_g, V) \wedge d_C(m^t(?s), m^t(?p), m^t(?o), t_g) = V \wedge V \neq \emptyset] \\ \text{if } ?ag \neq ?s \vee ?ag \neq ?p \vee ?ag \neq ?o \end{cases} \\ [m \mid \exists t_g \exists v, m^t(?ag) = VI(v, t_g) \wedge v \in d_C(m^t(?s), m^t(?p), m^t(?o), t_g)] \\ \text{otherwise} \\ eval_C(d_C, QP_C(?s, ?p, ?o, ag)) = [m \mid \exists t_g \exists v, VI(v, t_g) = ag \wedge (m^t(?s), m^t(?p), m^t(?o), t_g, v) \in d_F] \quad \text{if ag is an IRI} \end{array} \right. \qquad (49) $$

Join.

$$ eval_C(d_C, \succ) = eval_C(d_C, \succ_C(e_1, e_2)) = \Omega \qquad (50) $$

$$ \mathcal{D}(\Omega) = [m \mid \exists m_1, \exists m_2, m_1 \in \Omega_1, m_2 \in \Omega_2, m = \vee_C(m_1, m_2)] $$

$$ \Omega(m) = \sum_{m_1 \in \mathcal{D}(\Omega_1), m_2 \in \mathcal{D}(\Omega_2), m = \vee_C(m_1, m_2)} \Omega_1(m_1) \times \Omega_2(m_2) $$

Union.

$$ eval_C(d_C, \cup) = eval_C(d_C, \cup_C(e_1, e_2)) = eval_C(d_C, e_1) \parallel eval_C(d_C, e_2) \qquad (51) $$

Filter.

$$ eval_C(d_C, \sigma) = eval_C(d_C, \sigma_C(\mathcal{E}, e)) = [m \mid m \in eval_C(d_C, e) \wedge eval_e(\mathcal{E}, m) \sim_{EBV} true] \qquad (52) $$

Difference.

$$ eval_C(d_C, \setminus) = eval_C(d_C, \setminus_C(e_1, e_2, e_3)) = \Omega \qquad (53) $$

$$ \mathcal{D}(\Omega) = [m_1 \mid m_1 \in \Omega_1, \forall m_2 \in \Omega_2, \Omega_1 = eval_C(d_C, e_1), \Omega_2 = eval_C(d_C, e_2), \left\{ \begin{array}{l} \neg(m_1 \sim_C m_2) \\ m_1 \sim_C m_2 \wedge eval_e(\{e_3\}, \vee_C(m_1, m_2)) \sim_{EBV} false \end{array} \right. ] \\ \Omega(m) = \setminus_C(\Omega_1, \Omega_2, e_3)(m) = \Omega_1(m) $$
Left outer join (optional).

$$
\mathrm{eval}_C(d_C, \triangleright) = \mathrm{eval}_C(d_C, \triangleright_C(e_1, e_2, e_3)) = \mathrm{eval}_C(d_C, \cup_C(\sigma_C(\{e_3\}, \triangleright_C(e_1, e_2)), \setminus_C(e_1, e_2, e_3))) \quad (54)
$$

Group by.

$$
\mathrm{eval}_C(d_C, \mathrm{Gr}) = \mathrm{eval}_C(d_C, \mathrm{Gr}_C(\mathcal{E}_n, \Omega)) = \mathrm{eval}_C(d_C, \mathrm{Gr}_C(\mathcal{E}_n, \mathrm{eval}_C(d_C, e))) \quad (55)
$$

Aggregation.

$$
\mathrm{eval}_C(d_C, \mathrm{Agg}) = \mathrm{eval}_C(d_C, \mathrm{Agg}_C(\mathcal{E}_n, \mathrm{Agg}_C(d_C, \mathrm{Gr}_C))) = \mathrm{eval}_C(d_C, \mathrm{Agg}_C(\mathcal{E}_n, \mathrm{Agg}_C(d_C, \mathrm{Gr}_C))) \quad (56)
$$

Aggregate join.

$$
\begin{align}
\mathrm{eval}_C(d_C, \mathrm{AggJ}) &= \mathrm{eval}_C(d_C, \mathrm{AggJ}(\mathcal{A}\mathcal{E}_n)) = \mathrm{eval}_C(d_C, \mathrm{AggJ}(\mathrm{Agg}_1, \dots, \mathrm{Agg}_k)) \tag{57} \\
&= \mathrm{eval}_C(d_C, \mathrm{AggJ}(\mathrm{eval}_C(d_C, \mathrm{Agg}_1), \dots, \mathrm{eval}_C(d_C, \mathrm{Agg}_k))) \nonumber
\end{align}
$$

B.3.3 Results equivalence.

CANONICAL REPRESENTATION OF AN EVALUATION. Let's use the condensed algebra $A_C = \tau(A_F)$ be the condensed algebra expression derived from a flat algebra expression $A_F$ after its translation. The lemma states: If $seq_F \cong eval_C(d_C, A_C)$ then $seq_F \cong eval_C(d_C, \downarrow_r (\Gamma, \Gamma')(A_C))$.

The proof proceeds by induction on the number of elementary variable representation transformations required to get from $\Gamma$ to $\Gamma'$. An elementary transformation changes the representation of a single variable to the next representation in the defined order $\psi <_r \zeta <_r \iota <_r \nu$.

**Base Case:** $\Gamma = \Gamma'$.
In this case, the number of transformations is 0. The environment transformation function $\downarrow_r(\Gamma, \Gamma')$ is the identity function when $\Gamma = \Gamma'$, because $\{\text{var} | \Gamma(\text{var}) \neq \Gamma'(\text{var})\} = \emptyset$. Thus, $\downarrow_r(\Gamma, \Gamma')(e) = e$. The lemma statement becomes: If $seq_F \cong eval_C(d_C, e)$ then $seq_F \cong eval_C(d_C, e)$, which is trivially true.

**Inductive Hypothesis (IH):** Assume that for any pair of environments $(\Gamma, \Gamma')$ such that $\Gamma <_r \Gamma'$ and the transformation $\downarrow_r(\Gamma, \Gamma')$ involves $k$ elementary steps, the lemma holds. That is, if $seq_F \cong eval_C(d_C, e)$, then $seq_F \cong eval_C(d_C, \downarrow_r(\Gamma, \Gamma')(e))$.

**Inductive Step:** Consider a transformation $\downarrow_r(\Gamma, \Gamma')$ that involves $k + 1$ elementary steps, where $\Gamma <_r \Gamma'$. We can decompose this transformation by identifying an intermediate environment $\Gamma_1$ such that $\Gamma <_r \Gamma_1 \leq_r \Gamma'$, where $\downarrow_r(\Gamma, \Gamma_1)$ represents a single elementary transformation (e.g., changing the representation of the variable $\text{var}_0$ from $\Gamma(\text{var}_0)$ to $\Gamma_1(\text{var}_0)$), and $\downarrow_r(\Gamma_1, \Gamma')$ involves $k$ elementary steps. Thus, $\downarrow_r(\Gamma, \Gamma')(e) = \downarrow_r(\Gamma_1, \Gamma')(\downarrow_r(\Gamma, \Gamma_1)(e))$.

Let $e_1 = \downarrow_r(\Gamma, \Gamma_1)(e)$. The evaluation $eval_C(d_C, e_1)$ produces a solution sequence that is equivalent to applying the type downgrade transformation $\downarrow_{\Gamma \to \Gamma_1}^{var_0}$ to the solution sequence resulting from $eval_C(d_C, e)$. Let $seq_C = eval_C(d_C, e)$ and $seq_{C1} = eval_C(d_C, e_1)$. By definition of the operator $\downarrow_r$ on expressions, $seq_{C1}$ is equivalent to $\downarrow_{\Gamma \to \Gamma_1}^{var_0}(seq_C)$ and $\downarrow_{\Gamma \to \Gamma_1}^{var_0}(seq_C) = \bigcirc_{m \in seq_C} (\downarrow_{\Gamma \to \Gamma_1}^{var_0}(m))$.

We get $seq_F \cong seq_C$. By Definition 4.45 (Flattening) and Definition 4.46 (Permutation), this means $seq_F$ is permutation-equivalent to $\cup_{m \in seq_C} \Xi(m)$.

We need to show that $seq_C \cong seq_{C1}$ in terms of their flat representation equivalence to $seq_F$. Here we use the fact that flattening a $m$ match gives the same set of flattened matches as if we first applied type reduction to $m(\text{var}_0)$ to get a set of (potentially multiple) mappings $\{m'\}$ (one for each value in $\tau_{\Gamma(\text{var}_0) \to \Gamma_1(\text{var}_0)}(m(\text{var}_0))$), and then flattening each $m'$ and taking their union.

That is: $\Xi(m) = \bigcup_{m' \in \downarrow_{\Gamma \to \Gamma_1}^{var_0}(m)} \Xi(m')$. Therefore, $\bigcup_{m \in seq_C} \Xi(m) = \bigcup_{m \in seq_C} \left( \bigcup_{m' \in \downarrow_{\Gamma(\text{var}_0) \to \Gamma_1(\text{var}_0)}^{var_0}(m)} \Xi(m') \right)$. This means $seq_F \cong seq_{C1}$.
So, $seq_F \cong eval_C(d_C, e_1)$.

We have $seq_F \cong eval_C(d_C, e_1)$, and $e_1 = \downarrow_r(\Gamma, \Gamma_1)(e)$. The remaining part of the transformation is $\downarrow_r(\Gamma_1, \Gamma')$, which involves $k$ elementary steps. By the IH (applied to $e_1$ with environments $\Gamma_1$ and $\Gamma'$): if $seq_F \cong eval_C(d_C, e_1)$, then $seq_F \cong eval_C(d_C, \downarrow_r(\Gamma_1, \Gamma')(e_1))$.

Since we have established that $seq_F \cong eval_C(d_C, e_1)$, we can conclude: $seq_F \cong eval_C(d_C, \downarrow_r(\Gamma_1, \Gamma')(e_1))$. Substituting $e_1 = \downarrow_r(\Gamma, \Gamma_1)(e)$, we get: $seq_F \cong eval_C(d_C, \downarrow_r(\Gamma_1, \Gamma')(\downarrow_r(\Gamma, \Gamma_1)(e)))$. By the compositional nature of $\downarrow_r$, this is equivalent to: $seq_F \cong eval_C(d_C, \downarrow_r(\Gamma, \Gamma')(e))$. This completes the inductive step. Therefore, by the principle of induction, the lemma holds for any transformation $\downarrow_r(\Gamma, \Gamma')$ where $\Gamma <_r \Gamma'$. $\square$

EVALUATION EQUIVALENCE. We want to prove $eval_F(d_F, A_F) \cong eval_C(d_C, \tau(A_F))$. Let's proceed with the proof by induction on the structure of SPARQL algebra operators.

**Base Case:** we want to show that $eval_F(d_F, QP_F(s, p, o, g)) \cong eval_C(d_C, \tau(QP_F(s, p, o, g)))$. We rewrite this formula by applying the $\tau$ function: $eval_F(d_F, QP_F(s, p, o, g)) \cong eval_C(d_C, QP_C(s, p, o, g))$.

Let $m_F \in eval_F(d_F, QP_F(s, p, o, g))$, by definition, there exists $(t_s, t_p, t_o, t_g, v) \in d_F$ such that: $m_F(s) = t_s, m_F(p) = t_p, m_F(o) = t_o, m_F(g) = V \setminus (v, t_g)$. We have $v \in d_C(t_s, t_p, t_o, t_g)$ then $(t_s, t_p, t_o, t_g) \in D(d_C)$. This means that $m \in eval_C(d_C, QP_C(s, p, o, g))$ such that $m'(s) = t_s, m'(p) = t_p, m'(o) = t_o$ and $m'(g) = (t_g, V)$ with $V = d_C(t_s, t_p, t_o, t_g)$.

Let $\mathrm{var} \in \mathcal{D}(m_F)$ then:

* if $var \in \{s, p, o\}$, $m_F(var) = m'(var) \wedge m'(var) \in v_m(var)$.

* if $var = g, m_F = V \setminus (v, t_g), v \in V \wedge m^\zeta(var) = (t_g, V)$ then $m_F(var) \in v_m(var)$ in addition, $D(m_F) = D(m^v) \cup D(m') \cup D(m^\zeta) \cup D(m^\psi)$. This means that $m_F \in \Xi(m)$.
**IH:** we now assume that the theorem holds for subexpressions and prove it for each SPARQL algebra operator.

**Inductive Step:** we want to show that $eval_F(d_F, e) \cong eval_C(d_C, \tau(e))$ for each operator $e$ in the SPARQL algebra. We will show that the theorem holds for each operator in the SPARQL algebra.

**Join operator:** we need to show that $eval_F(d_F, \triangleright_F (e_1, e_2)) \cong eval_C(d_C, \tau(\triangleright_F (e_1, e_2)))$. The rewriting of this formula is: $eval_F(d_F, \triangleright_F (e_1, e_2)) \cong eval_C(d_C, \tau(\triangleright_F (e_1, e_2)))$.

Let $m_F \in eval_F(d_F, \triangleright_F (e_1, e_2))$, $\exists m_{F1} \in eval_F(d_F, e_1)$, $\exists m_{F2} \in eval_F(d_F, e_2)$, with $m_F = \vee_F(m_{F1}, m_{F2})$. By the IH: $eval_F(d_F, e_1) \cong eval_C(d_C, \tau(e_1))$. So, $\exists m_1 \in eval_C(d_C, \tau(e_1))$, $m_{F1} \in \Xi(m_1)$.

It is given that $eval_F(d_F, e_2) \cong eval_C(d_C, \tau(e_2))$. So, $\exists m_2 \in eval_C(d_C, \tau(e_2))$, $m_{F2} \in \Xi(m_2)$. Since $m_F = \vee_F(m_{F1}, m_{F2})$, the variables common to $m_{F1}$ and $m_{F2}$ map to the same value in $m_F$.

If $m_{F1} \in \Xi(m_1)$ and $m_{F2} \in \Xi(m_2)$ and $m_{F1} \sim_F m_{F2}$, then it must be that $m_1 \sim_C m_2$ (compatibility in the condensed model holds if it holds in the flat model for the corresponding expanded mappings). Then, $m = \vee_C(m_1, m_2)$ (the merge in the condensed model) is defined.

Moreover, $m_F \in \Xi(m)$, since the merge operations in both models are consistent with respect to the flattening function $\Xi$. Thus, $m \in eval_C(d_C, \triangleright_C(\tau(e_1), \tau(e_2)))$, and then $eval_F(d_F, \triangleright_F (e_1, e_2)) \cong eval_C(d_C, \triangleright_C(\tau(e_1), \tau(e_2)))$.

**Union operator:** we want to show that $eval_F(d_F, \cup_F(e_1, e_2)) \cong eval_C(d_C, \tau(\cup_F(e_1, e_2)))$ We rewrite this formula: $eval_F(d_F, \cup_F(e_1, e_2)) \cong eval_C(d_C, \cup_C(\tau(e_1), \tau(e_2)))$.

Let $m_F \in eval_F(d_F, \cup_F(e_1, e_2))$. This implies that either $m_F \in eval_F(d_F, e_1)$ or $m_F \in eval_F(d_F, e_2)$.

* Case $m_F \in eval_F(d_F, e_1)$: By the IH, $eval_F(d_F, e_1) \cong eval_C(d_C, \tau(e_1))$. So, $\exists m_1 \in eval_C(d_C, \tau(e_1))$ such that $m_F \in \Xi(m_1)$. Since $m_1 \in eval_C(d_C, \tau(e_1))$, it is also true that: $m_1 \in eval_C(d_C, \cup_C(\tau(e_1), \tau(e_2)))$ by the definition of the union operator in the condensed algebra. Thus, $m_F \in \Xi(m_1) \Rightarrow m_F \in eval_C(d_C, \cup_C(\tau(e_1), \tau(e_2)))$.

* Case $m_F \in eval_F(d_F, e_2)$: By the IH, $eval_F(d_F, e_2) \cong eval_C(d_C, \tau(e_2))$. So, $\exists m_2 \in eval_C(d_C, \tau(e_2))$ such that $m_F \in \Xi(m_2)$. Since $m_2 \in eval_C(d_C, \tau(e_2))$, it is also true that: $m_2 \in eval_C(d_C, \cup_C(\tau(e_1), \tau(e_2)))$ by the definition of the union operator in the condensed algebra. Thus, $m_F \in \Xi(m_2) \Rightarrow m_F \in eval_C(d_C, \cup_C(\tau(e_1), \tau(e_2)))$.

We suppose $m \in eval_C(d_C, \cup_C(\tau(e_1), \tau(e_2)))$. Then, either $m \in eval_C(d_C, \tau(e_1))$ or $m \in eval_C(d_C, \tau(e_2))$.

If $m \in eval_C(d_C, \tau(e_1))$, then by IH, for any $m_F \in \Xi(m)$, we have $m_F \in eval_F(d_F, e_1)$, and $m_F \in eval_F(d_F, \cup_F(e_1, e_2))$. If $m \in eval_C(d_C, \tau(e_2))$, then by IH, for any $m_F \in \Xi(m)$, we have $m_F \in eval_F(d_F, e_2)$, and $m_F \in eval_F(d_F, \cup_F(e_1, e_2))$.

Then, $eval_F(d_F, \cup_F(e_1, e_2)) \cong eval_C(d_C, \cup_C(\tau(e_1), \tau(e_2)))$.

**Filter operator:** $eval_F(d_F, \sigma_F(\mathcal{E}, e)) \cong eval_C(d_C, \tau(\sigma_F(\mathcal{E}, e)))$ must be demonstrated. We rewrite this formula with the result of the $\tau$ function: $eval_F(d_F, \sigma_F(\mathcal{E}, e)) \cong eval_C(d_C, \sigma_F(\mathcal{E}, \tau(e)))$.

Let $m_F \in eval_F(d_F, \sigma_F(\mathcal{E}, e))$. By definition, this means $m_F \in eval_F(d_F, e)$ and $eval_e(\mathcal{E}, m_F) \sim_{EBV} true$. By the IH for the sub-expression $e$, $eval_F(d_F, e) \cong eval_C(d_C, \tau(e))$. So, there exists $m \in eval_C(d_C, \tau(e))$ such that $m_F \in \Xi(m)$.

Because the filter condition $\mathcal{E}$ depends only on the values of variables, and the flattening function $\Xi$ preserves these values (i.e., for any $m'$ represented by $m$, $eval_e(\mathcal{E}, m_F)$ is equal to $eval_e(\mathcal{E}, m')$ for the variables in $\mathcal{E}$), it follows that if $eval_e(\mathcal{E}, m_F) \sim_{EBV} true$, then $eval_e(\mathcal{E}, m) \sim_{EBV} true$ also holds.

Thus, $m$ will also satisfy the filter in the condensed algebra: $m \in eval_C(d_C, \sigma_C(\mathcal{E}, \tau(e)))$. This means that for every $m_F$ satisfying the filter in the flat model, there's a corresponding $m$ satisfying the filter in the condensed model, and $m_F \in \Xi(m)$.

Conversely, let $m \in eval_C(d_C, \sigma_C(\mathcal{E}, \tau(e)))$. This means $m \in eval_C(d_C, \tau(e))$ and $eval_e(\mathcal{E}, m) \sim_{EBV} true$. By IH, for any $m_F \in \Xi(m)$, we have $m_F \in eval_F(d_F, e)$. Since $eval_e(\mathcal{E}, m) \sim_{EBV} true$, and the values relevant to $\mathcal{E}$ are preserved by $\Xi$, it holds that $eval_e(\mathcal{E}, m_F) \sim_{EBV} true$. Then, $m_F \in eval_F(d_F, \sigma_F(\mathcal{E}, e))$. This establishes that $eval_F(d_F, \sigma_F(\mathcal{E}, e)) \cong eval_C(d_C, \sigma_C(\mathcal{E}, \tau(e)))$

**Diff operator:** $eval_F(d_F, \setminus_F(e_1, e_2, e_3)) \cong eval_C(d_C, \tau(\setminus_F(e_1, e_2, e_3)))$ must be demonstrated. We rewrite this formula with the result of the $\tau$ function: $eval_F(d_F, \setminus_F(e_1, e_2, e_3)) \cong eval_C(d_C, \setminus_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.

Let $m_F \in eval_F(d_F, \setminus_F(e_1, e_2, e_3))$. By definition, $m_F \in eval_F(d_F, e_1)$ and $\forall m'_F \in eval_F(d_F, e_2)$, either $m_F \sim_F m'_F$ does not hold, or if it does, then it must give $eval_e(\{e_3\}, \vee_F(m_F, m'_F)) \sim_{EBV} false$.

By the IH for $e_1$, $eval_F(d_F, e_1) \cong eval_C(d_C, \tau(e_1))$. So, there exists $m_1 \in eval_C(d_C, \tau(e_1))$ such that $m_F \in \Xi(m_1)$.

Also, by IH for $e_2$, $eval_F(d_F, e_2) \cong eval_C(d_C, \tau(e_2))$. So for every $m'_F \in eval_F(d_F, e_2)$, $\exists m_2 \in eval_C(d_C, \tau(e_2))$ such that $m'_F \in \Xi(m_2)$.

It remains to show that for $m_1, \forall m_2 \in eval_C(d_C, \tau(e_2))$, either $m_1 \sim_C m_2$ does not hold, or, if it does, then $eval_e(\{\tau(e_3)\}, \vee_C(m_1, m_2)) \sim_{EBV} false$ holds. Consider any $m_2 \in eval_C(d_C, \tau(e_2))$. For any $m'_F \in \Xi(m_2)$: if $\neg(m_F \sim_F m'_F)$ for all $m'_F \in \Xi(m_2)$, then it implies $\neg(m_1 \sim_C m_2)$. If there exists a $m'_F$ such that $m_F \sim_F m'_F$, then it must also hold that $eval_e(\{e_3\}, \vee_F(m_F, m'_F)) \sim_{EBV} false$. Because the compatibility and evaluation of $e_3$ are preserved between the flat and condensed models (as established in the previous proofs for Join and Filter), this entails that $eval_e(\{\tau(e_3)\}, \vee_C(m_1, m_2)) \sim_{EBV} false$. It follows that $m_1$ belongs to $eval_C(d_C, \setminus_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.

Conversely, let $m \in eval_C(d_C, \setminus_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.

This means $m \in eval_C(d_C, \tau(e_1))$ and $\forall m' \in eval_C(d_C, \tau(e_2))$, either $\neg(m \sim_C m')$ or $(m \sim_C m' \land eval_e(\{\tau(e_3)\}, \vee_C(m, m')) \sim_{EBV} false$.

Let $m_F \in \Xi(m)$. By IH, $m_F \in eval_F(d_F, e_1)$. Consider any $m'_F \in eval_F(d_F, e_2)$. By IH, there is a $m'' \in eval_C(d_C, \tau(e_2))$ such that $m'_F \in \Xi(m'')$.

If $\neg(m \sim_C m'')$, this implies $\forall m_*^* \in \Xi(m)$ and $m_*^{**} \in \Xi(m'')$, that $\neg(m_*^* \sim_F m_*^{**})$. Thus, $\neg(m_F \sim_F m'_F)$.

If $m \sim_C m''$ and $eval_e(\{\tau(e_3)\}, \vee_C(m, m'')) \sim_{EBV} false$, then for each corresponding pair of flat mappings $m_F \in \Xi(m)$ and $m'_F \in \Xi(m'')$, it follows that $m_F \sim_F m'_F$ and also $eval_e(\{e_3\}, \vee_F(m_F, m'_F)) \sim_{EBV} false$.

Therefore, $m_F \in eval_F(d_F, \setminus_F(e_1, e_2, e_3))$. Then, we proved that $eval_F(d_F, \setminus_F(e_1, e_2, e_3)) \cong eval_C(d_C, \setminus_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.
**Optional operator:** $eval_F(d_F, \succ_F(e_1, e_2, e_3)) \cong eval_C(d_C, \tau(\succ_F(e_1, e_2, e_3)))$ must be demonstrated. We rewrite this formula with the result of the $\tau$ function: $eval_F(d_F, \succ_F(e_1, e_2, e_3)) \cong eval_C(d_C, \succ_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.

Let $m_F \in eval_F(d_F, \succ_F(e_1, e_2, e_3))$. This implies, by definition, that $m_F \in eval_F(d_F, \cup_F(e, e'))$, where $e = \sigma_F(\{e_3\}, \succ_F(e_1, e_2))$ and $e' = \setminus_F(e_1, e_2, e_3)$. As a result, either $m_F \in eval_F(d_F, e)$ or $m_F \in eval_F(d_F, e')$.

* Case $m_F \in eval_F(d_F, e)$: by the IH applied to the Filter and Join operators, we have $eval_F(d_F, e) \cong eval_C(d_C, \tau(e))$. Therefore, there exists $m \in eval_C(d_C, \tau(e))$ such that $m_F \in \Xi(m)$. Since $\tau(e) = \sigma_C(\{\tau(e_3)\}, \succ_C(\tau(e_1), \tau(e_2)))$, it follows that $m \in eval_C(d_C, \tau(e))$. Thus, $m_F$ is included in $eval_C(d_C, \succ_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.

* Case $m_F \in eval_F(d_F, e')$: by IH applied to the Diff operator, $eval_F(d_F, e') \cong eval_C(d_C, \tau(e'))$. Therefore, there exists $m \in eval_C(d_C, \tau(e'))$ such that $m_F \in \Xi(m)$. Since $\tau(e') = \setminus_F(\tau(e_1), \tau(e_2), \tau(e_3))$, so $m \in eval_C(d_C, \cup_C(\tau(e), \tau(e')))$. Thus, $m_F$ is covered by $eval_C(d_C, \succ_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.

Conversely, let $m_C \in eval_C(d_C, \succ_C(\tau(e_1), \tau(e_2), \tau(e_3)))$. This implies $m_C \in eval_C(d_C, \cup_C(\tau(A_F), \tau(B_F)))$.

Thus, either $m_C \in eval_C(d_C, \tau(A_F))$ or $m_C \in eval_C(d_C, \tau(B_F))$.

* If $m_C \in eval_C(d_C, \tau(A_F))$: then for all $m_F \in \Xi(m_C)$, by IH, $m_F \in eval_F(d_F, A_F)$. Thus, $m_F \in eval_F(d_F, \cup_F(A_F, B_F))$, which means $m_F \in eval_F(d_F, \succ_F(e_1, e_2, e_3))$.

* If $m_C \in eval_C(d_C, \tau(B_F))$: then for all $m_F \in \Xi(m_C)$, by IH, $m_F \in eval_F(d_F, B_F)$. Thus, $m_F \in eval_F(d_F, \cup_F(A_F, B_F))$, which means $m_F \in eval_F(d_F, \succ_F(e_1, e_2, e_3))$.

Therefore, $eval_F(d_F, \succ_F(e_1, e_2, e_3)) \cong eval_C(d_C, \succ_C(\tau(e_1), \tau(e_2), \tau(e_3)))$.

**Group operator:** $eval_F(d_F, Gr_F(\mathcal{E}_n, e)) \cong eval_C(d_C, \tau(Gr_F(\mathcal{E}_n, e)))$ must be demonstrated. We rewrite this formula with the result of the $\tau$ function: $eval_F(d_F, Gr_F(\mathcal{E}_n, e)) \cong eval_C(d_C, Gr_C([\tau(e_1), \dots, \tau(e_n)], \tau(e)))$.

Let's consider a solution sequence $\Omega_F = eval_F(d_F, e)$ and its condensed equivalent $\Omega_C = eval_C(d_C, \tau(e))$. By the inductive hypothesis, we have $\Omega_F \cong \Omega_C$. This means that for every flat mapping $m_F \in \Omega_F$, there is a corresponding condensed mapping $m \in \Omega_C$ such that $m_F \in \Xi(m)$, and vice versa.

The Group operator partitions the solution sequence based on the values of the grouping expressions $\mathcal{E}_n$. In the flat model, the grouping is performed on $\Omega_F$, while in the condensed model, it is performed on $\Omega_C$. We need to show that the resulting grouped partitions are equivalent.

Let $G_F = Gr_F(\mathcal{E}_n, \Omega_F)$ and $G_C = Gr_C([\tau(e_1), \dots, \tau(e_n)], \Omega_C)$.

For any group key $k$ in the flat model, the corresponding group is $\{m_F \mid m_F \in \Omega_F \wedge eval_E(\mathcal{E}_n, m_F) = k\}$. In the condensed model, the group key is the same, and the group is $\{m \mid m \in \Omega_C \wedge eval_E([\tau(e_1), \dots, \tau(e_n)], m) = k\}$.

Since the evaluation of expressions is preserved between the flat and condensed mappings (as shown in Lemma 4.30), a flat mapping $m_F$ and its corresponding condensed mapping $m$ will produce the same group key $k$. Therefore, the set of flat mappings in a group in $G_F$ corresponds exactly to the set of flat mappings that can be generated from the condensed mappings in the corresponding group in $G_C$.

Thus, the grouped structures are equivalent, and the theorem holds for the Group operator.

**Aggregation operator:** We must demonstrate that: $eval_F(d_F, Agg_F(\mathcal{E}_n, AggFun_F, S, Gr_F)) \cong eval_C(d_C, \tau(Agg_F(\mathcal{E}_n, AggFun_F, S, Gr_F)))$. This can be rewritten using the translation function $\tau$ as: $eval_F(d_F, Agg_F(\mathcal{E}_n, AggFun_F, S, Gr_F)) \cong eval_C(d_C, Agg_C(\mathcal{E}_n, AggFun_C, S, Gr_C))$.

From the IH for the Group operator, we know that the grouped structures are equivalent: $eval_F(d_F, Gr_F) \cong eval_C(d_C, Gr_C)$.

Let $G_F$ and $G_C$ be the grouped solution sequences for the flat and condensed models, respectively. By the inductive hypothesis, for each group $g_F \in G_F$ defined by a key $k$, there is a corresponding group $g_C \in G_C$ for the same key $k$, such that $\cup_{m \in g_C} \Xi(m)$ is a permutation of $g_F$.

The flat aggregation function $AggFun_F$ is applied to each group $g_F$. The condensed aggregation function $AggFun_C$ is applied to each group $g_C$. We need to show that for each group, the result of the aggregation is the same.

For the COUNT aggregation, the flat model computes the number of mappings in $g_F$. In the condensed model, for each mapping $m \in g_C$, we compute $eval_ecard, m)$, which represents the number of flat mappings encoded by $m$. Summing $eval_e('card, m)$ over all $m \in g_C$ yields the same total as counting the mappings in $g_F$, ensuring equivalence between the two models.

For other aggregations like SUM, AVG, MIN, MAX, the values are extracted from the variables. Since the $\Xi$ function preserves the values of the variables, the set of values passed to the aggregation function is the same for both the flat and condensed models. For example, for each mapping $m_F \in g_F$, there's a corresponding $m \in g_C$ such that $m_F \in \Xi(m)$ and the values of the relevant variables are the same.

This equivalence is formally supported by the principles of rewriting queries with aggregation functions using views, as established in the paper by Sarah Cohen [5], which shows that aggregations over base data can be equivalently computed over pre-aggregated views.

Therefore, for any given group key, the aggregation results will be identical. Since this holds for all groups, the entire result of the aggregation operation is equivalent.

**Aggregate join operator:** We must demonstrate that $eval_F(d_F, AggJ_F(\mathcal{A}\mathcal{E}_n)) \cong eval_C(d_C, \tau(AggJ_F(\mathcal{A}\mathcal{E}_n)))$. This can be rewritten as: $eval_F(d_F, AggJ_F(AggF_1, \dots, AggF_k)) \cong eval_C(d_C, AggJ_C(\tau(AggF_1), \dots, \tau(AggF_k)))$.

The AggregateJoin operator, as per Definitions 4.35 and 4.41, combines the results from multiple aggregation operations based on their common group keys. From the proof for the Aggregation operator above, we have established that the result of each flat aggregation $Agg_{F_i}$ is equivalent to the result of its translated condensed counterpart $\tau(Agg_{F_i}) = Agg_{Ci}$. This means that for each aggregation, the set of key $\rightarrow$ val pairs produced by the flat evaluation is identical to the set produced by the condensed evaluation. Since both $Agg_{F_i}(\mathcal{A}\mathcal{E}_n)$ and
$AggJ_C(\mathcal{AE}_n)$ operate on an identical set of input pairs and perform the same function of joining these pairs by their keys, their final output must also be equivalent. Therefore, the theorem holds for the Aggregate Join operator. ☐

## B.4 Model - Space usage

B.4.1 *Space usage.* The tables below compare the storage requirements for Blazegraph, Jena TDB, QuaQue-flat and QuaQue-condensed implementations.

<figure><img src="image_8.png" /><figcaption>Figure 6: Comparison of space usage between condensed and flat representations for a non-evolutive dataset.</figcaption></figure>

<figure><img src="image_9.png" /><figcaption>Figure 7: Comparison of space usage between condensed and flat representations for a evolutive dataset.</figcaption></figure>
<figure><img src="image_10.png" /><figcaption>Figure 8: Comparison of space usage between condensed and flat representations for a highly evolutive dataset.</figcaption></figure>

## B.5 Dataset query

B.5.1 *Query time.* This section presents the results of dataset query performance across different systems and configurations. The tables below compare query execution times for both non-aggregative and aggregative queries, measured on Blazegraph, Jena TDB, QuaQue-flat, and QuaQue-condensed implementations. Metrics include the 75th percentile, 95th percentile, and median query times for varying dataset sizes and version counts, providing insight into the scalability and efficiency of each approach.

<table><caption>Table 11: Comparison of average times for non-aggregative queries across all components.</caption><thead><tr><th colspan="2">Configuration</th><th colspan="3">Blazegraph</th><th colspan="3">Jena TDB</th><th colspan="3">QuaQue-condensed</th><th colspan="3">QuaQue-flat</th></tr><tr><th>Step</th><th>Version</th><th>75th P.</th><th>95th P.</th><th>Median</th><th>75th P.</th><th>95th P.</th><th>Median</th><th>75th P.</th><th>95th P.</th><th>Median</th><th>75th P.</th><th>95th P.</th><th>Median</th></tr></thead><tbody><tr><td>0</td><td>5</td><td>86.30</td><td>121.40</td><td>69.40</td><td>83.33</td><td>104.81</td><td>71.40</td><td>75.30</td><td>98.47</td><td>59.85</td><td>64.20</td><td>101.57</td><td><strong>46.50</strong></td></tr><tr><td>0</td><td>20</td><td>79.75</td><td>106.26</td><td>66.65</td><td>101.70</td><td>130.23</td><td>88.35</td><td>116.55</td><td>141.84</td><td>100.35</td><td>70.40</td><td>90.86</td><td><strong>50.65</strong></td></tr><tr><td>0</td><td>50</td><td>114.28</td><td>143.27</td><td>91.40</td><td>188.93</td><td>222.07</td><td>170.65</td><td>197.40</td><td>224.91</td><td>180.30</td><td>56.88</td><td>76.23</td><td><strong>42.30</strong></td></tr><tr><td>0</td><td>100</td><td>174.43</td><td>215.38</td><td>153.00</td><td>233.60</td><td>277.34</td><td>218.35</td><td>330.38</td><td>357.05</td><td>307.80</td><td>74.50</td><td>115.66</td><td><strong>56.00</strong></td></tr><tr><td>5</td><td>5</td><td>94.00</td><td>139.58</td><td>69.60</td><td>86.55</td><td>121.19</td><td>72.20</td><td>131.90</td><td>163.56</td><td>109.55</td><td>57.27</td><td>82.99</td><td><strong>48.85</strong></td></tr><tr><td>5</td><td>20</td><td>241.60</td><td>283.02</td><td>220.25</td><td>326.52</td><td>369.75</td><td>289.05</td><td>457.15</td><td>496.12</td><td>429.40</td><td>79.03</td><td>124.72</td><td><strong>59.05</strong></td></tr><tr><td>5</td><td>50</td><td>933.20</td><td>1000.39</td><td>885.45</td><td>1341.42</td><td>1460.86</td><td>1283.75</td><td>1724.75</td><td>1844.65</td><td>1648.70</td><td>59.48</td><td>82.65</td><td><strong>44.10</strong></td></tr><tr><td>10</td><td>5</td><td>110.20</td><td>138.01</td><td>96.20</td><td>97.28</td><td>129.05</td><td>85.20</td><td>162.43</td><td>208.91</td><td>138.75</td><td>57.45</td><td>82.13</td><td><strong>43.15</strong></td></tr><tr><td>10</td><td>20</td><td>426.07</td><td>530.04</td><td>377.35</td><td>535.70</td><td>637.97</td><td>486.65</td><td>640.15</td><td>721.86</td><td>599.40</td><td>86.28</td><td>135.91</td><td><strong>65.20</strong></td></tr><tr><td>10</td><td>50</td><td>1889.95</td><td>1975.68</td><td>1826.15</td><td>2358.30</td><td>2497.15</td><td>2236.75</td><td>3056.75</td><td>3200.38</td><td>2893.05</td><td>65.20</td><td>91.95</td><td><strong>47.60</strong></td></tr></tbody></table>
<table><caption>Table 12: Comparison of average times for aggregative queries across all components.</caption><thead><tr><th colspan="2">Configuration</th><th colspan="3">Blazegraph</th><th colspan="3">Jena TDB</th><th colspan="3">QuaQue-condensed</th><th colspan="3">QuaQue-flat</th></tr><tr><th>Step</th><th>Version</th><th>75th P.</th><th>95th P.</th><th>Median</th><th>75th P.</th><th>95th P.</th><th>Median</th><th>75th P.</th><th>95th P.</th><th>Median</th><th>75th P.</th><th>95th P.</th><th>Median</th></tr></thead><tbody><tr><td>0</td><td>5</td><td>71.75</td><td>113.89</td><td>56.93</td><td>72.00</td><td>103.51</td><td>53.86</td><td>60.79</td><td>103.02</td><td><strong>45.36</strong></td><td>67.21</td><td>104.49</td><td>48.86</td></tr><tr><td>0</td><td>20</td><td>45.86</td><td>64.11</td><td><strong>41.50</strong></td><td>57.18</td><td>95.02</td><td>42.29</td><td>74.68</td><td>122.38</td><td>50.57</td><td>77.36</td><td>117.25</td><td>53.86</td></tr><tr><td>0</td><td>50</td><td>71.54</td><td>136.28</td><td>53.57</td><td>69.00</td><td>98.30</td><td>53.21</td><td>48.04</td><td>81.31</td><td><strong>37.00</strong></td><td>51.71</td><td>79.16</td><td>37.21</td></tr><tr><td>0</td><td>100</td><td>48.43</td><td>70.59</td><td><strong>41.71</strong></td><td>83.71</td><td>137.97</td><td>58.43</td><td>74.96</td><td>126.25</td><td>53.50</td><td>70.75</td><td>103.44</td><td>46.93</td></tr><tr><td>5</td><td>5</td><td>77.36</td><td>152.74</td><td>52.71</td><td>59.54</td><td>96.30</td><td><strong>42.07</strong></td><td>70.61</td><td>100.35</td><td>49.14</td><td>60.68</td><td>92.64</td><td>46.29</td></tr><tr><td>5</td><td>20</td><td>101.39</td><td>128.54</td><td>88.71</td><td>97.64</td><td>154.01</td><td>73.07</td><td>101.79</td><td>139.36</td><td>71.64</td><td>81.86</td><td>137.03</td><td><strong>56.57</strong></td></tr><tr><td>5</td><td>50</td><td>404.00</td><td>459.72</td><td>368.50</td><td>222.89</td><td>268.16</td><td>203.07</td><td>232.71</td><td>280.91</td><td>218.57</td><td>58.86</td><td>95.07</td><td><strong>44.93</strong></td></tr><tr><td>10</td><td>5</td><td>81.29</td><td>131.74</td><td>65.36</td><td>59.39</td><td>87.23</td><td>42.93</td><td>79.68</td><td>152.66</td><td>51.29</td><td>46.82</td><td>75.23</td><td><strong>34.43</strong></td></tr><tr><td>10</td><td>20</td><td>235.43</td><td>303.52</td><td>170.43</td><td>147.86</td><td>207.18</td><td>109.07</td><td>123.39</td><td>163.47</td><td>103.50</td><td>80.61</td><td>138.06</td><td><strong>53.36</strong></td></tr><tr><td>10</td><td>50</td><td>730.89</td><td>803.31</td><td>704.14</td><td>353.11</td><td>379.76</td><td>332.86</td><td>560.25</td><td>617.20</td><td>536.29</td><td>74.25</td><td>106.71</td><td><strong>63.79</strong></td></tr></tbody></table>