# The Context Model: A Graph Database Model

In the relational model a relation over a set of attributes is defined to be a (finite) subset of the Cartesian product of the attribute domains, separately from the functional dependencies that the relation must satisfy in order to be consistent. In this paper we propose to include the functional dependencies in the definition of a relation by introducing a data model based on a graph in which the nodes are attributes, or Cartesian products of attributes, and the edges are the functional dependencies. Such a graph actually represents the datasets of an application and their relationships, so we call it an application context or simply context. We define a database over a context 𝒞 to be a function δ that associates each node X of 𝒞 with a finite set of values δ(X) from the domain of X and each edge e: X → Y with a total function δ(e): δ(X) →δ(Y). We combine the nodes and edges of a context using a functional algebra in order to define queries; and the set of all well-formed expressions of this algebra is the query language of the context. A relation over attributes A_1, …, A_n is then defined as a query whose paths form a tree with leaves A_1, …, A_n and whose root is the key. The main contributions of this paper are as follows: (a) we introduce a novel graph database model, called the context model, (b) we show that a consistent relational database can be embedded in the context model as a view over the context induced by its functional dependencies, (c) we define analytic queries in the query language of a context in a seamless manner - in contrast to the relational model where analytic queries are defined outside the relational algebra, and (d) we show that the context model can be used as a user-friendly interface to a relational database for data analysis purposes.

READ FULL TEXT