tiny-datalog 0.3.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {tiny_datalog-0.3.0/tiny_datalog.egg-info → tiny_datalog-0.5.0}/PKG-INFO +63 -25
  2. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/README.md +61 -23
  3. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/pyproject.toml +3 -2
  4. tiny_datalog-0.5.0/tiny_datalog/__init__.py +49 -0
  5. tiny_datalog-0.5.0/tiny_datalog/chase.py +397 -0
  6. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/containment.py +51 -62
  7. tiny_datalog-0.5.0/tiny_datalog/core.py +786 -0
  8. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/datalog.py +232 -812
  9. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/defeasible.py +13 -16
  10. tiny_datalog-0.5.0/tiny_datalog/engines.py +126 -0
  11. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/incremental.py +86 -89
  12. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/magic.py +5 -4
  13. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/prolog.py +12 -24
  14. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/semantics.py +23 -48
  15. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/semiring.py +13 -20
  16. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/subsumption.py +19 -22
  17. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog/tabling.py +19 -35
  18. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0/tiny_datalog.egg-info}/PKG-INFO +63 -25
  19. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog.egg-info/SOURCES.txt +3 -0
  20. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog.egg-info/entry_points.txt +1 -0
  21. tiny_datalog-0.3.0/tiny_datalog/__init__.py +0 -43
  22. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/LICENSE +0 -0
  23. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/setup.cfg +0 -0
  24. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog.egg-info/dependency_links.txt +0 -0
  25. {tiny_datalog-0.3.0 → tiny_datalog-0.5.0}/tiny_datalog.egg-info/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tiny-datalog
3
- Version: 0.3.0
4
- Summary: A Datalog engine small enough to read in an afternoon
3
+ Version: 0.5.0
4
+ Summary: A Datalog engine whose core you can read in an afternoon, and a course built on it
5
5
  Author: Andrew Goodchild
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/andrewgoodchild/tiny-datalog
@@ -36,8 +36,9 @@ Dynamic: license-file
36
36
  [![tests](https://github.com/andrewgoodchild/tiny-datalog/actions/workflows/ci.yml/badge.svg)](https://github.com/andrewgoodchild/tiny-datalog/actions/workflows/ci.yml)
37
37
  [![PyPI](https://img.shields.io/pypi/v/tiny-datalog)](https://pypi.org/project/tiny-datalog/)
38
38
 
39
- **A logic engine small enough to read in an afternoon, and a course
40
- that builds it up from nothing.**
39
+ **A Datalog engine whose core you can read in an afternoon, a course
40
+ that builds it up from nothing, and a module for every technique the
41
+ course teaches.**
41
42
 
42
43
  ## What is Datalog?
43
44
 
@@ -126,7 +127,7 @@ Nothing to install:
126
127
 
127
128
  ```sh
128
129
  git clone https://github.com/andrewgoodchild/tiny-datalog && cd tiny-datalog
129
- python3 tests.py # 254 tests, ~12s
130
+ python3 tests.py # 326 tests, ~12s
130
131
  ```
131
132
 
132
133
  ## Why the language choice decides what you can ask later
@@ -193,7 +194,7 @@ the better tool, and that covers most problems.
193
194
 
194
195
  ## What else you can ask it
195
196
 
196
- The worked example above is one row of a table. The full version — 20
197
+ The worked example above is one row of a table. The full version — 23
197
198
  questions, each with the command that answers it and the lesson that
198
199
  builds the machinery — is in
199
200
  [getting started](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/getting-started.md), beside the reading
@@ -248,8 +249,12 @@ the current research threads. The field's own recent lecture notes
248
249
  observe that the literature advises people building Datalog engines
249
250
  better than people trying to *use* one; this course does both halves
250
251
  on purpose — sixteen lessons where the engine is the explanation, then
251
- a lesson on authoring rules that survive review, and one on a logic
252
- built for rules with exceptions. And it is built to be
252
+ a lesson on authoring rules that survive review, one on a logic
253
+ built for rules with exceptions, and three where the engine goes to
254
+ work: [authorization](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/20-authorization.md),
255
+ [program analysis](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/21-program-analysis.md),
256
+ and [knowledge graphs and the chase](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/22-knowledge-graphs.md).
257
+ And it is built to be
253
258
  inherited: `git clone`, no dependencies, no hosted anything, and every
254
259
  quoted transcript re-verified by CI — the exercises cannot rot. (For where each
255
260
  technique ships — CodeQL, RDFox, Feldera, SNOMED and the rest —
@@ -272,7 +277,7 @@ engine:
272
277
  which is a real design-review question with a real answer.
273
278
  - **[Lesson 16](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/16-containment.md)** shows that the containment
274
279
  test you need for query minimisation is the search already sitting in
275
- `datalog.py`: `_match` maps a rule body into a database,
280
+ the core: `match` maps a rule body into a database,
276
281
  `find_homomorphism` maps a rule body into another rule body. Same
277
282
  backtracking, one level up.
278
283
  - **[Lesson 4](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/04-closed-and-open-worlds.md)** contrasts the
@@ -351,7 +356,8 @@ engine.query("exposed(S, C)") # [{'S': 'app', 'C': 'cve_2026_0001'}]
351
356
 
352
357
  The command-line interface installs too, as `tiny-datalog` (and
353
358
  `tiny-datalog-semiring`, `-tabling`, `-incremental`, `-subsumption`,
354
- `-containment`, `-defeasible`, `-prolog` for the satellites):
359
+ `-containment`, `-defeasible`, `-prolog` for the other engines and the
360
+ extensions):
355
361
 
356
362
  ```sh
357
363
  tiny-datalog -q 'exposed(S, C)' supply-chain.dl
@@ -363,32 +369,41 @@ installed package; clone the repository for that.
363
369
  ## Layout
364
370
 
365
371
  ```
366
- tiny_datalog/ the engine and its satellites — the code you read:
367
- datalog.py the core: AST, parser, safety checks, stratification,
368
- the semi-naive evaluator, and the CLI
372
+ tiny_datalog/ the code you read, in three tiers:
373
+ core.py the common core — the language every module shares:
374
+ AST, parser, safety checks, stratification, matching,
375
+ formatting, query helpers
376
+ engines — four strategies, one answer (engines.py lists them):
377
+ datalog.py the base engine: semi-naive and naive bottom-up
378
+ evaluation, aggregation, --explain / why-not, the CLI
369
379
  magic.py the magic-sets rewriting (a program-to-program pass)
380
+ tabling.py tabled top-down evaluation (iterative QSQR)
381
+ engines.py the registry and the interface the four share
382
+ extensions — other questions asked of the same programs:
370
383
  semantics.py grounding, stable models, the well-founded model
371
384
  semiring.py semiring-valued evaluation (costs, counts, provenance,
372
385
  probabilities)
373
386
  incremental.py insertions + DRed deletions over a live materialisation
374
387
  prolog.py top-down SLD resolution with function symbols
375
- tabling.py tabled top-down evaluation (iterative QSQR)
376
388
  subsumption.py KL-ONE-style EL classifier, compiled to Datalog
377
389
  containment.py query containment and minimisation by homomorphism
378
390
  defeasible.py defeasible logic: exceptions, priorities, defeaters
391
+ chase.py existential rules: the chase, labelled nulls, weak
392
+ acyclicity
379
393
  *.py three-line launchers, so `python3 datalog.py ...` works
380
394
  straight from a checkout with nothing installed
381
395
  programs/ teaching programs, numbered by the lesson that uses
382
396
  them (00-* are the README's examples)
383
- lessons/ getting started, glossary, and lessons 0–19
397
+ lessons/ getting started, glossary, and lessons 0–22
384
398
  exercises/ worked answers, verified by the test suite
385
399
  cases/ golden test cases — add one without writing Python
386
400
  conformance/ the external datalog-conformance corpus (Soufflé, Nemo,
387
401
  Crepe, SPINdle), run against every evaluation strategy
388
- benchmarks/ scaled input generators (chain/tree/clique/grid)
389
- tests.py 254 tests: every shipped program and exercise answer is
402
+ benchmarks/ scaled input generators (chain/tree/clique/grid, an EL
403
+ ontology, and the N-queens puzzle)
404
+ tests.py 326 tests: every shipped program and exercise answer is
390
405
  executed, a conformance suite runs every query through
391
- every applicable strategy, and a seeded fuzzer checks
406
+ every engine that handles it, and a seeded fuzzer checks
392
407
  the same property on random programs
393
408
  ```
394
409
 
@@ -399,14 +414,37 @@ used.
399
414
 
400
415
  ### How big is it, honestly
401
416
 
402
- The evaluator is about 850 lines (`tiny_datalog/datalog.py`, up to the
403
- command-line interface), the CLI, `--explain` and why-not another 600, and the nine satellite modules about
404
- 2,900. Call it 4.3k lines of toolkit and 2.7k of tests, roughly a
405
- quarter of it commentary.
417
+ This project started as an attempt at a tiny implementation of
418
+ Datalog, small enough to read in an afternoon. It grew with the
419
+ course. Each lesson that taught a new technique — magic sets, stable models,
420
+ semirings, incremental maintenance, tabling, subsumption, containment,
421
+ defeasible logic, the chase — brought a module to run it, and the repository is
422
+ now several thousand lines. The core idea stayed small, and the code
423
+ is laid out so you can still read just that: the common core and the
424
+ base engine, below, are the original tiny Datalog. Everything else is
425
+ an engine or extension you can take one lesson at a time.
406
426
 
407
- "Tiny" is a claim about the evaluator, and about each satellite module
408
- singly: none of the nine exceeds 500 lines, which a test asserts. It is not a claim about
409
- the repository, which is ten modules because it teaches ten things.
427
+ Measured in lines, comments, docstrings and blank lines included:
428
+
429
+ | Tier | Lines |
430
+ |---|---|
431
+ | the common core (`core.py`: the language, evaluating nothing) | 785 |
432
+ | the base engine's evaluator (`datalog.py` up to its CLI section: the module docstring, the import list that re-exports the core, `Program`, `Engine`, aggregation folding, `run_program`) | 395 |
433
+ | `--explain`, why-not, printing and the CLI (the rest of `datalog.py`) | 538 |
434
+ | the other pluggable engines: magic sets (`magic.py`) and tabling (`tabling.py`), plus the `engines.py` registry (naive evaluation is a flag on the base engine) | 549 |
435
+ | the eight extensions | 2,822 |
436
+
437
+ So the smallest complete Datalog system here — parse, check, stratify,
438
+ evaluate semi-naively — is the core plus the evaluator, about 1,200
439
+ lines. All of it is 5.1k lines of toolkit (every module but the
440
+ re-export list in `__init__.py`), roughly a quarter of it commentary,
441
+ and 3.6k of tests.
442
+
443
+ "Tiny" is a claim about that core and evaluator, and about each module
444
+ built on them singly: none of the eleven (`magic.py`, `tabling.py`,
445
+ `engines.py` and the eight extensions) exceeds 500 lines, which a test asserts. It is not a
446
+ claim about the repository, which is a dozen modules because it
447
+ teaches a dozen things.
410
448
 
411
449
  There is no dead code to golf away (checked); shrinking further means
412
450
  deleting either a technique or an explanation.
@@ -3,8 +3,9 @@
3
3
  [![tests](https://github.com/andrewgoodchild/tiny-datalog/actions/workflows/ci.yml/badge.svg)](https://github.com/andrewgoodchild/tiny-datalog/actions/workflows/ci.yml)
4
4
  [![PyPI](https://img.shields.io/pypi/v/tiny-datalog)](https://pypi.org/project/tiny-datalog/)
5
5
 
6
- **A logic engine small enough to read in an afternoon, and a course
7
- that builds it up from nothing.**
6
+ **A Datalog engine whose core you can read in an afternoon, a course
7
+ that builds it up from nothing, and a module for every technique the
8
+ course teaches.**
8
9
 
9
10
  ## What is Datalog?
10
11
 
@@ -93,7 +94,7 @@ Nothing to install:
93
94
 
94
95
  ```sh
95
96
  git clone https://github.com/andrewgoodchild/tiny-datalog && cd tiny-datalog
96
- python3 tests.py # 254 tests, ~12s
97
+ python3 tests.py # 326 tests, ~12s
97
98
  ```
98
99
 
99
100
  ## Why the language choice decides what you can ask later
@@ -160,7 +161,7 @@ the better tool, and that covers most problems.
160
161
 
161
162
  ## What else you can ask it
162
163
 
163
- The worked example above is one row of a table. The full version — 20
164
+ The worked example above is one row of a table. The full version — 23
164
165
  questions, each with the command that answers it and the lesson that
165
166
  builds the machinery — is in
166
167
  [getting started](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/getting-started.md), beside the reading
@@ -215,8 +216,12 @@ the current research threads. The field's own recent lecture notes
215
216
  observe that the literature advises people building Datalog engines
216
217
  better than people trying to *use* one; this course does both halves
217
218
  on purpose — sixteen lessons where the engine is the explanation, then
218
- a lesson on authoring rules that survive review, and one on a logic
219
- built for rules with exceptions. And it is built to be
219
+ a lesson on authoring rules that survive review, one on a logic
220
+ built for rules with exceptions, and three where the engine goes to
221
+ work: [authorization](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/20-authorization.md),
222
+ [program analysis](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/21-program-analysis.md),
223
+ and [knowledge graphs and the chase](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/22-knowledge-graphs.md).
224
+ And it is built to be
220
225
  inherited: `git clone`, no dependencies, no hosted anything, and every
221
226
  quoted transcript re-verified by CI — the exercises cannot rot. (For where each
222
227
  technique ships — CodeQL, RDFox, Feldera, SNOMED and the rest —
@@ -239,7 +244,7 @@ engine:
239
244
  which is a real design-review question with a real answer.
240
245
  - **[Lesson 16](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/16-containment.md)** shows that the containment
241
246
  test you need for query minimisation is the search already sitting in
242
- `datalog.py`: `_match` maps a rule body into a database,
247
+ the core: `match` maps a rule body into a database,
243
248
  `find_homomorphism` maps a rule body into another rule body. Same
244
249
  backtracking, one level up.
245
250
  - **[Lesson 4](https://github.com/andrewgoodchild/tiny-datalog/blob/main/lessons/04-closed-and-open-worlds.md)** contrasts the
@@ -318,7 +323,8 @@ engine.query("exposed(S, C)") # [{'S': 'app', 'C': 'cve_2026_0001'}]
318
323
 
319
324
  The command-line interface installs too, as `tiny-datalog` (and
320
325
  `tiny-datalog-semiring`, `-tabling`, `-incremental`, `-subsumption`,
321
- `-containment`, `-defeasible`, `-prolog` for the satellites):
326
+ `-containment`, `-defeasible`, `-prolog` for the other engines and the
327
+ extensions):
322
328
 
323
329
  ```sh
324
330
  tiny-datalog -q 'exposed(S, C)' supply-chain.dl
@@ -330,32 +336,41 @@ installed package; clone the repository for that.
330
336
  ## Layout
331
337
 
332
338
  ```
333
- tiny_datalog/ the engine and its satellites — the code you read:
334
- datalog.py the core: AST, parser, safety checks, stratification,
335
- the semi-naive evaluator, and the CLI
339
+ tiny_datalog/ the code you read, in three tiers:
340
+ core.py the common core — the language every module shares:
341
+ AST, parser, safety checks, stratification, matching,
342
+ formatting, query helpers
343
+ engines — four strategies, one answer (engines.py lists them):
344
+ datalog.py the base engine: semi-naive and naive bottom-up
345
+ evaluation, aggregation, --explain / why-not, the CLI
336
346
  magic.py the magic-sets rewriting (a program-to-program pass)
347
+ tabling.py tabled top-down evaluation (iterative QSQR)
348
+ engines.py the registry and the interface the four share
349
+ extensions — other questions asked of the same programs:
337
350
  semantics.py grounding, stable models, the well-founded model
338
351
  semiring.py semiring-valued evaluation (costs, counts, provenance,
339
352
  probabilities)
340
353
  incremental.py insertions + DRed deletions over a live materialisation
341
354
  prolog.py top-down SLD resolution with function symbols
342
- tabling.py tabled top-down evaluation (iterative QSQR)
343
355
  subsumption.py KL-ONE-style EL classifier, compiled to Datalog
344
356
  containment.py query containment and minimisation by homomorphism
345
357
  defeasible.py defeasible logic: exceptions, priorities, defeaters
358
+ chase.py existential rules: the chase, labelled nulls, weak
359
+ acyclicity
346
360
  *.py three-line launchers, so `python3 datalog.py ...` works
347
361
  straight from a checkout with nothing installed
348
362
  programs/ teaching programs, numbered by the lesson that uses
349
363
  them (00-* are the README's examples)
350
- lessons/ getting started, glossary, and lessons 0–19
364
+ lessons/ getting started, glossary, and lessons 0–22
351
365
  exercises/ worked answers, verified by the test suite
352
366
  cases/ golden test cases — add one without writing Python
353
367
  conformance/ the external datalog-conformance corpus (Soufflé, Nemo,
354
368
  Crepe, SPINdle), run against every evaluation strategy
355
- benchmarks/ scaled input generators (chain/tree/clique/grid)
356
- tests.py 254 tests: every shipped program and exercise answer is
369
+ benchmarks/ scaled input generators (chain/tree/clique/grid, an EL
370
+ ontology, and the N-queens puzzle)
371
+ tests.py 326 tests: every shipped program and exercise answer is
357
372
  executed, a conformance suite runs every query through
358
- every applicable strategy, and a seeded fuzzer checks
373
+ every engine that handles it, and a seeded fuzzer checks
359
374
  the same property on random programs
360
375
  ```
361
376
 
@@ -366,14 +381,37 @@ used.
366
381
 
367
382
  ### How big is it, honestly
368
383
 
369
- The evaluator is about 850 lines (`tiny_datalog/datalog.py`, up to the
370
- command-line interface), the CLI, `--explain` and why-not another 600, and the nine satellite modules about
371
- 2,900. Call it 4.3k lines of toolkit and 2.7k of tests, roughly a
372
- quarter of it commentary.
384
+ This project started as an attempt at a tiny implementation of
385
+ Datalog, small enough to read in an afternoon. It grew with the
386
+ course. Each lesson that taught a new technique — magic sets, stable models,
387
+ semirings, incremental maintenance, tabling, subsumption, containment,
388
+ defeasible logic, the chase — brought a module to run it, and the repository is
389
+ now several thousand lines. The core idea stayed small, and the code
390
+ is laid out so you can still read just that: the common core and the
391
+ base engine, below, are the original tiny Datalog. Everything else is
392
+ an engine or extension you can take one lesson at a time.
373
393
 
374
- "Tiny" is a claim about the evaluator, and about each satellite module
375
- singly: none of the nine exceeds 500 lines, which a test asserts. It is not a claim about
376
- the repository, which is ten modules because it teaches ten things.
394
+ Measured in lines, comments, docstrings and blank lines included:
395
+
396
+ | Tier | Lines |
397
+ |---|---|
398
+ | the common core (`core.py`: the language, evaluating nothing) | 785 |
399
+ | the base engine's evaluator (`datalog.py` up to its CLI section: the module docstring, the import list that re-exports the core, `Program`, `Engine`, aggregation folding, `run_program`) | 395 |
400
+ | `--explain`, why-not, printing and the CLI (the rest of `datalog.py`) | 538 |
401
+ | the other pluggable engines: magic sets (`magic.py`) and tabling (`tabling.py`), plus the `engines.py` registry (naive evaluation is a flag on the base engine) | 549 |
402
+ | the eight extensions | 2,822 |
403
+
404
+ So the smallest complete Datalog system here — parse, check, stratify,
405
+ evaluate semi-naively — is the core plus the evaluator, about 1,200
406
+ lines. All of it is 5.1k lines of toolkit (every module but the
407
+ re-export list in `__init__.py`), roughly a quarter of it commentary,
408
+ and 3.6k of tests.
409
+
410
+ "Tiny" is a claim about that core and evaluator, and about each module
411
+ built on them singly: none of the eleven (`magic.py`, `tabling.py`,
412
+ `engines.py` and the eight extensions) exceeds 500 lines, which a test asserts. It is not a
413
+ claim about the repository, which is a dozen modules because it
414
+ teaches a dozen things.
377
415
 
378
416
  There is no dead code to golf away (checked); shrinking further means
379
417
  deleting either a technique or an explanation.
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tiny-datalog"
7
- version = "0.3.0"
8
- description = "A Datalog engine small enough to read in an afternoon"
7
+ version = "0.5.0"
8
+ description = "A Datalog engine whose core you can read in an afternoon, and a course built on it"
9
9
  readme = "README.md"
10
10
  license = "MIT"
11
11
  license-files = ["LICENSE"]
@@ -52,6 +52,7 @@ tiny-datalog-incremental = "tiny_datalog.incremental:main"
52
52
  tiny-datalog-subsumption = "tiny_datalog.subsumption:main"
53
53
  tiny-datalog-containment = "tiny_datalog.containment:main"
54
54
  tiny-datalog-defeasible = "tiny_datalog.defeasible:main"
55
+ tiny-datalog-chase = "tiny_datalog.chase:main"
55
56
 
56
57
  [tool.setuptools.packages.find]
57
58
  include = ["tiny_datalog*"]
@@ -0,0 +1,49 @@
1
+ """tiny-datalog — a Datalog engine whose core you can read in an afternoon.
2
+
3
+ The package has three tiers. `tiny_datalog.core` is the language —
4
+ AST, parser, validation, stratification — and `tiny_datalog.datalog` is
5
+ the base engine built on it, the bottom-up evaluator. The names below
6
+ are their public surface, re-exported here so that library use reads as
7
+
8
+ from tiny_datalog import Engine, Program, parse
9
+
10
+ `tiny_datalog.engines` lists the pluggable engines, which all give the
11
+ same answers: semi-naive and naive (`datalog`), `magic` (goal-directed
12
+ rewriting) and `tabling` (top-down with memoing).
13
+
14
+ Everything else is an extension built on the core, asking a different
15
+ question of a program: `semantics` (stable and well-founded models),
16
+ `semiring` (provenance-weighted evaluation), `incremental` (maintenance
17
+ under updates), `subsumption` (KL-ONE style classification),
18
+ `containment` (query containment), `defeasible` (rules with exceptions
19
+ and priorities), `chase` (existential rules and labelled nulls), and
20
+ `prolog` (a Prolog reader for the same syntax).
21
+ Import those by name: `from tiny_datalog import semiring`.
22
+ """
23
+
24
+ from tiny_datalog.datalog import (
25
+ # AST
26
+ Var, Const, Struct, Atom, Literal, Rule,
27
+ # errors
28
+ DatalogError, ParseError, SafetyError, StratificationError,
29
+ # front end
30
+ parse, validate, stratify, parse_goal, check_query_atom,
31
+ # evaluation
32
+ Program, Engine, run_program,
33
+ # answers and justification
34
+ match_answers, explain, whynot,
35
+ # formatting
36
+ format_atom, format_fact,
37
+ )
38
+
39
+ __version__ = "0.5.0"
40
+
41
+ __all__ = [
42
+ "Var", "Const", "Struct", "Atom", "Literal", "Rule",
43
+ "DatalogError", "ParseError", "SafetyError", "StratificationError",
44
+ "parse", "validate", "stratify", "parse_goal", "check_query_atom",
45
+ "Program", "Engine", "run_program",
46
+ "match_answers", "explain", "whynot",
47
+ "format_atom", "format_fact",
48
+ "__version__",
49
+ ]