pub struct TribleSet {
pub eav: PATCH<TRIBLE_LEN, EAVOrder, ()>,
pub vea: PATCH<TRIBLE_LEN, VEAOrder, ()>,
pub ave: PATCH<TRIBLE_LEN, AVEOrder, ()>,
pub vae: PATCH<TRIBLE_LEN, VAEOrder, ()>,
pub eva: PATCH<TRIBLE_LEN, EVAOrder, ()>,
pub aev: PATCH<TRIBLE_LEN, AEVOrder, ()>,
}Expand description
Re-export of TribleSet.
A collection of Tribles.
A TribleSet is a collection of Tribles that can be queried and manipulated.
It supports efficient set operations like union, intersection, and difference.
The stored Tribles are indexed by the six possible orderings of their fields
in corresponding PATCHes.
Clone is extremely cheap and can be used to create a snapshot of the current state of the TribleSet.
Note that the TribleSet does not support an explicit delete/remove operation,
as this would conflict with the CRDT semantics of the TribleSet and CALM principles as a whole.
It does allow for set subtraction, but that operation is meant to compute the difference between two sets
and not to remove elements from the set. A subtle but important distinction.
Fields§
§eav: PATCH<TRIBLE_LEN, EAVOrder, ()>Entity → Attribute → Inline index.
vea: PATCH<TRIBLE_LEN, VEAOrder, ()>Inline → Entity → Attribute index.
ave: PATCH<TRIBLE_LEN, AVEOrder, ()>Attribute → Inline → Entity index.
vae: PATCH<TRIBLE_LEN, VAEOrder, ()>Inline → Attribute → Entity index.
eva: PATCH<TRIBLE_LEN, EVAOrder, ()>Entity → Inline → Attribute index.
aev: PATCH<TRIBLE_LEN, AEVOrder, ()>Attribute → Entity → Inline index.
Implementations§
Source§impl TribleSet
impl TribleSet
Sourcepub fn union(&mut self, other: Self)
pub fn union(&mut self, other: Self)
Union of two TribleSets.
The other TribleSet is consumed, and this TribleSet is updated
in place.
With the parallel feature enabled and other above
[PARALLEL_UNION_THRESHOLD] tribles, the six index unions
(eav/eva/aev/ave/vea/vae) fan out via nested
rayon::join — they touch disjoint memory so there’s no
contention. The threshold gates on other.len() because PATCH
union work is bounded by the smaller side (each key from other
is inserted into self); when other is tiny (e.g. the per-
entity!{} += in a serial fold) the rayon overhead would
dominate even at large self.
Sourcepub fn intersect(&self, other: &Self) -> Self
pub fn intersect(&self, other: &Self) -> Self
Returns a new set containing only tribles present in both sets.
Sourcepub fn difference(&self, other: &Self) -> Self
pub fn difference(&self, other: &Self) -> Self
Returns a new set containing tribles in self but not in other.
Sourcepub fn fingerprint(&self) -> TribleSetFingerprint
pub fn fingerprint(&self) -> TribleSetFingerprint
Sourcepub fn contains(&self, trible: &Trible) -> bool
pub fn contains(&self, trible: &Trible) -> bool
Returns true when the exact trible is present in the set.
Sourcepub fn value_in_range<V: InlineEncoding>(
&self,
variable: Variable<V>,
min: Inline<V>,
max: Inline<V>,
) -> TribleSetRangeConstraint
pub fn value_in_range<V: InlineEncoding>( &self, variable: Variable<V>, min: Inline<V>, max: Inline<V>, ) -> TribleSetRangeConstraint
Creates a constraint that proposes only values in the byte range
[min, max] (inclusive) using the VEA index with infixes_range.
Use with and! alongside a pattern! for efficient range queries:
find!(ts: Inline<NsTAIInterval>,
and!(
pattern!(&data, [{ ?id @ attr: ?ts }]),
data.value_in_range(ts, min_ts, max_ts),
)
)Sourcepub fn entity_in_range(
&self,
variable: Variable<GenId>,
min: Id,
max: Id,
) -> EntityRangeConstraint
pub fn entity_in_range( &self, variable: Variable<GenId>, min: Id, max: Id, ) -> EntityRangeConstraint
Creates a constraint that proposes only entity IDs in the byte range
[min, max] (inclusive) using the EAV index with infixes_range.
find!(id: Id,
and!(
pattern!(&data, [{ ?id @ attr: value }]),
data.entity_in_range(id, min_id, max_id),
)
)Sourcepub fn attribute_in_range(
&self,
variable: Variable<GenId>,
min: Id,
max: Id,
) -> AttributeRangeConstraint
pub fn attribute_in_range( &self, variable: Variable<GenId>, min: Id, max: Id, ) -> AttributeRangeConstraint
Creates a constraint that proposes only attribute IDs in the byte range
[min, max] (inclusive) using the AEV index with infixes_range.
find!(attr: Id,
and!(
pattern!(&data, [{ entity @ ?attr: _ }]),
data.attribute_in_range(attr, min_attr, max_attr),
)
)Trait Implementations§
Source§impl AddAssign<Fragment> for TribleSet
impl AddAssign<Fragment> for TribleSet
Source§fn add_assign(&mut self, rhs: Fragment)
fn add_assign(&mut self, rhs: Fragment)
+= operation. Read moreSource§impl AddAssign<TribleSet> for Fragment
impl AddAssign<TribleSet> for Fragment
Source§fn add_assign(&mut self, rhs: TribleSet)
fn add_assign(&mut self, rhs: TribleSet)
Facts-only merge — does not touch exports or blobs.
Source§impl AddAssign for TribleSet
impl AddAssign for TribleSet
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl Encodes<&TribleSet> for SimpleArchive
impl Encodes<&TribleSet> for SimpleArchive
Source§type Output = Blob<SimpleArchive>
type Output = Blob<SimpleArchive>
Inline<Self> for inline encodings, Blob<Self> for
blob encodings, or Inline<Handle<Self>> for the
precomputed-handle case where Self: BlobEncoding.Source§impl Encodes<TribleSet> for SimpleArchive
impl Encodes<TribleSet> for SimpleArchive
Source§type Output = Blob<SimpleArchive>
type Output = Blob<SimpleArchive>
Inline<Self> for inline encodings, Blob<Self> for
blob encodings, or Inline<Handle<Self>> for the
precomputed-handle case where Self: BlobEncoding.Source§impl<U> From<&SuccinctArchive<U>> for TribleSetwhere
U: Universe,
impl<U> From<&SuccinctArchive<U>> for TribleSetwhere
U: Universe,
Source§fn from(archive: &SuccinctArchive<U>) -> Self
fn from(archive: &SuccinctArchive<U>) -> Self
Source§impl<U> From<&TribleSet> for SuccinctArchive<U>
impl<U> From<&TribleSet> for SuccinctArchive<U>
Source§impl From<&TribleSet> for TribleSetFingerprint
impl From<&TribleSet> for TribleSetFingerprint
Source§impl From<TribleSet> for Fragment
Lossless promotion: a TribleSet becomes a Fragment with no
exported root and an empty blob store. The reverse direction is
intentionally not implemented — going from Fragment to
TribleSet discards the embedded blob store and exports, so it
has to be explicit (Fragment::into_facts).
impl From<TribleSet> for Fragment
Lossless promotion: a TribleSet becomes a Fragment with no
exported root and an empty blob store. The reverse direction is
intentionally not implemented — going from Fragment to
TribleSet discards the embedded blob store and exports, so it
has to be explicit (Fragment::into_facts).
Source§impl FromIterator<Trible> for TribleSet
impl FromIterator<Trible> for TribleSet
Source§impl<'a> IntoIterator for &'a TribleSet
impl<'a> IntoIterator for &'a TribleSet
Source§impl TriblePattern for TribleSet
impl TriblePattern for TribleSet
Source§type PatternConstraint<'a> = TribleSetConstraint
type PatternConstraint<'a> = TribleSetConstraint
Source§fn pattern<V: InlineEncoding>(
&self,
e: Variable<GenId>,
a: Variable<GenId>,
v: Variable<V>,
) -> Self::PatternConstraint<'static>
fn pattern<V: InlineEncoding>( &self, e: Variable<GenId>, a: Variable<GenId>, v: Variable<V>, ) -> Self::PatternConstraint<'static>
Source§impl TryFromBlob<SimpleArchive> for TribleSet
impl TryFromBlob<SimpleArchive> for TribleSet
Source§type Error = UnarchiveError
type Error = UnarchiveError
Source§fn try_from_blob(blob: Blob<SimpleArchive>) -> Result<Self, Self::Error>
fn try_from_blob(blob: Blob<SimpleArchive>) -> Result<Self, Self::Error>
impl Eq for TribleSet
Auto Trait Implementations§
impl Freeze for TribleSet
impl RefUnwindSafe for TribleSet
impl Send for TribleSet
impl Sync for TribleSet
impl Unpin for TribleSet
impl UnsafeUnpin for TribleSet
impl UnwindSafe for TribleSet
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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