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
impl RuntimeCatalog
Sourcepub fn intern_label(&mut self, name: &str) -> RuntimeTypeId
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.
Sourcepub fn intern_relation_type(&mut self, name: &str) -> RuntimeTypeId
pub fn intern_relation_type(&mut self, name: &str) -> RuntimeTypeId
Interns a relation type name and returns a stable RuntimeTypeId.
Sourcepub fn intern_property(
&mut self,
name: &str,
owner_label: Option<&str>,
) -> RuntimePropId
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.
Sourcepub fn contains_entity_type(&self, name: &str) -> bool
pub fn contains_entity_type(&self, name: &str) -> bool
Returns true if name has been interned as an entity type.
Sourcepub fn entity_types(&self) -> Vec<&str>
pub fn entity_types(&self) -> Vec<&str>
Returns all interned entity type names (order unspecified).
Sourcepub fn relation_types(&self) -> Vec<&str>
pub fn relation_types(&self) -> Vec<&str>
Returns all interned relation type names (order unspecified).
Sourcepub fn properties_for(&self, label: &str) -> Vec<&str>
pub fn properties_for(&self, label: &str) -> Vec<&str>
Returns all property names observed on label (order unspecified).
Sourcepub fn property_name(&self, id: RuntimePropId) -> Option<&str>
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.
Sourcepub fn property_names(&self) -> impl Iterator<Item = (RuntimePropId, &str)> + '_
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.
Sourcepub fn relation_type_name(&self, id: RuntimeTypeId) -> Option<&str>
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).
Sourcepub fn relation_type_names_with_ids(
&self,
) -> impl Iterator<Item = (RuntimeTypeId, &str)> + '_
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.
Sourcepub fn entity_type_name(&self, id: RuntimeTypeId) -> Option<&str>
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).
Sourcepub fn entity_type_names_with_ids(
&self,
) -> impl Iterator<Item = (RuntimeTypeId, &str)> + '_
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.
Sourcepub fn to_record_batch(&self) -> RecordBatch
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.
Sourcepub fn from_record_batch(batch: &RecordBatch) -> Result<Self, GfError>
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
impl Clone for RuntimeCatalog
Source§fn clone(&self) -> RuntimeCatalog
fn clone(&self) -> RuntimeCatalog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more