5 ms·
How does datalog the pure prolog subset store its data?
by turminal 4y ago
How does datalog the pure prolog subset store its data?
- maweki 4y agoUsually you'd have a set-like storage of n-tuples/structs per relation, as a row/tuple of a relation has fixed arity. Tree-sets of rows, for example. But you could just use SQL tables as a storage engine with one table per datalog relation.
- emmanueloga_ 4y agoSWI Prolog's RDF store is implemented as a C extension. There's a description of the details here [1]. Apparently, it uses skip-lists for indexes. As a curiosity... I implemented a very simple toy triplestore in Kotlin that used AVL TreeSets. [2] (only the storage layer, it has no other querying than a simple for-loop like mechanism :-) ). 1: https://github.com/SWI-Prolog/packages-semweb/blob/master/doc/rdfdb.md https://github.com/SWI-Prolog/packages-semweb/blob/master/do... 2: https://gist.github.com/EmmanuelOga/1d52adb79bdb6092fb698ed5b31fa377 https://gist.github.com/EmmanuelOga/1d52adb79bdb6092fb698ed5...
- stonemetal12 4y agoDatalog is a query language similar to SQL. It doesn't store data. Some database would store data however it likes then provide a datalog query interface.
- triska 4y agoDatalog also lets you define facts and rules, in addition to posting queries. A key attraction of Datalog is that the same simple and very uniform syntax is used in all cases. All these cases are special cases of a single unifying language element called Horn clauses, which are clauses with at most one positive literal: Queries have no positive literal, rules have exactly one positive literal and at least one negative literal, and facts consist of a single positive literal.