pub struct GraphStore(/* private fields */);Implementations§
Source§impl GraphStore
impl GraphStore
pub fn apply_batch( &self, batch: &GraphBatch, ) -> Result<WriteReceipt<GraphBatchResult>>
pub fn get( &self, kind: RecordKind, id: i64, filter: &ReadFilter, ) -> Result<Value>
pub fn list(&self, kind: RecordKind, page: &PageRequest) -> Result<Page<Value>>
Sourcepub fn set_predicate_equivalents(
&self,
namespace: &str,
groups: &[Vec<String>],
) -> Result<WriteReceipt<usize>>
pub fn set_predicate_equivalents( &self, namespace: &str, groups: &[Vec<String>], ) -> Result<WriteReceipt<usize>>
登记一批谓词等价组到某个知识领域:groups 是一组组互等同义词,
组内第一个词当规范词(组内代表),同组词据此归并。重复登记同一个词会改写它的归属。
表由上游提供、库不内置领域数据;只影响查询期扩散,不改谓词的落盘写法。
Sourcepub fn predicate_equivalents(&self, namespace: &str) -> Result<Vec<Vec<String>>>
pub fn predicate_equivalents(&self, namespace: &str) -> Result<Vec<Vec<String>>>
列出某个知识领域已登记的等价组;每个组是一组互等同义词。没登记过就返回空。
Sourcepub fn expand_query(
&self,
namespace: &str,
text_value: &str,
) -> Result<Vec<String>>
pub fn expand_query( &self, namespace: &str, text_value: &str, ) -> Result<Vec<String>>
扩散:找出 text 里出现了哪些已登记谓词,返回这些谓词所在等价组的全部同义词。
命中判定是「登记词作为子串出现在查询里」,与 story 的关键词表同一路数。
返回的是可直接追加进检索的补充词元;没有命中返回空。
pub fn resolve( &self, name: &str, filter: &ReadFilter, limit: usize, ) -> Result<Vec<Entity>>
pub fn neighbors( &self, id: i64, filter: &ReadFilter, limit: usize, ) -> Result<Neighborhood>
pub fn events_for_entity( &self, id: i64, filter: &ReadFilter, limit: usize, ) -> Result<Vec<Event>>
pub fn delete( &self, kind: RecordKind, id: i64, filter: &ReadFilter, ) -> Result<WriteReceipt<bool>>
Source§impl GraphStore
impl GraphStore
Sourcepub fn build_graph(&self, filter: &ReadFilter) -> Result<GraphView>
pub fn build_graph(&self, filter: &ReadFilter) -> Result<GraphView>
把 filter 范围(namespace/scope/tag)内的实体铺成节点、关系连成边,建一张有向图。
节点来自 entity 记录(含没有关系的孤立实体,「谁没连进主图」才看得出来), 边来自 relation 记录。范围外的记录不进图——多命名空间不会串。
Sourcepub fn strongly_connected(&self, filter: &ReadFilter) -> Result<Vec<Vec<i64>>>
pub fn strongly_connected(&self, filter: &ReadFilter) -> Result<Vec<Vec<i64>>>
强连通分量(有向,tarjan_scc):互相可达的实体环,如「互为对手/同伙」的闭环。
只返回大小 > 1 的分量,孤点自环被滤掉。
Sourcepub fn ego(
&self,
root: i64,
depth: usize,
filter: &ReadFilter,
limit: usize,
) -> Result<Vec<Entity>>
pub fn ego( &self, root: i64, depth: usize, filter: &ReadFilter, limit: usize, ) -> Result<Vec<Entity>>
从 root 出发 depth 跳内的实体(带 name / aliases / attributes)。
Sourcepub fn path(
&self,
from: i64,
to: i64,
filter: &ReadFilter,
) -> Result<Option<Vec<Entity>>>
pub fn path( &self, from: i64, to: i64, filter: &ReadFilter, ) -> Result<Option<Vec<Entity>>>
from → to 桥接路径上的实体(含两端)。不连通返回 None。
Sourcepub fn set_predicate_rule(
&self,
predicate: &str,
inverse: Option<&str>,
symmetric: bool,
) -> Result<WriteReceipt<()>>
pub fn set_predicate_rule( &self, predicate: &str, inverse: Option<&str>, symmetric: bool, ) -> Result<WriteReceipt<()>>
登记谓词元规则:symmetric 声明对称谓词(反向即自身),inverse 声明逆谓词
(反向补一条对偶边,如 父亲 的逆是 子女)。二者互斥,规则只影响建图时的内存补边。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GraphStore
impl !UnwindSafe for GraphStore
impl Freeze for GraphStore
impl Send for GraphStore
impl Sync for GraphStore
impl Unpin for GraphStore
impl UnsafeUnpin for GraphStore
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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