Current section
Files
Jump to
Current section
Files
lib/guesswork.ex
defmodule Guesswork do
@moduledoc """
Guesswork allows the creation of logical statements and knowledge databases
which then can be used together to figure out answers to questions stated
in those logical systems.
"""
alias Guesswork.Ast.Statement
alias Guesswork.Ast.Statement.Opts
alias Guesswork.Answer
alias Guesswork.Answer.Result
alias Guesswork.Query
defmodule EmptyCollection do
@moduledoc """
A collection with no facts, falsehoods, or rules.
"""
use Guesswork.KnowledgeBase.Collection
end
@doc """
Takes a logical statement, a knowledge base, and a target number of answer sets,
and then returns all entity bindings for which the statement is true, according
to the knowledge base.
Available Options:
#{NimbleOptions.docs(Opts.schema())}
"""
@spec query(Statement.t(), integer(), Opts.opts_list()) :: Enumerable.t(Answer.t())
def query(statement, n, opts \\ []) do
Query.new(statement, opts)
|> Result.run(n)
end
end