pub struct ConversionUtils;Expand description
Conversion utilities for different formats.
Implementations§
Source§impl ConversionUtils
impl ConversionUtils
Sourcepub fn to_summary(table: &SymbolTable) -> String
pub fn to_summary(table: &SymbolTable) -> String
Convert a symbol table to a compact summary string.
§Examples
use tensorlogic_adapters::{SymbolTable, DomainInfo, ConversionUtils};
let mut table = SymbolTable::new();
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
let summary = ConversionUtils::to_summary(&table);
assert!(summary.contains("Domains: 1"));Sourcepub fn extract_domain_names(table: &SymbolTable) -> Vec<String>
pub fn extract_domain_names(table: &SymbolTable) -> Vec<String>
Extract domain names as a sorted vector.
§Examples
use tensorlogic_adapters::{SymbolTable, DomainInfo, ConversionUtils};
let mut table = SymbolTable::new();
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
table.add_domain(DomainInfo::new("Organization", 50)).unwrap();
let names = ConversionUtils::extract_domain_names(&table);
assert_eq!(names, vec!["Organization", "Person"]);Sourcepub fn extract_predicate_names(table: &SymbolTable) -> Vec<String>
pub fn extract_predicate_names(table: &SymbolTable) -> Vec<String>
Extract predicate names as a sorted vector.
§Examples
use tensorlogic_adapters::{SymbolTable, DomainInfo, PredicateInfo, ConversionUtils};
let mut table = SymbolTable::new();
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
table.add_predicate(PredicateInfo::new("knows", vec!["Person".to_string()])).unwrap();
let names = ConversionUtils::extract_predicate_names(&table);
assert_eq!(names, vec!["knows"]);Auto Trait Implementations§
impl Freeze for ConversionUtils
impl RefUnwindSafe for ConversionUtils
impl Send for ConversionUtils
impl Sync for ConversionUtils
impl Unpin for ConversionUtils
impl UnwindSafe for ConversionUtils
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