pub struct ComputedDomain { /* private fields */ }Expand description
A computed domain that is derived from other domains.
Computed domains are evaluated lazily and can represent complex domain transformations without materializing all elements.
§Examples
use tensorlogic_adapters::{ComputedDomain, DomainComputation};
// Filter domain
let adults = ComputedDomain::new(
"Adults",
DomainComputation::Filter {
base: "Person".to_string(),
predicate: "is_adult".to_string(),
}
);
// Union domain
let entities = ComputedDomain::new(
"Entities",
DomainComputation::Union {
domains: vec!["Person".to_string(), "Organization".to_string()],
}
);Implementations§
Source§impl ComputedDomain
impl ComputedDomain
Sourcepub fn new(name: impl Into<String>, computation: DomainComputation) -> Self
pub fn new(name: impl Into<String>, computation: DomainComputation) -> Self
Create a new computed domain.
§Examples
use tensorlogic_adapters::{ComputedDomain, DomainComputation};
let domain = ComputedDomain::new(
"FilteredDomain",
DomainComputation::Filter {
base: "Base".to_string(),
predicate: "pred".to_string(),
}
);Sourcepub fn with_cardinality_estimate(self, estimate: usize) -> Self
pub fn with_cardinality_estimate(self, estimate: usize) -> Self
Set a cardinality estimate for this computed domain.
§Examples
use tensorlogic_adapters::{ComputedDomain, DomainComputation};
let domain = ComputedDomain::new(
"Adults",
DomainComputation::Filter {
base: "Person".to_string(),
predicate: "is_adult".to_string(),
}
).with_cardinality_estimate(750);Sourcepub fn computation(&self) -> &DomainComputation
pub fn computation(&self) -> &DomainComputation
Get the computation defining this domain.
Sourcepub fn cardinality_estimate(&self) -> Option<usize>
pub fn cardinality_estimate(&self) -> Option<usize>
Get the cardinality estimate if available.
Sourcepub fn is_materialized(&self) -> bool
pub fn is_materialized(&self) -> bool
Check if this domain is materialized.
Sourcepub fn cardinality_bounds(
&self,
table: &SymbolTable,
) -> Result<(usize, usize), AdapterError>
pub fn cardinality_bounds( &self, table: &SymbolTable, ) -> Result<(usize, usize), AdapterError>
Compute the cardinality bounds for this domain.
Returns (lower_bound, upper_bound) or an error if dependencies are missing.
Sourcepub fn validate(&self, table: &SymbolTable) -> Result<(), AdapterError>
pub fn validate(&self, table: &SymbolTable) -> Result<(), AdapterError>
Validate that all dependencies exist in the symbol table.
Sourcepub fn materialize(&mut self)
pub fn materialize(&mut self)
Mark this domain as materialized.
Trait Implementations§
Source§impl Clone for ComputedDomain
impl Clone for ComputedDomain
Source§fn clone(&self) -> ComputedDomain
fn clone(&self) -> ComputedDomain
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 ComputedDomain
impl Debug for ComputedDomain
Source§impl<'de> Deserialize<'de> for ComputedDomain
impl<'de> Deserialize<'de> for ComputedDomain
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
Source§impl Display for ComputedDomain
impl Display for ComputedDomain
Source§impl PartialEq for ComputedDomain
impl PartialEq for ComputedDomain
Source§impl Serialize for ComputedDomain
impl Serialize for ComputedDomain
impl Eq for ComputedDomain
impl StructuralPartialEq for ComputedDomain
Auto Trait Implementations§
impl Freeze for ComputedDomain
impl RefUnwindSafe for ComputedDomain
impl Send for ComputedDomain
impl Sync for ComputedDomain
impl Unpin for ComputedDomain
impl UnwindSafe for ComputedDomain
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<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
Compare self to
key and return true if they are equal.