Skip to content

Get Logical with Datalog

stuarthalloway edited this page Feb 20, 2013 · 2 revisions

Abstract

Logic programming delivers great expressive power: you work in domain abstractions, and your program figures out execution details. And it has never been easier. With the Datalog engine in Datomic Free, you can work both with databases and with your own data in plain Java collections.

Datalog queries have the expressive power of SQL + recursion, so is a good fit for systems that want "the power of SQL" but e.g. more flexibility. When combined with a universal schema, Datalog is particularly easy to learn and to read.

Datomic's datalog implementation works with immutable database values, providing additional benefits:

  • decompose a query into multiple steps without compromising performance or correctness
  • perform logic and navigation as separate steps, using the entity API
  • join across 2 or more databases
  • query past values of the database
  • perform cross-temporal queries of different versions of your data

In this talk you will learn

  • the basics of writing datalog programs
  • the difference between datalog and prolog
  • how to create reusable abstractions with datalog rules
  • how to extend datalog with your own functions and predicates
  • querying databases
  • joining across multiple databases
  • using datalog with your own data
  • decomposing queries into logic and navigation
  • time travel

On the Web

Clone this wiki locally