Skip to main content

Archive

Struct Archive 

Source
pub struct Archive {
    pub nodes: Vec<Definition>,
    pub connections: Vec<Connection>,
}
Expand description

A .prx archive: the nodes and connections of one serialized ontology.

Fields§

§nodes: Vec<Definition>

The node definitions (concepts, axioms, lenses, …).

§connections: Vec<Connection>

The connections (morphisms) — functors / adjunctions / lenses / nat-trans.

Implementations§

Source§

impl Archive

Source

pub fn new() -> Self

An empty archive.

Source

pub fn root(&self) -> Result<ContentAddress, CodecError>

The Merkle root — the content address over the sorted, deduplicated set of every node’s and connection’s definition-bearing address.

Source§

impl Archive

Source

pub fn recursive_addresses( &self, ) -> Result<BTreeMap<String, ContentAddress>, RecursiveAddressError>

The recursive (transitive) content address of every node, keyed by name — each address fixes the node’s reachable definition, cycle-safe. See the module doc. Edge kinds resolve against the default_kind_vocab (the meta kind floor). Err on a dangling local edge or an unlabeled automorphic cycle (fail-closed).

Source

pub fn recursive_addresses_grounded( &self, vocab: &KindVocab, ) -> Result<BTreeMap<String, ContentAddress>, RecursiveAddressError>

As recursive_addresses, but resolving edge kinds against an EXPLICIT KindVocab. Two peers agree on a concept’s MEANING (not just spelling) by recomputing with the SAME vocab; a vocab in which a kind’s properties differ yields a different address (A3).

Source

pub fn recursive_root(&self) -> Result<ContentAddress, RecursiveAddressError>

The recursive Merkle root — the content address over the sorted set of every node’s RECURSIVE address. The transitive-identity analogue of root; additive, leaves root untouched. Kinds resolve against the default_kind_vocab.

Source

pub fn recursive_root_grounded( &self, vocab: &KindVocab, ) -> Result<ContentAddress, RecursiveAddressError>

As recursive_root, but resolving edge kinds against an explicit KindVocab.

Source

pub fn extract_concept( &self, name: &str, ) -> Result<Archive, RecursiveAddressError>

The minimal sub-archive carrying name and its transitive LOCAL closure (every node reachable by Local edges) PLUS the ontology’s connections — the teach-a-peer payload. A peer that loads it (1) recomputes name’s recursive address to the SAME value as in this archive — because a recursive address depends only on this closure plus the Grounded leaves (whose foreign roots the peer must already hold; a Grounded edge is kept verbatim as a foreign-atom address) — and (2) holds the functors needed to INTERPRET (rebind via apply) the concept, not merely identify it.

The connections ride whole: a functor is ontology-level (it maps generic KINDS, e.g. Synset → Concept), so it is the interpretation machinery for every concept of the ontology, not one concept’s. Err if name is absent or a local edge dangles.

Trait Implementations§

Source§

impl Clone for Archive

Source§

fn clone(&self) -> Archive

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 Archive

Source§

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

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

impl Default for Archive

Source§

fn default() -> Archive

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Archive

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 Eq for Archive

Source§

impl PartialEq for Archive

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Archive

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 Archive

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.