Skip to main content

RuntimeCatalog

Struct RuntimeCatalog 

Source
pub struct RuntimeCatalog { /* private fields */ }
Expand description

Auto-growing registry of observed entity types, relation types, and property names.

In exploratory and advisory ontology modes, the binder delegates unknown label/type/property resolution here rather than returning an error. The catalog auto-assigns stable integer IDs and tracks observation statistics.

The catalog is not internally synchronised — callers that share it across threads must wrap it in Arc<RwLock<RuntimeCatalog>> (wired in issue #583).

Implementations§

Source§

impl RuntimeCatalog

Source

pub fn new() -> Self

Creates an empty catalog.

Source

pub fn intern_label(&mut self, name: &str) -> RuntimeTypeId

Interns an entity label and returns a stable RuntimeTypeId.

If name has been seen before the observation count is incremented and the existing ID is returned unchanged.

Source

pub fn intern_relation_type(&mut self, name: &str) -> RuntimeTypeId

Interns a relation type name and returns a stable RuntimeTypeId.

Source

pub fn intern_property( &mut self, name: &str, owner_label: Option<&str>, ) -> RuntimePropId

Interns a property name and returns a stable RuntimePropId.

Properties are keyed by (name, owner_label) so the same property name observed on different labels gets independent IDs.

Source

pub fn contains_entity_type(&self, name: &str) -> bool

Returns true if name has been interned as an entity type.

Source

pub fn entity_types(&self) -> Vec<&str>

Returns all interned entity type names (order unspecified).

Source

pub fn relation_types(&self) -> Vec<&str>

Returns all interned relation type names (order unspecified).

Source

pub fn properties_for(&self, label: &str) -> Vec<&str>

Returns all property names observed on label (order unspecified).

Source

pub fn property_name(&self, id: RuntimePropId) -> Option<&str>

Resolves a RuntimePropId back to the property name it was interned under, or None if no property entry carries that ID.

Used by the relational lowering layer to turn a numeric PropertyAccess ID back into the real column name when reading exploratory property tables.

Source

pub fn property_names(&self) -> impl Iterator<Item = (RuntimePropId, &str)> + '_

Returns (RuntimePropId, name) for every interned property (order unspecified). Convenient for building a PropId → name map in one pass.

Source

pub fn relation_type_name(&self, id: RuntimeTypeId) -> Option<&str>

Resolves a relation-type RuntimeTypeId back to the name it was interned under, or None if no relation-type entry carries that ID.

Used by the relational lowering layer to resolve a TypedEdgeScan’s relation name when reading exploratory edge tables (no ontology present).

Source

pub fn relation_type_names_with_ids( &self, ) -> impl Iterator<Item = (RuntimeTypeId, &str)> + '_

Returns (RuntimeTypeId, name) for every interned relation type (order unspecified). Convenient for building a TypeId → relation-name map.

Source

pub fn entity_type_name(&self, id: RuntimeTypeId) -> Option<&str>

Resolves an entity-type (node label) RuntimeTypeId back to the name it was interned under, or None if no entity-type entry carries that ID.

Mirror of relation_type_name for labels — used to render a real label name for an unlabelled MATCH (n) RETURN n in exploratory mode, where the ontology map is empty (#889).

Source

pub fn entity_type_names_with_ids( &self, ) -> impl Iterator<Item = (RuntimeTypeId, &str)> + '_

Returns (RuntimeTypeId, name) for every interned entity type (node label), order unspecified. Convenient for building a TypeId → label-name map.

Source

pub fn to_record_batch(&self) -> RecordBatch

Serialises the catalog to an Arrow RecordBatch using RUNTIME_CATALOG_SCHEMA.

The resulting batch can be written to topology/runtime_catalog.parquet and later restored via from_record_batch.

Source

pub fn from_record_batch(batch: &RecordBatch) -> Result<Self, GfError>

Restores a RuntimeCatalog from an Arrow RecordBatch previously produced by to_record_batch.

§Errors

Returns GfError::Storage if any column has the wrong type or an unknown entry_kind value is encountered.

Trait Implementations§

Source§

impl Clone for RuntimeCatalog

Source§

fn clone(&self) -> RuntimeCatalog

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 RuntimeCatalog

Source§

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

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

impl Default for RuntimeCatalog

Source§

fn default() -> RuntimeCatalog

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.