Skip to main content

KnowledgeGraph

Trait KnowledgeGraph 

Source
pub trait KnowledgeGraph:
    Send
    + Sync
    + Debug {
Show 15 methods // Required methods fn upsert_entity<'life0, 'async_trait>( &'life0 self, entity: Entity, ) -> Pin<Box<dyn Future<Output = Result<UpsertResult, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_entity<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Entity>, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn search_entities<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 EntityQuery, ) -> Pin<Box<dyn Future<Output = Result<EntityPage, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_entity<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<usize, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_entities_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ids: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn upsert_relation<'life0, 'async_trait>( &'life0 self, relation: Relation, ) -> Pin<Box<dyn Future<Output = Result<UpsertResult, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_relations<'life0, 'life1, 'async_trait>( &'life0 self, entity_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn query_relations<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 RelationQuery, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete_relation<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_neighbors<'life0, 'life1, 'async_trait>( &'life0 self, entity_id: &'life1 str, depth: u32, ) -> Pin<Box<dyn Future<Output = Result<SubGraph, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn shortest_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<PathStep>>, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn all_paths<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, max_depth: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<PathStep>>, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn batch_import<'life0, 'async_trait>( &'life0 self, entities: Vec<Entity>, relations: Vec<Relation>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn check_consistency<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ConsistencyIssue>, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<GraphStats, KgError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Knowledge graph core interface.

Design principles:

  • Upsert semantics by ID with configurable merge strategy
  • Graph traversal as first-class citizen (BFS neighbors, shortest path)
  • Batch import within transactions with detailed statistics
  • Consistency checking as independent concern
  • delete_entity cascades to related relations

Required Methods§

Source

fn upsert_entity<'life0, 'async_trait>( &'life0 self, entity: Entity, ) -> Pin<Box<dyn Future<Output = Result<UpsertResult, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_entity<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Entity>, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn search_entities<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 EntityQuery, ) -> Pin<Box<dyn Future<Output = Result<EntityPage, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete_entity<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<usize, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_entities_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ids: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn upsert_relation<'life0, 'async_trait>( &'life0 self, relation: Relation, ) -> Pin<Box<dyn Future<Output = Result<UpsertResult, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_relations<'life0, 'life1, 'async_trait>( &'life0 self, entity_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn query_relations<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 RelationQuery, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete_relation<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_neighbors<'life0, 'life1, 'async_trait>( &'life0 self, entity_id: &'life1 str, depth: u32, ) -> Pin<Box<dyn Future<Output = Result<SubGraph, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn shortest_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<PathStep>>, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn all_paths<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, max_depth: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<PathStep>>, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn batch_import<'life0, 'async_trait>( &'life0 self, entities: Vec<Entity>, relations: Vec<Relation>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn check_consistency<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ConsistencyIssue>, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<GraphStats, KgError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§