pub struct GraphEdge {
pub source: String,
pub target: String,
pub relation: String,
pub confidence: f64,
pub properties: HashMap<String, Value>,
}Expand description
An edge in the knowledge graph.
Fields§
§source: StringSource node ID
target: StringTarget node ID
relation: StringRelation type
confidence: f64Confidence score (0.0 - 1.0)
properties: HashMap<String, Value>Additional properties
Implementations§
Source§impl GraphEdge
impl GraphEdge
Sourcepub fn new(
source: impl Into<String>,
target: impl Into<String>,
relation: impl Into<String>,
) -> Self
pub fn new( source: impl Into<String>, target: impl Into<String>, relation: impl Into<String>, ) -> Self
Create a new graph edge.
Sourcepub fn with_confidence(self, confidence: f64) -> Self
pub fn with_confidence(self, confidence: f64) -> Self
Set confidence score.
Sourcepub fn with_property(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn with_property( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self
Add a property to the edge.
Sourcepub fn with_trigger(self, trigger: impl Into<String>) -> Self
pub fn with_trigger(self, trigger: impl Into<String>) -> Self
Add trigger text property.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GraphEdge
impl<'de> Deserialize<'de> for GraphEdge
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 GraphEdge
impl RefUnwindSafe for GraphEdge
impl Send for GraphEdge
impl Sync for GraphEdge
impl Unpin for GraphEdge
impl UnsafeUnpin for GraphEdge
impl UnwindSafe for GraphEdge
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