Crate asdi
Another Simplistic Datalog Implementation (in Rust).
This package provides a data model to represent Datalog programs in memory, a parser for the textual representation, and some evaluation implementations.
The text representation parser is a separate feature, so if you only need to construct and evaluate programs using the API you may opt out of the Pest parser and support.
Status
- Library API mostly stable, but minimal, will try and make the construction API more ergonomic.
- Library Documentation good top-level documentation but very little else right now.
- Library validation checking basic checking, but some is done in the parser and needs to be in the library.
- Parser full support for the core language as well as pragmas, require more unit tests.
- I/O relations are now connected to the file input/output pragmas, the
iomodule includes traits for reading/writing relations as well as basic JSON and CSV support. - Evaluation current evaluator is basically top-down brute force and does not support any additional language features.
Example
parent(xerces, brooke).
parent(brooke, damocles).
ancestor(X, Y) ⟵ parent(X, Y).
ancestor(X, Y) ⟵ parent(X, Z) ⋀ parent(Z, Y).
?- ancestor(xerces, X).
use ;
use ;
use Program;
use FromStr;
Changes
Version 0.2.3
- Added new "*=" operator for regular expressions
- Renamed the variants of
LiteralInner/Literalto beRelationalandArithmeticto convey meaning, not just type. - Renamed
RelationstoRelationSetandRulestoRuleSet. - Renamed
PredicateSettoNameReferenceSetand used for variables also; this also addedAttributeNameReftype for clarity. - Updated the highlight.js datalog language definition for comment and operator changes.
- Replaced more uses of the term "comparison (operator)?" with arithmetic literal
- Fixed more Clippy warnings.
Version 0.2.2
- Made changes to syntax to align more closely with traditional Datalog, as well as Soufflé:
- using
%instead of#for line comments, - added
/*and*/for block comments, - removed the need for a
@prefix on the boolean constantstrueandfalse, - using
.instead of@for pragmas. - ASDI still uses separate
assertandinferpragmas rather than Soufflé's singledecl. - Also, to keep pragmas regular with other statements they end in a
.whereas in Soufflé they do not.
- using
- Fixed parsing errors in CSV and JSON files, mainly parsing strings (include/exclude quotes).
Version 0.2.1
- Added traits for consistency across types.
- Added a predicate cache to reduce duplication.
- Finished the file input and output for relations.
- Cleaned up the error module and added functions for error construction.
Version 0.2.0
- New internal structures and library layout.
- Less cloning, but still too much.
- Finished top-level documentation, more to come.
Version 0.1.0
- Not published, used for own verification only.
Version 0.1.0-dev
- Initial release, mostly to verify CI infrastructure through to crates.io