pub struct Relationship {
pub source: EntityId,
pub target: EntityId,
pub relation_type: String,
pub confidence: f32,
pub context: Vec<ChunkId>,
pub embedding: Option<Vec<f32>>,
pub temporal_type: Option<TemporalRelationType>,
pub temporal_range: Option<TemporalRange>,
pub causal_strength: Option<f32>,
}Expand description
Relationship between entities
Fields§
§source: EntityIdSource entity ID for the relationship
target: EntityIdTarget entity ID for the relationship
relation_type: StringType of relationship (e.g., “works_for”, “located_in”)
confidence: f32Confidence score for the relationship (0.0-1.0)
context: Vec<ChunkId>Chunk IDs providing context for this relationship
embedding: Option<Vec<f32>>Optional embedding vector for semantic similarity matching
temporal_type: Option<TemporalRelationType>Type of temporal relationship (Before, During, Caused, etc.)
temporal_range: Option<TemporalRange>Temporal range when this relationship was valid
causal_strength: Option<f32>Strength of causal relationship (0.0-1.0), only meaningful for causal temporal types
Implementations§
Source§impl Relationship
impl Relationship
Sourcepub fn new(
source: EntityId,
target: EntityId,
relation_type: String,
confidence: f32,
) -> Self
pub fn new( source: EntityId, target: EntityId, relation_type: String, confidence: f32, ) -> Self
Create a new relationship
Sourcepub fn with_context(self, context: Vec<ChunkId>) -> Self
pub fn with_context(self, context: Vec<ChunkId>) -> Self
Add context chunks to the relationship
Sourcepub fn with_temporal_type(self, temporal_type: TemporalRelationType) -> Self
pub fn with_temporal_type(self, temporal_type: TemporalRelationType) -> Self
Set temporal type for this relationship
Sourcepub fn with_temporal_range(self, start: i64, end: i64) -> Self
pub fn with_temporal_range(self, start: i64, end: i64) -> Self
Set temporal range for this relationship
Sourcepub fn with_causal_strength(self, strength: f32) -> Self
pub fn with_causal_strength(self, strength: f32) -> Self
Set causal strength for this relationship
Sourcepub fn with_embedding(self, embedding: Vec<f32>) -> Self
pub fn with_embedding(self, embedding: Vec<f32>) -> Self
Set embedding vector for this relationship (Phase 2.2)
Trait Implementations§
Source§impl Clone for Relationship
impl Clone for Relationship
Source§fn clone(&self) -> Relationship
fn clone(&self) -> Relationship
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Relationship
impl Debug for Relationship
Source§impl<'de> Deserialize<'de> for Relationship
impl<'de> Deserialize<'de> for Relationship
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Relationship
impl RefUnwindSafe for Relationship
impl Send for Relationship
impl Sync for Relationship
impl Unpin for Relationship
impl UnsafeUnpin for Relationship
impl UnwindSafe for Relationship
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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