NAME

Logic::Relational::Clause - Represents a logic clause (fact or rule).

SYNOPSIS

use Logic::Relational::Clause;
my $clause = Logic::Relational::Clause->new(
    head => $head_term,
    body => $body_goal,
);

DESCRIPTION

Logic::Relational::Clause represents a logical clause. A fact is a clause with no body goals (or rather, the body defaults to True). A rule contains a body Goal that must be satisfied for the clause head to hold.

METHODS

new

Constructor. Takes head (Term), body (Goal, optional), id (string, optional), and metadata (hashref, optional).

id

Returns the unique ID of the clause (e.g. clause-1).

Returns the head term of the clause.

body

Returns the body goal of the clause.

metadata

Returns the metadata associated with the clause.

freshen

Returns a fresh copy of the clause where all its logical variables are mapped to newly generated variables, preserving variable sharing within the clause.