Skip to main content

BatchOperations

Struct BatchOperations 

Source
pub struct BatchOperations;
Expand description

Batch operations for efficient bulk processing.

Implementations§

Source§

impl BatchOperations

Source

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);
Source

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);
Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.