Crate ontodev_valve
source ·Expand description
valve.rs
A lightweight validation engine written in rust.
Command line usage
Run:
valve --helpto see command line options.
Python bindings
See valve.py
Modules
Structs
Represents a ‘when-then’ condition, as found in the
rule table, as two
CompiledCondition structs corresponding to the when and then
parts of the given rule.Represents a condition in three different ways: (i) in String format, (ii) as a parsed
Expression, and (iii) as a pre-compiled regular expression.
Represents a structure such as those found in the
structure column of the column table in
both its parsed format (i.e., as an Expression) as well as in its
original format (i.e., as a plain String).Functions
Given a path to a table table file (table.tsv), a directory in which to find/create a database:
configure the database using the configuration which can be looked up using the table table,
and optionally load it if the
load flag is set to true. If the verbose flag is set to true,
output status messages while loading.Given config maps for tables and datatypes, a database connection pool, and a StartParser,
read in the TSV files corresponding to the tables defined in the tables config, and use that
information to fill in constraints information into a new config map that is then returned along
with a list of the tables in the database sorted according to their mutual dependencies. If
the flag
verbose is set to true, emit SQL to create the database schema to STDOUT.
If the flag write_to_db is set to true, execute the SQL in the database using the given
connection pool.Given the global configuration map and a parser, compile all of the datatype conditions,
add them to a hash map whose keys are the text versions of the conditions and whose values
are the compiled conditions, and then finally return the hash map.
Given the global config map, a hash map of compiled datatype conditions (indexed by the text
version of the conditions), and a parser, compile all of the rule conditions, add them to a
hash which has the following structure:
Given the global config map and a parser, parse all of the structure conditions, add them to
a hash map whose keys are given by the text versions of the conditions and whose values are
given by the parsed versions, and finally return the hashmap.
Given a global config map, a database connection pool, a table name, and a row, assign a new
row number to the row and insert it to the database, then return the new row number.
Given the path to a table.tsv file, load and check the ‘table’, ‘column’, and ‘datatype’
tables, and return ConfigMaps corresponding to specials, tables, datatypes, and rules.
Given global config map, a database connection pool, a table name, a row, and the row number to
update, update the corresponding row in the database with new values as specified by
row.Type Definitions
An alias for serde_json::Map<String, serde_json::Value>.