pub struct BatchOperations;Expand description
Batch operations for efficient bulk processing.
Implementations§
Source§impl BatchOperations
impl BatchOperations
Sourcepub fn add_domains(
table: &mut SymbolTable,
domains: Vec<DomainInfo>,
) -> Result<()>
pub fn add_domains( table: &mut SymbolTable, domains: Vec<DomainInfo>, ) -> Result<()>
Add multiple domains at once with validation.
§Examples
use tensorlogic_adapters::{SymbolTable, DomainInfo, BatchOperations};
let mut table = SymbolTable::new();
let domains = vec![
DomainInfo::new("Person", 100),
DomainInfo::new("Organization", 50),
];
let result = BatchOperations::add_domains(&mut table, domains);
assert!(result.is_ok());
assert_eq!(table.domains.len(), 2);Sourcepub fn add_predicates(
table: &mut SymbolTable,
predicates: Vec<PredicateInfo>,
) -> Result<()>
pub fn add_predicates( table: &mut SymbolTable, predicates: Vec<PredicateInfo>, ) -> Result<()>
Add multiple predicates at once with validation.
§Examples
use tensorlogic_adapters::{SymbolTable, DomainInfo, PredicateInfo, BatchOperations};
let mut table = SymbolTable::new();
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
let predicates = vec![
PredicateInfo::new("knows", vec!["Person".to_string(), "Person".to_string()]),
PredicateInfo::new("age", vec!["Person".to_string()]),
];
let result = BatchOperations::add_predicates(&mut table, predicates);
assert!(result.is_ok());
assert_eq!(table.predicates.len(), 2);Sourcepub fn bind_variables(
table: &mut SymbolTable,
bindings: HashMap<String, String>,
) -> Result<()>
pub fn bind_variables( table: &mut SymbolTable, bindings: HashMap<String, String>, ) -> Result<()>
Bind multiple variables at once.
§Examples
use tensorlogic_adapters::{SymbolTable, DomainInfo, BatchOperations};
use std::collections::HashMap;
let mut table = SymbolTable::new();
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
let mut bindings = HashMap::new();
bindings.insert("x".to_string(), "Person".to_string());
bindings.insert("y".to_string(), "Person".to_string());
let result = BatchOperations::bind_variables(&mut table, bindings);
assert!(result.is_ok());
assert_eq!(table.variables.len(), 2);Auto Trait Implementations§
impl Freeze for BatchOperations
impl RefUnwindSafe for BatchOperations
impl Send for BatchOperations
impl Sync for BatchOperations
impl Unpin for BatchOperations
impl UnwindSafe for BatchOperations
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