Argus.Souffle (Panoptes v0.13.0)

Copy Markdown View Source

Souffle execution via shell-out to the souffle command-line tool.

Invokes souffle -F <facts_dir> -D <output_dir> <rules.dl> and parses the tab-separated output files back into lists of string rows.

Summary

Functions

Returns true if the souffle binary is available on the system PATH.

The relations a rules program reads, as Souffle resolves them.

The message to show a user when available?/0 is false.

Runs Souffle against facts_dir using rules_path and returns the derived relations.

Types

result()

@type result() :: %{required(String.t()) => [[String.t()]]}

Functions

available?()

@spec available?() :: boolean()

Returns true if the souffle binary is available on the system PATH.

input_relations(rules_path, opts \\ [])

@spec input_relations(
  Path.t(),
  keyword()
) :: {:ok, [String.t()]} | {:error, term()}

The relations a rules program reads, as Souffle resolves them.

Compiles the program only as far as the transformed RAM — no facts are read and no solve runs — and returns the relations it would load.

The RAM is the right oracle here. Reading .input out of the source over-approximates (declared-but-unused relations survive in the AST and are pruned later), and resolving .include by hand under-approximates (Souffle resolves includes relative to the including file, so a naive walker misses transitively included declarations). Only the RAM says what will actually be opened.

not_found_message()

@spec not_found_message() :: String.t()

The message to show a user when available?/0 is false.

run(facts_dir, rules_path, opts \\ [])

@spec run(Path.t(), Path.t(), keyword()) :: {:ok, result()} | {:error, term()}

Runs Souffle against facts_dir using rules_path and returns the derived relations.

Options

  • :souffle_bin — path to the souffle binary (default: auto-detect on PATH)
  • :souffle_timeout — milliseconds before the run is aborted (default: 5 min)
  • :output_dir — where Souffle should write .csv outputs (default: tmpdir)