pub struct EntityType {
pub base: DataPoint,
pub name: String,
pub description: String,
}Expand description
Storage-layer entity type model.
Represents a category of entities (e.g., “Organization”, “Person”, “Location”).
Entity instances reference their EntityType via the is_a field.
Fields§
§base: DataPointBase data point fields (id, timestamps, metadata, etc.)
name: StringType name (e.g., “Organization”, “Person”, “Location”)
description: StringType description
Implementations§
Source§impl EntityType
impl EntityType
Sourcepub const INDEX_FIELDS: &'static [&'static str]
pub const INDEX_FIELDS: &'static [&'static str]
Index fields to embed for vector search.
Sourcepub fn id_for(value: &str) -> Uuid
pub fn id_for(value: &str) -> Uuid
Deterministic, class-namespaced id for an EntityType identity value.
Mirrors Python’s EntityType.id_for(value) (identity_fields=["name"]):
uuid5(NAMESPACE_OID, "EntityType:<normalized_value>"). The distinct
class prefix is what prevents an Entity and an EntityType with the
same name from colliding on one id (topoteretes/cognee#2510/#2515).
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
dataset_id: Option<Uuid>,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, dataset_id: Option<Uuid>, ) -> Self
Create a new EntityType.
§Arguments
name- Type name (e.g., “Organization”)description- Type descriptiondataset_id- Dataset UUID
Sourcepub fn from_node_type(
type_name: impl Into<String>,
dataset_id: Option<Uuid>,
) -> Self
pub fn from_node_type( type_name: impl Into<String>, dataset_id: Option<Uuid>, ) -> Self
Create EntityType from LLM-extracted node type string.
§Arguments
type_name- Node type from LLM (e.g., “Organization”)dataset_id- Dataset UUID
Sourcepub fn get_embeddable_text(&self) -> String
pub fn get_embeddable_text(&self) -> String
Get the type name (for embedding).
Sourcepub fn set_description(&mut self, description: impl Into<String>)
pub fn set_description(&mut self, description: impl Into<String>)
Update type description.
Sourcepub fn is_ontology_valid(&self) -> bool
pub fn is_ontology_valid(&self) -> bool
Check if this type has been validated against an ontology.
Sourcepub fn mark_ontology_valid(&mut self, canonical_name: Option<String>)
pub fn mark_ontology_valid(&mut self, canonical_name: Option<String>)
Mark as ontology-validated with canonical name.
§Arguments
canonical_name- Canonical name from ontology
Trait Implementations§
Source§impl Clone for EntityType
impl Clone for EntityType
Source§fn clone(&self) -> EntityType
fn clone(&self) -> EntityType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EntityType
impl Debug for EntityType
Source§impl<'de> Deserialize<'de> for EntityType
impl<'de> Deserialize<'de> for EntityType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl HasDataPoint for EntityType
impl HasDataPoint for EntityType
Source§fn data_point(&self) -> &DataPoint
fn data_point(&self) -> &DataPoint
DataPoint of this container.Source§fn data_point_mut(&mut self) -> &mut DataPoint
fn data_point_mut(&mut self) -> &mut DataPoint
DataPoint of this container.Source§fn for_each_child_mut(&mut self, _visit: &mut dyn FnMut(&mut dyn HasDataPoint))
fn for_each_child_mut(&mut self, _visit: &mut dyn FnMut(&mut dyn HasDataPoint))
HasDataPoint.
Default: no children. Override on container types whose fields
own (rather than reference by Uuid) another HasDataPoint.