View Source Guesswork.KnowledgeBase.Collection.Store (Guesswork v0.4.4)
Represents a very basic knowledge base with all rules and facts stored in memory.
Summary
Functions
Pulls all facts that match the relation name and arity of the supplied fact.
Pulls all falsehoods that match the relation name and arity of the supplied fact.
Pulls all rules who's headers match the relation name and arity of the supplied fact.
Inserts a fact into the knowledge base. It must be concrete.
Inserts a falsehood into the knowledge base. It must be concrete.
Inserts a rule into the knowledge base.
Types
@type t() :: %Guesswork.KnowledgeBase.Collection.Store{ facts: %{ required(Guesswork.Ast.Fact.metadata()) => MapSet.t(Guesswork.Ast.Fact.t()) }, falsehoods: %{ required(Guesswork.Ast.Fact.metadata()) => MapSet.t(Guesswork.Ast.Fact.t()) }, rules: %{ required(Guesswork.Ast.Fact.metadata()) => MapSet.t(Guesswork.Ast.Rule.t()) } }
Functions
@spec get_possible_facts(t(), Guesswork.Ast.Fact.t()) :: [Guesswork.Ast.Fact.t()]
Pulls all facts that match the relation name and arity of the supplied fact.
@spec get_possible_falsehoods(t(), Guesswork.Ast.Fact.t()) :: [Guesswork.Ast.Fact.t()]
Pulls all falsehoods that match the relation name and arity of the supplied fact.
@spec get_possible_rules(t(), Guesswork.Ast.Fact.t()) :: [Guesswork.Ast.Rule.t()]
Pulls all rules who's headers match the relation name and arity of the supplied fact.
@spec insert_fact(t(), Guesswork.Ast.Fact.t()) :: {:error, String.t()} | {:ok, t()}
Inserts a fact into the knowledge base. It must be concrete.
@spec insert_falsehood(t(), Guesswork.Ast.Fact.t()) :: {:error, String.t()} | {:ok, t()}
Inserts a falsehood into the knowledge base. It must be concrete.
@spec insert_rule(t(), Guesswork.Ast.Rule.t()) :: t()
Inserts a rule into the knowledge base.
@spec new() :: t()