Crate ontodev_valve

source ·
Expand description

valve.rs

A lightweight validation engine written in rust.

Command line usage

Run:

valve --help

to 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).

Enums

Functions

  • 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 command is set to ValveCommand::Create, execute the SQL statements to create the database using the given connection pool. If it is set to ValveCommand::Load, execute the SQL to load it as well.
  • 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 configuration table (either a table.tsv file or a database containing a table named “table”), 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.
  • Given a path to a configuration table (either a table.tsv file or a database containing a table named “table”), and 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 create and/or load it according to the value of command (see ValveCommand). If the verbose flag is set to true, output status messages while loading. If config_table is given and table_table indicates a database, query the table called config_table for the table table information. Returns the configuration map as a String.

Type Definitions