package datalog

  1. Overview
  2. Docs
include TopDown.PARSE with type term = Logic.T.t and type lit = Logic.Lit.t and type clause = Logic.C.t
type term = Logic.T.t
type lit = Logic.Lit.t
type clause = Logic.C.t
type name_ctx = (string, term) Hashtbl.t
val create_ctx : unit -> name_ctx
val term_of_ast : ctx:name_ctx -> Datalog_top_down.AST.term -> term
val lit_of_ast : ctx:name_ctx -> Datalog_top_down.AST.literal -> lit
val clause_of_ast : ?ctx:name_ctx -> Datalog_top_down.AST.clause -> clause
val clauses_of_ast : ?ctx:name_ctx -> Datalog_top_down.AST.clause list -> clause list
val parse_chan : in_channel -> [ `Ok of clause list | `Error of string ]
val parse_file : string -> [ `Ok of clause list | `Error of string ]
val parse_string : string -> [ `Ok of clause list | `Error of string ]
val clause_of_string : string -> clause

Parse a clause from a string, or fail. Useful shortcut to define properties of relations without building terms by hand.

  • raises Failure

    if the string is not a valid clause

val term_of_string : string -> term
  • raises Failure

    if the string is not a valid term

Additional functions, to load clauses directly into the DB

val load_chan : Logic.DB.t -> in_channel -> bool
val load_file : Logic.DB.t -> string -> bool
val load_string : Logic.DB.t -> string -> bool
OCaml

Innovation. Community. Security.