Skip to main content

compute_diff

Function compute_diff 

Source
pub fn compute_diff(old: &SymbolTable, new: &SymbolTable) -> SchemaDiff
Expand description

Compute the difference between two symbol tables.

ยงExample

use tensorlogic_adapters::{SymbolTable, DomainInfo, compute_diff};

let mut old_table = SymbolTable::new();
old_table.add_domain(DomainInfo::new("Person", 100)).unwrap();

let mut new_table = SymbolTable::new();
new_table.add_domain(DomainInfo::new("Person", 100)).unwrap();
new_table.add_domain(DomainInfo::new("Location", 50)).unwrap();

let diff = compute_diff(&old_table, &new_table);
assert_eq!(diff.domains_added.len(), 1);
assert!(diff.is_backward_compatible());