pub enum ClExpr {
Show 15 variants
Fact {
predicate: String,
args: BTreeMap<String, ClValue>,
truth: bool,
derived_from: Option<String>,
supersedes: Option<String>,
modality: Option<Epistemic>,
provenance: Option<Vec<String>>,
confidence: Option<f32>,
valid_until_ms: Option<i64>,
},
And {
exprs: Vec<ClExpr>,
},
Or {
exprs: Vec<ClExpr>,
},
Not {
expr: Box<ClExpr>,
},
RefExpr {
msg_id: String,
},
Bind {
name: String,
expr: Box<ClExpr>,
body: Box<ClExpr>,
},
ForAll {
var: String,
over: Box<ClExpr>,
such_that: Box<ClExpr>,
},
Exists {
var: String,
over: Box<ClExpr>,
such_that: Box<ClExpr>,
},
Believes {
agent: String,
fact: Box<ClExpr>,
},
ConditionalCommitment {
debtor: String,
creditor: String,
condition: Box<ClExpr>,
act: ClAction,
deadline_ms: Option<i64>,
status: CommitmentStatus,
},
Prefer {
criteria: Vec<ClExpr>,
},
Renew {
target_msg_id: String,
new_deadline_ms: i64,
},
Action {
name: String,
params: Value,
result_schema: Option<Value>,
},
Query {
predicate: String,
args: Value,
valid_until_ms: Option<i64>,
},
Commitment {
debtor: String,
creditor: String,
act: ClAction,
deadline_ms: Option<i64>,
status: CommitmentStatus,
},
}Expand description
One content-language expression.
Variants§
Fact
Assert that predicate(args) holds (or not, truth: false).
Fields
derived_from: Option<String>§29: this fact was derived from the referenced message; its validity is bounded by the source’s validity.
supersedes: Option<String>§32: belief revision — this fact SUPERSEDES the fact asserted in the referenced message (retraction with traceability).
And
§6.3 conjunction — all leaves must hold.
Or
§6.3 disjunction — at least one leaf must hold.
Not
§6.3 negation (fact leaves only).
RefExpr
§6.3 reference to an expression produced in another message.
Bind
§28: bind a name to an expression’s value, usable in body via
$bind:<name> references. expr must be a fact/action leaf.
ForAll
§28: universal quantification — for every element of over’s
result (a query), such_that holds with the element bound to var.
Exists
§28: existential quantification.
Believes
§28: metanível — the sender asserts that agent holds fact.
ConditionalCommitment
§32: conditional commitment — activates only when condition holds
(as observed by the debtor). Condition is a fact composition.
Fields
status: CommitmentStatusPrefer
§32: evaluation policy — declares the criteria used to rank bids (carried under propose/accept in contract-net, §21).
Renew
§29: extend an active commitment’s deadline (carried under request).
Action
Express an action to be performed.
Query
Ask whether predicate(args) holds; the reply is a Fact.
Fields
Commitment
Debtor commits to creditor to perform act by deadline_ms.
Implementations§
Source§impl ClExpr
impl ClExpr
pub fn fact(predicate: &str, args: Value) -> Self
pub fn fact_false(predicate: &str, args: Value) -> Self
pub fn action(name: &str, params: Value) -> Self
pub fn and(exprs: Vec<ClExpr>) -> Self
pub fn not(expr: ClExpr) -> Self
pub fn ref_to(msg_id: &str) -> Self
pub fn bind(name: &str, expr: ClExpr, body: ClExpr) -> Self
pub fn for_all(var: &str, over: ClExpr, such_that: ClExpr) -> Self
pub fn exists(var: &str, over: ClExpr, such_that: ClExpr) -> Self
pub fn believes(agent: &str, fact: ClExpr) -> Self
pub fn renew(target_msg_id: &str, new_deadline_ms: i64) -> Self
pub fn query(predicate: &str, args: Value) -> Self
pub fn commitment( debtor: &str, creditor: &str, act: ClAction, deadline_ms: Option<i64>, status: CommitmentStatus, ) -> Self
Sourcepub fn conditional_commitment(
debtor: &str,
creditor: &str,
condition: ClExpr,
act: ClAction,
deadline_ms: Option<i64>,
status: CommitmentStatus,
) -> Self
pub fn conditional_commitment( debtor: &str, creditor: &str, condition: ClExpr, act: ClAction, deadline_ms: Option<i64>, status: CommitmentStatus, ) -> Self
§32: conditional commitment — activates only when condition holds.