pub struct Entity {
pub id: EntityId,
pub entity_type: EntityType,
pub name: String,
pub aliases: Vec<String>,
pub domain: Domain,
pub confidence: f32,
pub valid_time: ValidTimeRange,
pub transaction_time: TransactionTime,
pub properties: HashMap<String, String>,
pub mention_count: u32,
}Expand description
An entity in the knowledge graph.
Entities represent real-world concepts extracted from memories, such as people, organizations, technologies, and files.
Fields§
§id: EntityIdUnique identifier for this entity.
entity_type: EntityTypeType of entity.
name: StringCanonical name for the entity.
aliases: Vec<String>Alternative names or aliases.
domain: DomainDomain scope for the entity.
confidence: f32Confidence score from extraction (0.0 to 1.0).
valid_time: ValidTimeRangeBitemporal: when this entity was valid in the real world.
transaction_time: TransactionTimeBitemporal: when this entity was recorded in the system.
properties: HashMap<String, String>Optional properties as key-value pairs.
mention_count: u32Number of times this entity has been mentioned.
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn new(
entity_type: EntityType,
name: impl Into<String>,
domain: Domain,
) -> Self
pub fn new( entity_type: EntityType, name: impl Into<String>, domain: Domain, ) -> Self
Creates a new entity with default temporal values.
Sourcepub fn with_confidence(self, confidence: f32) -> Self
pub fn with_confidence(self, confidence: f32) -> Self
Sets the confidence score.
Sourcepub fn with_alias(self, alias: impl Into<String>) -> Self
pub fn with_alias(self, alias: impl Into<String>) -> Self
Adds an alias to the entity.
Sourcepub fn with_aliases(
self,
aliases: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_aliases( self, aliases: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Adds multiple aliases to the entity.
Sourcepub fn with_valid_time(self, valid_time: ValidTimeRange) -> Self
pub fn with_valid_time(self, valid_time: ValidTimeRange) -> Self
Sets the valid time range.
Sourcepub fn with_property(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_property( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Adds a property to the entity.
Sourcepub fn matches_name(&self, name: &str) -> bool
pub fn matches_name(&self, name: &str) -> bool
Returns true if this entity matches a name (canonical or alias).
Sourcepub fn is_valid_at(&self, timestamp: i64) -> bool
pub fn is_valid_at(&self, timestamp: i64) -> bool
Returns true if this entity is valid at the given time.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entity
impl<'de> Deserialize<'de> for Entity
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>,
impl StructuralPartialEq for Entity
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].