Skip to main content

ClExpr

Enum ClExpr 

Source
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

§predicate: String
§truth: bool
§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).

§modality: Option<Epistemic>

§6.4 epistemic modality (default: Asserted).

§provenance: Option<Vec<String>>

§6.4 provenance chain: AIDs of who asserted/forwarded, oldest first.

§confidence: Option<f32>

§6.4 confidence in [0,1].

§valid_until_ms: Option<i64>

§6.4 temporal validity: fact expires at this unix ms.

§

And

§6.3 conjunction — all leaves must hold.

Fields

§exprs: Vec<ClExpr>
§

Or

§6.3 disjunction — at least one leaf must hold.

Fields

§exprs: Vec<ClExpr>
§

Not

§6.3 negation (fact leaves only).

Fields

§expr: Box<ClExpr>
§

RefExpr

§6.3 reference to an expression produced in another message.

Fields

§msg_id: String
§

Bind

§28: bind a name to an expression’s value, usable in body via $bind:<name> references. expr must be a fact/action leaf.

Fields

§name: String
§expr: Box<ClExpr>
§body: Box<ClExpr>
§

ForAll

§28: universal quantification — for every element of over’s result (a query), such_that holds with the element bound to var.

Fields

§over: Box<ClExpr>
§such_that: Box<ClExpr>
§

Exists

§28: existential quantification.

Fields

§over: Box<ClExpr>
§such_that: Box<ClExpr>
§

Believes

§28: metanível — the sender asserts that agent holds fact.

Fields

§agent: String
§fact: Box<ClExpr>
§

ConditionalCommitment

§32: conditional commitment — activates only when condition holds (as observed by the debtor). Condition is a fact composition.

Fields

§debtor: String
§creditor: String
§condition: Box<ClExpr>
§deadline_ms: Option<i64>
§

Prefer

§32: evaluation policy — declares the criteria used to rank bids (carried under propose/accept in contract-net, §21).

Fields

§criteria: Vec<ClExpr>
§

Renew

§29: extend an active commitment’s deadline (carried under request).

Fields

§target_msg_id: String
§new_deadline_ms: i64
§

Action

Express an action to be performed.

Fields

§name: String
§params: Value
§result_schema: Option<Value>
§

Query

Ask whether predicate(args) holds; the reply is a Fact.

Fields

§predicate: String
§args: Value
§valid_until_ms: Option<i64>

§29: the asker accepts answers valid until this unix ms.

§

Commitment

Debtor commits to creditor to perform act by deadline_ms.

Fields

§debtor: String
§creditor: String
§deadline_ms: Option<i64>

Implementations§

Source§

impl ClExpr

Source

pub fn fact(predicate: &str, args: Value) -> Self

Source

pub fn fact_false(predicate: &str, args: Value) -> Self

Source

pub fn action(name: &str, params: Value) -> Self

Source

pub fn and(exprs: Vec<ClExpr>) -> Self

Source

pub fn not(expr: ClExpr) -> Self

Source

pub fn ref_to(msg_id: &str) -> Self

Source

pub fn bind(name: &str, expr: ClExpr, body: ClExpr) -> Self

Source

pub fn for_all(var: &str, over: ClExpr, such_that: ClExpr) -> Self

Source

pub fn exists(var: &str, over: ClExpr, such_that: ClExpr) -> Self

Source

pub fn believes(agent: &str, fact: ClExpr) -> Self

Source

pub fn renew(target_msg_id: &str, new_deadline_ms: i64) -> Self

Source

pub fn query(predicate: &str, args: Value) -> Self

Source

pub fn commitment( debtor: &str, creditor: &str, act: ClAction, deadline_ms: Option<i64>, status: CommitmentStatus, ) -> Self

Source

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.

Source

pub fn prefer(criteria: Vec<ClExpr>) -> Self

§32: preference policy (CNP evaluation criteria).

Trait Implementations§

Source§

impl Clone for ClExpr

Source§

fn clone(&self) -> ClExpr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ClExpr

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ClExpr

Source§

fn eq(&self, other: &ClExpr) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ClExpr

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ClExpr

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.