A Clojure(Script) library for declarative data description and validation.
One of the difficulties with bringing Clojure into a team is the overhead of understanding the kind of data (e.g., list of strings, nested map from long to string to double) that a function expects and returns. While a full-blown type system is one solution to this problem, we present a lighter weight solution: schemas. (For more details on why we built Schema, check out this post.
- Referenced post: Schema for Clojure(Script) Data Shape Declaration and Validation
Schema is a rich language for describing data shapes, with a variety of features:
- Data validation, with descriptive error messages of failures (targeted at programmers)
- Annotation of function arguments and return values, with optional runtime validation
- Schema-driven data coercion, which can automatically, succinctly, and safely convert complex data types (see the Coercion section below)
- Other
- Schema is also built into our plumbing and fnhouse libraries, which illustrate how we build services and APIs easily and safely with Schema
- Schema also supports experimental clojure.test.check data generation from Schemas, as well as completion of partial datums, features we've found very useful when writing tests as part of the
schema-generatorslibrary
Datalog is a declarative logic programming language that is a syntactic subset of Prolog. While SQL is designed for querying and manipulating tabular databases, Datalog excels at querying graphs, performing deductive inference, and executing complex recursive algorithms.
A Datalog program consists of two main parts:
- EDB (Extensional Database): The raw data or "facts". Similar to rows in a SQL table.
- IDB (Intensional Database): The logical "rules". Similar to SQL Views, but they can be highly recursive and call each other dynamically.