Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Datalog and LogiQL?

The LogicBlox database is programmed using the LogiQL language, which is according to their site some sort of variant of Datalog:

Applications are written using the LogiQL language, an extended version of Datalog

What exactly are the differences between Datalog and LogiQL?

like image 887
Nanne Avatar asked Oct 17 '13 09:10

Nanne


3 Answers

LogiQL is indeed a superset of Datalog, adding various features, including:

  • Transaction support
  • An extensional database where facts can be dynamically inserted and removed (i.e. the set of facts is not "static")
  • Entities
  • Aggregations
  • Delta logic to update the extensional database
  • Pulse predicates whose facts are only kept during the lifetime of a transaction
  • Modules, for large-scale application development
  • Support for machine learning and optimization

There's probably more that I'm forgetting.

like image 112
Zef Hemel Avatar answered Oct 13 '22 22:10

Zef Hemel


LogiQL is very much a superset of Datalog. Originally it was simply referred to internally at LogicBlox as "Datalog". Very much like other implementations of Datalog, there were additions unique to the LogicBlox flavor. At some point the language grew much more extensive, with so many new added features, that it was decided to rename it to "LogiQL" instead. But LogiQL is still LogicBlox's unique flavor and superset of Datalog.

like image 2
lennartcl Avatar answered Oct 13 '22 22:10

lennartcl


Indeed, the "academic" version of Datalog used for studying database theory is purposefully limited. Each "industrial" variant of Datalog adds its own extensions to support programming real applications. In addition to the things Zef listed, some other features LogiQL supports are

  • Useful primitive types such as datetime, int, string -- types that have infinite number of values
  • Operations over primitive types, e.g. datetime functions for getting the time now, parsing time, numeric comparisons, numeric functions such as addition or generating random numbers, etc. All the stuff you really need to build real applications, but can make the theory rather nasty if you studied it academically, and thus left out of the academic version of Datalog
  • Ability to construct new entities
  • Negation. Currently LogiQL supports globally stratified negation, meaning if a predicate A is defined by negating over predicate B, then predicate B's definition cannot also, transitively, negate over predicate A.
like image 4
Shan Shan Huang Avatar answered Oct 13 '22 21:10

Shan Shan Huang