This page exists as an easy reference to compare and contrast the available open source Clojure-Datalog databases. Only databases under active development are listed.
Datalog is a logic programming language and a subset of the earlier Prolog1. The language is interesting as it can be used as a data query language akin to SQL with some important additional capabilities such as recursive queries. It is also expressive enough to allow for its use as an entailment mechanism for ontology languages such as the Web Ontology Language (OWL)2 and the Semantic Web.
The specific language that may be represented by the DATALOG-TEXT grammar includes typed attributes and functional dependencies for relations, negated and arithmetic literals, disjunction in rule heads, and constraint rules. With the exception of required support for typed attributes the other language features are opt-in using pragmas.
Modern IT systems manage an increasing amount of data, sometimes bound by sophisticated models, that require specific representations of the same information in order to perform translation between various software layers
As consequence, software developers have to provide descriptions in data and constraints/relations of these systems, this is what we call data-models
Not all the data-models are the same, one criteria we can use to differentiate them is the kind of relationships between the objects
- Models with one-to-many relationship ( aka "tree-like" )
- Models with many-to-many relationship ( aka "graph-like" )
The one-to-many relationship can be modelled using a tree structure which can be easily represented using the JSON data language
On the other hand, representing many-to-many relationships leads to design decisions in how to represent the data : in other words, a conditional expression of some edges and vertices.
Tree vs Graph
Thus, the technical choices made on the data modelling aspect of software design will affect the system behaviour, its overall performances, as well as the efficiency of the tools that support it.
Datalog is a declarative logic programming language that is a syntactic subset of Prolog. While SQL is designed for querying and manipulating tabular databases, Datalog excels at querying graphs, performing deductive inference, and executing complex recursive algorithms.
A Datalog program consists of two main parts:
- EDB (Extensional Database): The raw data or "facts". Similar to rows in a SQL table.
- IDB (Intensional Database): The logical "rules". Similar to SQL Views, but they can be highly recursive and call each other dynamically.
This topic documents the data format for Datomic datalog queries and rules. If you want to follow along at a REPL, most of the examples on this page work use the mbrainz-subset database and are in the Day of Datomic Cloud repository.