---
title: Functional Data Model (FDM)
url: https://www.emergentmind.com/topics/functional-data-model-fdm
type: topic
---

# Functional Data Model (FDM)

Functional Data Model (FDM) denotes, in the 2025 database proposal of “A Functional Data Model and Query Language is All You Need,” a mathematical data model in which everything that is normally treated as data is represented as a function: a tuple is a function, a relation is a higher-order function returning tuple-functions, a database is a higher-order function returning relation-functions, and a set of databases is again a function. On this basis, the associated Functional Query Language (FQL) is defined as an algebra of higher-order functions over data-functions, with the stated aim of removing the conceptual boundary between tuples, relations, databases, stored versus computed data, and query language versus programming language [2507.20671].

## 1. Formal definition and ontological commitments

The defining primitive of the model is the standard mathematical notion of function:
\[
\text{A function } f:X\to Y \text{ assigns to each element of } X \text{ exactly one element of } Y.
\]
A higher-order function is one whose domain or codomain is itself a set of functions. FDM applies this abstraction uniformly at every level of data representation. The central claim is therefore not merely that some attributes may be functional, but that tuples, relations, databases, and relationships are all instances of the same underlying construct [2507.20671].

This uniformity has several direct consequences. First, the traditional boundary between tuples, relations, and databases disappears: they are functions at different levels. Second, the boundary between stored and computed data disappears: attribute values, tuples, relations, and even databases may be computed rather than statically stored. Third, constraints such as keys, foreign keys, uniqueness, and indexes are expressed through domains, codomains, and typing rather than being treated as external add-ons.

The proposal is explicitly positioned as a mathematical model rather than a concrete physical representation. The paper distinguishes the conceptual model from what it calls a separate “physiological design” step, where an FDM may be mapped to a relational, key-value, JSON, or other physical store. This separation is significant because it places FDM at the level of semantic abstraction rather than storage format.

Historically, the terms “Functional Data Model” and “Functional Query Language” appeared in the late 1970s and 1980s in work associated with Shipman, Buneman, Atkinson, Gray, and others. The 2025 proposal distinguishes itself from those earlier models by strictly treating tuples, relations, and databases all as functions, by insisting that the model is only mathematical, and by designing the query language to be embedded as programming-language functions rather than as a separate textual language [2507.20671].

## 2. Functional representation of tuples, relations, databases, and relationships

A tuple is modeled as a function from attribute names to attribute values. A canonical example is
\[
t_1(attr:\text{string}) := \{(\text{`name'}:\text{`Alice'}), (\text{`foo'}:12)\},
\]
with lookup realized as function application, such as \(t_1(\text{`foo'}) = 12\). The model explicitly allows computed tuple functions. For example,
\[
t(attr:\text{string}) := \begin{cases}
42 \cdot t_1(\text{`foo'}), & \text{if } attr = \text{`bar'},\\
t_1(attr), & \text{otherwise.}
\end{cases}
\]
Here the derived attribute `bar` is part of the same data model as stored attributes, rather than belonging to a separate layer of views or computed fields [2507.20671].

Tuple functions may also be higher-order. An attribute can return another tuple function or a relation function. The example
\[
t_3(attr) := \{\text{`name'}:\text{`Bob'},\ \text{`foo'}: t_1\}
\]
makes `foo` return a tuple function. The paper notes that this violates 1NF but is fully admissible in FDM. The absence of any 1NF requirement is foundational for the model’s treatment of nesting.

A relation is a higher-order function from key values to tuple functions. If
\[
R1(bar:\text{int}) := t_{\text{bar}},
\]
then \(R1(1)=t_1\) and \(R1(3)=t_3\), while inputs outside the domain are undefined. Domains may be constrained explicitly, for example by
\[
R(bar:X)\ \text{where } X = \{1,3\} \cap \mathbb{N}^+
\]
or by interval-and-predicate constraints such as
\[
R(bar:X)\ \text{where } X = [7;12] \cap \mathbb{R}^+.
\]
In this scheme, typing and integrity constraints are expressed directly in the function signature.

Uniqueness follows from ordinary function semantics. If a relation function is defined on `foo`,
\[
R2(\text{foo}:\text{int}) := t_{\text{foo}},
\]
then a uniqueness constraint on `foo` is implicit because each input can map to at most one tuple function. To admit duplicates, the codomain is lifted to sets of tuple functions. The paper interprets this as conceptually matching an index on a non-unique column in relational DBMSs, but makes it intrinsic to the model rather than a physical implementation detail.

Relations may be partially or fully computed. In the example
\[
R4(bar:\text{int}) := \begin{cases}
t_{\text{bar}}, & \text{if } bar \in \{1,3\},\\
\lambda bar.\{(\text{`name'}: \text{rndStr}(seed=bar)),\ (\text{`foo'}: 42\cdot bar)\}, & \text{otherwise,}
\end{cases}
\]
stored and generated tuples coexist under one relation function. Evaluations such as \(R4(10)(\text{`foo'}) = 420\) and \(R4(3)(\text{`foo'}) = 25\) illustrate the same point.

A database is a function from relation names to relation functions. The example
```text
DB(rel_name:string) := {
  ('myTab': t_4),
  ('Table1': R1),
  ('Table2': R2)
}.
```
shows that `DB("Table1")` returns `R1`. As with lower levels, database functions may also return computed relation functions.

FDM also models relationships as functions. Given \(k\) functions \(F_1,\dots,F_k\) with domains \(X_1,\dots,X_k\), a relationship is represented as
\[
\mathrm{RF}(X_1,\ldots,X_k) \mapsto Y_{\mathrm{RF}},
\]
and if \(Y_{\mathrm{RF}} = bool\), the result is a relationship predicate. In the paper’s example, an ER-style schema with `customers(cid)`, `products(pid)`, and `order(cid, pid)` is modeled by relation functions for entities and a relationship function for `order`. Foreign-key semantics are obtained from shared domains rather than separate FK declarations. The paper further states that relationships can be defined between anything that is a function, including between a database and a relation, as in `is_accessed(DB, users)` [2507.20671].

## 3. FQL as a higher-order function algebra embedded in programming languages

An FQL operator is defined as a higher-order function
\[
Op(f_{\text{in}}) \mapsto f_{\text{out}},
\]
where both input and output are FDM functions. The paper describes the FQL algebra as consisting of FDM functions as operands, FQL functions as operators, and rules for combining them through nested operators. Although FQL is given a functional reading, the evaluation order is not fixed by syntactic nesting; both declarative and functional interpretations are allowed, and the optimizer may reorder operations [2507.20671].

This definition sharply distinguishes FQL from classical relational algebra. Relational algebra operators such as \(\pi,\sigma,\bowtie,\cup,\times\) are defined over relations and produce one relation. FQL operators can act on functions representing tuples, relations, databases, or sets of databases, and can return arbitrary functions rather than a single relation schema. The paper gives as examples a `group` operator producing a database of relation functions and a `reduce_DB` operator consuming a subdatabase.

A central design choice is that FQL is intended to be embedded into host programming languages. The host language syntax is described as the “costume” of the FQL operator. In the Python examples, all of the following are treated as conceptually the same FQL operator:

```python
customers: RelationF = DB('customers')
customers_42: RelationF = filter(lambda prof: prof("age") > 42, customers)
customers_42: RelationF = filter(lambda prof: prof.age > 42, customers)
customers_42: RelationF = filter(age__gt=42, customers)
from operators import *
customers_42: RelationF = filter(att='age', op=gt, c=42, customers)
customers_42: RelationF = filter("age>$foo", {foo: 42}, customers)
```

The paper emphasizes several consequences. FQL does not introduce its own separate textual language. Queries are ordinary function calls in the host programming language. The programming-language compiler or runtime may push down parts of the function composition into the DBMS. Because queries are not assembled as concatenated SQL fragments, SQL injection is said to be impossible “by design.” More broadly, the proposal states that “both QL and PL become the same thing,” so that the distinction between query language and programming language disappears at the conceptual level [2507.20671].

This embedding claim is also the basis for what the paper calls holistic optimization opportunities between compilers and databases. A plausible implication is that optimization is no longer confined to a DBMS algebra alone, but may span mixed database and host-language computation, provided the system can reason over the shared function representation.

## 4. Expressiveness, subdatabase operations, aggregation, and updates

The expressiveness claim rests on the assertion that, because everything is a function, FDM naturally supports nested data, hierarchies and graphs, and higher-order structures. The example
```text
t_5(attr) := { 'name':'Tom', 'foo': R }
```
makes attribute `foo` return a relation function `R`. The same query constructs are said to apply whether a component is a tuple, relation, or database [2507.20671].

FQL can operate over entire databases rather than only over relations. The paper’s example of building a subdatabase is

```python
relations: list[string] = ['order', 'products']
subdatabase: DBF = filter(lambda kv: kv[0] in relations, DB)
subdatabase.customers = filter(state='NY', DB.customers)
subdatabase_reduced: DBF = reduce_DB(subdatabase)
```

The resulting subdatabase can then be joined:
```python
join_result: RF = join(subdatabase)
join_result: RF = join(
    subdatabase,
    on=[
      [customers.id, order.c_id],
      [order.p_id, products.id]
    ]
)
```
The paper explicitly notes that such a join may be executed as arbitrary \(n\)-ary joins, and that the optimizer is not forced into a binary join tree.

Grouping and aggregation can similarly return multiple results or even databases of groups. A multi-step example is
```python
groups: DBF = group(lambda prof: prof.age, customers)
aggregates: RelationF = aggregate(count=Count(), groups)
large_groups: RelationF = filter(lambda g: g.count > 9, aggregates)
```
and a fused variant is
```python
aggregated_ages: DBF = group_and_aggregate(by=["age"], count=Count(), input=customers)
large_groups: RelationF = filter(lambda g: g.age > 9, aggregated_ages)
```
For grouping sets and rollups, the paper proposes distinct relation functions per grouping level rather than one relation padded with `NULL`s:
```python
gset: DBF = group_and_aggregate(
  {
    (by:["age"],        count:Count(), name: "age_cc"),
    (by:["age","name"], count:Count(), name: "age_name_cc"),
    (by:[],             min:Min(),     name: "global_min")
  },
  input=customers
)
RFx, RFy, RFz = gset.age_c, gset.age_name_c, gset.global_min
```

A distinctive feature of the model is that queries and updates are expressed in the same function algebra. The paper differentiates between out-of-place use, which yields a new function corresponding to a read-only view or a snapshot, and in-place use, where the resulting function replaces a function inside the FDM. Examples include
\[
DB(\text{`otherRel'}) := MyRel
\]
and
\[
DB(\text{`myAwesomeView'}) := foo,
\qquad
DB(\text{`myAwesomeMaterializedView'}) := \text{copy}(foo).
\]
At the host-language level, tuple-level updates are ordinary assignments or deletions:
```python
customers: RelationF = DB.customers
customers[3] = {'name':'Tom', 'age': 42}
customers.add({'name':'Stephen', 'age': 28})
customers[3]['age'] = 50
del customers[3]
```
Transactions are expressed similarly:
```python
begin()
accounts: RelationF = DB.accounts
accounts[42]['balance'] -= 100
accounts[84]['balance'] += 100
commit()
```
The semantics is described as “transactional snapshot,” with snapshots configurable at transaction or statement granularity.

Set operations generalize to entire databases:
```python
DB_copy: DBF = deep_copy(DB)
DB_diff: DBF = difference(DB, DB_copy)
DB_intersect: DBF = intersect(DB, DB_copy)
DB_minus, DB_union = minus(DB, DB_copy), union(DB, DB_copy)
```
This extends `UNION`, `INTERSECT`, and related ideas from relations to full database snapshots [2507.20671].

## 5. Claimed resolution of SQL and relational-model pathologies

The proposal explicitly aims to solve “(almost if not) all problems of SQL,” naming `NULL-values`, impedance mismatch, SQL injection, and missing querying capabilities for updates. Its treatment of `NULL` is not presented as a full formal replacement for SQL’s three-valued logic, but several design directions are specified. Missing attributes or absent mappings are handled as partial functions or domain constraints rather than as special null markers. Multi-semantics outputs, such as grouping sets or outer joins, are represented as separate functions or relations rather than as a single relation padded with `NULL`s [2507.20671].

For outer joins, the example is:
```python
subDB: DBF = subdatabase(outer='products', subdatabase)
products_unsold: RF = subDB.products.outer
products_sold: RF = subDB.products.inner
```
The paper’s point is that inner and outer parts are separated as distinct relation functions, so `NULL` is not used to encode heterogeneous row semantics.

Impedance mismatch is addressed through language embedding. Because FQL consists of typed functions in the host language, there is no special query language embedded through strings, and types are taken from the host language’s own type system, such as Python type hints or Rust types. The paper presents this as removing the classical mismatch that led to ORMs: one does not map between objects and rows, but works directly with functions that behave like structured language-level objects.

SQL injection is treated as a consequence of the separate textual SQL layer. Since predicates and queries are structured programming-language code or structured predicate-plus-parameter objects rather than concatenated SQL fragments, the proposal states that SQL injection is impossible “by design.” Even in the string-predicate variant, parameters are not concatenated into SQL but may be treated as typed values distinct from the predicate template.

The paper also contrasts SQL’s relatively powerful `SELECT` with weaker `INSERT`, `UPDATE`, and `DELETE`, arguing that SQL update operations are limited to tuple-level effects within one relation and have restricted interaction with views. FQL instead uses one compositional function algebra for both reading and writing. Transformations over whole relations or entire databases are therefore described in the same style as queries.

These claims are programmatic rather than experimentally validated. This suggests that the proposal should be read as a conceptual unification of data modeling, querying, and transformation, not as a completed implementation benchmark. The paper itself states that it is a vision piece and does not provide a formal cost model, a detailed optimizer, or a complete language specification [2507.20671].

## 6. Terminological ambiguity, related models, and open questions

The acronym “FDM” is substantially overloaded in contemporary technical literature. In the database paper, it means Functional Data Model [2507.20671]. In structural form-finding, “JAX FDM” uses FDM to mean the Force Density Method of Schek (1974), implemented as a differentiable forward solver for inverse form-finding [2307.12407]. In high-dimensional functional statistics, “functional data model” can refer to a factor-augmented smoothing model in which observed curves are modeled as a smooth function plus a high-dimensional factor component [2102.02580]; closely related terminology appears again in “Factor-augmented model for functional data” [2203.04602]. In asymptotic statistics, “FDM” may mean the Functional Delta Method, including the modified version based on quasi-Hadamard differentiability and weighted empirical processes [1207.5899].

| Usage of “FDM” | Meaning | Example paper |
|---|---|---|
| Database theory | Functional Data Model | [2507.20671] |
| Structural mechanics | Force Density Method | [2307.12407] |
| Functional statistics | Functional data model / factor-augmented smoothing model | [2102.02580] |
| Asymptotic statistics | Functional Delta Method | [1207.5899] |

Within database theory, the 2025 proposal positions itself relative to several neighboring models. It is said to differ from earlier functional data models of the 1970s and 1980s, to contrast with Rel by discarding the set-of-tuples abstraction in favor of functions throughout, and to diverge from SQL++ and JSON-relational duality by unifying everything under functions rather than by mixing model and syntax. It is also contrasted with ER-based query languages from the 1980s, which are described as less expressive because FDM can define relationships between arbitrary functions, including database-to-relation relationships. ORM-based approaches are described as retaining SQL and programming languages as separate worlds, whereas FDM/FQL attempts to collapse them into a single abstraction [2507.20671].

The paper also states several limitations and open questions. It provides no full language specification for FQL; operators are illustrated through examples rather than formally enumerated. It gives no formal type system beyond reusing host programming-language types together with domain and codomain constraints. It does not establish complexity bounds or an expressiveness classification relative to relational algebra, Datalog, or monad comprehensions. No implementation or optimizer is detailed, and the treatment of missingness, partiality, and `NULL` semantics is incomplete. The author identifies future work as including a full implementation of FQL and programming-language integration, exploration of the joint optimization space, and extension of the repertoire of FQL operators beyond SQL [2507.20671].

Taken together, these features define the Functional Data Model, in the 2025 sense, as a mathematically uniform, function-centric alternative to the relational model in which tuples, relations, databases, constraints, relationships, queries, and updates are all expressed through higher-order functions. The proposal’s importance lies less in a finished system than in the claim that a database model, a query language, and a host programming language can be collapsed into one typed functional abstraction.

Source: https://www.emergentmind.com/topics/functional-data-model-fdm