Expand description
Adapter utilities for the Tensorlogic ecosystem.
Version: 0.1.0-beta.1 | Status: Production Ready
This crate provides the bridge between logical expressions and tensor execution by managing symbol tables, domain hierarchies, and schema validation.
§Overview
tensorlogic-adapters offers a comprehensive system for managing the metadata
and structure of logical systems compiled to tensor operations. It provides:
- Symbol tables - Central registry for predicates, domains, and variables
- Domain hierarchies - Type relationships with subtyping and inheritance
- Parametric types - Generic domains like
List<T>,Option<T>,Map<K,V> - Predicate composition - Define predicates in terms of other predicates
- Rich metadata - Provenance tracking, documentation, version history
- Schema validation - Completeness, consistency, and semantic checks
§Quick Start
use tensorlogic_adapters::{SymbolTable, DomainInfo, PredicateInfo};
// Create a symbol table
let mut table = SymbolTable::new();
// Add a domain
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
// Add a predicate
let knows = PredicateInfo::new(
"knows",
vec!["Person".to_string(), "Person".to_string()]
);
table.add_predicate(knows).unwrap();
// Bind a variable
table.bind_variable("x", "Person").unwrap();§Features
§Domain Hierarchies
Define type hierarchies with subtype relationships:
use tensorlogic_adapters::DomainHierarchy;
let mut hierarchy = DomainHierarchy::new();
hierarchy.add_subtype("Student", "Person");
hierarchy.add_subtype("Person", "Agent");
assert!(hierarchy.is_subtype("Student", "Agent")); // Transitive§Parametric Types
Create generic domain types:
use tensorlogic_adapters::{ParametricType, TypeParameter};
let list_person = ParametricType::list(
TypeParameter::concrete("Person")
);
assert_eq!(list_person.to_string(), "List<Person>");§Schema Validation
Validate schemas for correctness:
use tensorlogic_adapters::{SymbolTable, SchemaValidator, DomainInfo};
let mut table = SymbolTable::new();
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
let validator = SchemaValidator::new(&table);
let report = validator.validate().unwrap();
assert!(report.errors.is_empty());Modules§
- dependent_
patterns - Common dependent type patterns.
Structs§
- Advanced
Export Bundle - Advanced export bundle containing type system information.
- Affected
Components - Components affected by changes
- Auto
Completer - Auto-completion engine for schema construction.
- Auto
Completer Stats - Statistics about the auto-completer.
- Axis
Metadata - Axis metadata linking variables to tensor dimensions
- Batch
Operations - Batch operations for efficient bulk processing.
- Breaking
Change - Breaking change with detailed information
- Cache
Config - Configuration for the query cache.
- Cache
Stats - Cache statistics.
- Cached
Result - A cached query result with metadata.
- Change
- Change record with timestamp and metadata
- Change
Stats - Statistics about recorded changes
- Change
Tracker - Tracks changes to a symbol table for incremental validation
- Compact
Schema - Compact representation of a symbol table.
- Compatibility
Report - Compatibility analysis result
- Compiler
Export - Export utilities for compiler integration.
- Compiler
Export Advanced - Advanced export utilities for compiler integration with type systems.
- Compiler
Export Bundle - Complete export bundle for compiler integration.
- Compiler
Import - Import utilities for reverse synchronization.
- Complete
Export Bundle - Complete compiler integration bundle combining basic and advanced exports.
- Composite
Predicate - A composable predicate definition that can be expanded.
- Composite
Registry - A registry of composite predicates for lookup and expansion.
- Compression
Stats - Compression statistics for compact schemas.
- Computed
Domain - A computed domain that is derived from other domains.
- Computed
Domain Registry - Registry for managing computed domains.
- Confidence
Score - Confidence score for inferred schema elements.
- Conversion
Utils - Conversion utilities for different formats.
- Data
Sample - Sample data for schema learning.
- Database
Stats - Statistics about database storage.
- Dependency
Graph - Dependency graph for schema components
- Dependent
Type - A dependent type with dimension parameters.
- Dependent
Type Context - Context for evaluating dependent types.
- Dependent
Type Registry - Registry for managing dependent types.
- Diff
Summary - Summary statistics for a schema diff.
- DimConstraint
- A constraint between dimension expressions.
- Documentation
- Long-form documentation with examples and usage notes.
- Domain
Conflict - Information about a domain conflict.
- Domain
Hierarchy - Domain hierarchy tracking subtype relationships
- Domain
Info - Domain information including cardinality and optional element enumeration
- Domain
Mask - Domain mask for filtering and constraints
- Domain
Modification - Modification details for a domain.
- Domain
Suggestion - Suggestion for a domain.
- Effect
Context - Context for tracking effects.
- Effect
Handler - An effect handler that can handle specific effects.
- Effect
Registry - Registry for effect-annotated functions.
- Effect
Set - A set of computational effects.
- Effect
Signature - An effect signature for a function.
- Embedding
Weights - Weights for different embedding features.
- Evolution
Analyzer - Schema evolution analyzer
- Example
- An example demonstrating how to use a symbol.
- File
Schema Loader - File-based schema loader that reads from a directory structure.
- Functional
Dependency - Functional dependency between predicate arguments
- GraphQL
Codegen - Code generator for GraphQL schemas from symbol tables.
- InMemory
Sync Protocol - In-memory sync protocol for testing and single-process scenarios.
- Incremental
Validation Report - Incremental validation report with performance metrics
- Incremental
Validator - Incremental validator for symbol tables
- Inference
Config - Configuration for schema inference.
- Lazy
Load Stats - Statistics about lazy loading behavior.
- Lazy
Symbol Table - A symbol table with lazy loading support.
- Learning
Statistics - Statistics about the learning process.
- Linear
Context - Context for tracking linear resources.
- Linear
Statistics - Statistics about linear resource usage.
- Linear
Type - A linear type with usage constraints.
- Linear
Type Registry - Registry for linear type definitions.
- Lock
Stats - Statistics about lock usage and contention.
- Locked
Symbol Table - A thread-safe symbol table with read/write locking.
- Lookup
Cache - Cache for frequently accessed lookups.
- Matcher
Stats - Statistics about the signature matcher indices.
- Memory
Database - In-memory database implementation for testing and development.
- Memory
Stats - Memory usage statistics for a string interner.
- Merge
Report - Report of a merge operation.
- Merge
Result - Result of a merge operation.
- Metadata
- Rich metadata container for domains and predicates.
- Migration
Plan - Migration plan
- NodeId
- Unique identifier for a node in the distributed system.
- Parametric
Type - A parameterized domain type with type parameters.
- Pattern
Matcher - Pattern matcher for schema recommendations.
- Predicate
Conflict - Information about a predicate conflict.
- Predicate
Constraints - Constraints associated with a predicate
- Predicate
Info - Predicate metadata including arity and domain types
- Predicate
Modification - Modification details for a predicate.
- Predicate
Pattern - Pattern for predicate matching
- Predicate
Suggestion - Suggestion for a predicate.
- Predicate
Template - A template for creating multiple similar predicates.
- Product
Domain - A product domain representing a tuple of component domains.
- Provenance
- Provenance information tracking the origin and history of a symbol.
- Python
Codegen - Code generator for Python type stubs and PyO3 bindings.
- Query
Cache - A generic query result cache with TTL and LRU eviction.
- Query
Cache Stats - Statistics for query cache performance.
- Query
Plan - Query execution plan
- Query
Planner - Query planner for optimizing predicate lookups
- Query
Statistics - Statistics about predicate access patterns
- Query
Utils - Query utilities for advanced filtering and searching.
- Recommendation
Context - Context for generating recommendations.
- Recommender
Stats - Statistics about the recommendation engine.
- Refinement
Context - Context for evaluating dependent refinement predicates.
- Refinement
Registry - Registry for managing refinement types.
- Refinement
Type - A refinement type combining a base type with predicates.
- Resource
- A resource tracked by the linear type system.
- Rust
Codegen - Code generator for Rust types from schemas.
- Schema
Analyzer - Analyzer for generating schema recommendations.
- Schema
Builder - Builder for constructing SymbolTable instances.
- Schema
DatabaseSQL - SQL query generator for schema database operations.
- Schema
Diff - Comparison result for two symbol tables.
- Schema
Embedder - Schema element embedding generator.
- Schema
Id - Unique identifier for a stored schema.
- Schema
Learner - Schema learner for automatic inference from data.
- Schema
Merger - A schema merger with configurable strategies.
- Schema
Metadata - Metadata about a stored schema.
- Schema
Recommendations - Schema recommendations based on analysis.
- Schema
Recommender - Schema recommendation engine.
- Schema
Score - A scored schema recommendation.
- Schema
Statistics - Comprehensive statistics about a schema.
- Schema
Validator - Schema validator for symbol tables
- Schema
Version - Version information for a schema.
- Signature
Matcher - Indexed structure for fast predicate signature matching.
- Similarity
Search - Schema similarity search engine.
- Similarity
Stats - Statistics about indexed elements in similarity search.
- Statistics
Utils - Statistics utilities for metrics collection.
- String
Interner - String interner for reducing memory usage of repeated strings.
- Symbol
Table - Symbol table containing all domain, predicate, and variable information
- Symbol
Table Cache - A specialized cache for symbol table queries.
- Symbol
Table Sync - Bidirectional synchronization utilities.
- Sync
Event - A synchronization event representing a schema change.
- Sync
Statistics - Statistics about synchronization operations.
- Synchronization
Manager - Manager for distributed schema synchronization.
- TagCategory
- A tag category for organizing tags into groups.
- TagRegistry
- A registry of tag categories for organizing the tag namespace.
- Transaction
- A transaction for atomic operations on a symbol table.
- Type
Bound - A type bound that constrains a type parameter.
- Type
Script Codegen - Code generator for TypeScript definitions from symbol tables.
- Validation
Cache - Cache for validation results
- Validation
Report - Validation results with errors, warnings, and hints
- Validation
Result - Result of bundle validation.
- Validation
Utils - Validation utilities for enhanced checking.
- Value
Range - Value range constraint for numeric predicates
- Variable
Conflict - Information about a variable conflict.
- Variable
Modification - Modification details for a variable binding.
- Variable
Suggestion - Suggestion for a variable name.
- Vector
Clock - Vector clock for tracking causality in distributed systems.
- Version
Entry - A version history entry tracking changes to a symbol.
Enums§
- Adapter
Error - Apply
Result - Result of applying a sync event.
- Bound
Constraint - The kind of constraint in a type bound.
- Cache
Key - A cache key for query results.
- Change
Impact - Impact level of a change
- Change
Kind - Type of schema change
- Change
Type - Type of schema change
- Compatibility
Level - Compute schema compatibility between two versions.
- Conflict
Resolution - Conflict resolution strategy.
- Dependent
Relation - Relation for dependent predicates.
- DimExpr
- A dimension expression that can be evaluated.
- DimRelation
- Relation for dimension constraints.
- Domain
Computation - Types of domain computations.
- Effect
- A computational effect that can be tracked.
- Effect
Row - An effect row for row polymorphism.
- Index
Strategy - Index strategy for predicate lookups
- Linear
Error - Error types for linear type violations.
- Linear
Kind - The kind of linearity constraint.
- Load
Strategy - Strategy for loading schema elements.
- Merge
Conflict Resolution - How a merge conflict was resolved.
- Merge
Strategy - Strategy for resolving conflicts during schema merging.
- Migration
Step - Migration step
- Ownership
- Ownership state of a resource.
- Predicate
Body - The body of a composite predicate.
- Predicate
Property - Properties that can be associated with predicates
- Predicate
Query - Query for predicates
- Recommendation
Strategy - Strategy for generating recommendations.
- Refinement
Predicate - A refinement predicate that constrains values.
- Schema
Issue - Types of schema issues that can be detected.
- Suggestion
Source - Source of an auto-completion suggestion.
- Sync
Change Type - Type of synchronization change event.
- Type
Parameter - A type parameter that can be either a concrete type or another parametric type.
- Version
Bump - Semantic version bump recommendation
Constants§
- EMBEDDING_
DIM - Dimensionality of the embedding vectors.
Traits§
- Event
Listener - Event listener for synchronization events.
- Lock
With Timeout - Extension trait for timeout-based lock acquisition.
- Product
Domain Ext - Extension trait for SymbolTable to support product domains.
- Schema
Database - Database storage trait for symbol tables.
- Schema
Loader - A loader trait for fetching schema elements on demand.
- Sync
Protocol - Protocol for transmitting sync events.
Functions§
- check_
compatibility - Determine compatibility level between two schemas.
- compute_
diff - Compute the difference between two symbol tables.
- infer_
effects - Infer effects for a sequence of operations.
- merge_
tables - Merge two symbol tables, preferring values from the newer table.
Type Aliases§
- Embedding
- Vector embedding representation.