Skip to main content

Crate tensorlogic_adapters

Crate tensorlogic_adapters 

Source
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§

AdvancedExportBundle
Advanced export bundle containing type system information.
AffectedComponents
Components affected by changes
AutoCompleter
Auto-completion engine for schema construction.
AutoCompleterStats
Statistics about the auto-completer.
AxisMetadata
Axis metadata linking variables to tensor dimensions
BatchOperations
Batch operations for efficient bulk processing.
BreakingChange
Breaking change with detailed information
CacheConfig
Configuration for the query cache.
CacheStats
Cache statistics.
CachedResult
A cached query result with metadata.
Change
Change record with timestamp and metadata
ChangeStats
Statistics about recorded changes
ChangeTracker
Tracks changes to a symbol table for incremental validation
CompactSchema
Compact representation of a symbol table.
CompatibilityReport
Compatibility analysis result
CompilerExport
Export utilities for compiler integration.
CompilerExportAdvanced
Advanced export utilities for compiler integration with type systems.
CompilerExportBundle
Complete export bundle for compiler integration.
CompilerImport
Import utilities for reverse synchronization.
CompleteExportBundle
Complete compiler integration bundle combining basic and advanced exports.
CompositePredicate
A composable predicate definition that can be expanded.
CompositeRegistry
A registry of composite predicates for lookup and expansion.
CompressionStats
Compression statistics for compact schemas.
ComputedDomain
A computed domain that is derived from other domains.
ComputedDomainRegistry
Registry for managing computed domains.
ConfidenceScore
Confidence score for inferred schema elements.
ConversionUtils
Conversion utilities for different formats.
DataSample
Sample data for schema learning.
DatabaseStats
Statistics about database storage.
DependencyGraph
Dependency graph for schema components
DependentType
A dependent type with dimension parameters.
DependentTypeContext
Context for evaluating dependent types.
DependentTypeRegistry
Registry for managing dependent types.
DiffSummary
Summary statistics for a schema diff.
DimConstraint
A constraint between dimension expressions.
Documentation
Long-form documentation with examples and usage notes.
DomainConflict
Information about a domain conflict.
DomainHierarchy
Domain hierarchy tracking subtype relationships
DomainInfo
Domain information including cardinality and optional element enumeration
DomainMask
Domain mask for filtering and constraints
DomainModification
Modification details for a domain.
DomainSuggestion
Suggestion for a domain.
EffectContext
Context for tracking effects.
EffectHandler
An effect handler that can handle specific effects.
EffectRegistry
Registry for effect-annotated functions.
EffectSet
A set of computational effects.
EffectSignature
An effect signature for a function.
EmbeddingWeights
Weights for different embedding features.
EvolutionAnalyzer
Schema evolution analyzer
Example
An example demonstrating how to use a symbol.
FileSchemaLoader
File-based schema loader that reads from a directory structure.
FunctionalDependency
Functional dependency between predicate arguments
GraphQLCodegen
Code generator for GraphQL schemas from symbol tables.
InMemorySyncProtocol
In-memory sync protocol for testing and single-process scenarios.
IncrementalValidationReport
Incremental validation report with performance metrics
IncrementalValidator
Incremental validator for symbol tables
InferenceConfig
Configuration for schema inference.
LazyLoadStats
Statistics about lazy loading behavior.
LazySymbolTable
A symbol table with lazy loading support.
LearningStatistics
Statistics about the learning process.
LinearContext
Context for tracking linear resources.
LinearStatistics
Statistics about linear resource usage.
LinearType
A linear type with usage constraints.
LinearTypeRegistry
Registry for linear type definitions.
LockStats
Statistics about lock usage and contention.
LockedSymbolTable
A thread-safe symbol table with read/write locking.
LookupCache
Cache for frequently accessed lookups.
MatcherStats
Statistics about the signature matcher indices.
MemoryDatabase
In-memory database implementation for testing and development.
MemoryStats
Memory usage statistics for a string interner.
MergeReport
Report of a merge operation.
MergeResult
Result of a merge operation.
Metadata
Rich metadata container for domains and predicates.
MigrationPlan
Migration plan
NodeId
Unique identifier for a node in the distributed system.
ParametricType
A parameterized domain type with type parameters.
PatternMatcher
Pattern matcher for schema recommendations.
PredicateConflict
Information about a predicate conflict.
PredicateConstraints
Constraints associated with a predicate
PredicateInfo
Predicate metadata including arity and domain types
PredicateModification
Modification details for a predicate.
PredicatePattern
Pattern for predicate matching
PredicateSuggestion
Suggestion for a predicate.
PredicateTemplate
A template for creating multiple similar predicates.
ProductDomain
A product domain representing a tuple of component domains.
Provenance
Provenance information tracking the origin and history of a symbol.
PythonCodegen
Code generator for Python type stubs and PyO3 bindings.
QueryCache
A generic query result cache with TTL and LRU eviction.
QueryCacheStats
Statistics for query cache performance.
QueryPlan
Query execution plan
QueryPlanner
Query planner for optimizing predicate lookups
QueryStatistics
Statistics about predicate access patterns
QueryUtils
Query utilities for advanced filtering and searching.
RecommendationContext
Context for generating recommendations.
RecommenderStats
Statistics about the recommendation engine.
RefinementContext
Context for evaluating dependent refinement predicates.
RefinementRegistry
Registry for managing refinement types.
RefinementType
A refinement type combining a base type with predicates.
Resource
A resource tracked by the linear type system.
RustCodegen
Code generator for Rust types from schemas.
SchemaAnalyzer
Analyzer for generating schema recommendations.
SchemaBuilder
Builder for constructing SymbolTable instances.
SchemaDatabaseSQL
SQL query generator for schema database operations.
SchemaDiff
Comparison result for two symbol tables.
SchemaEmbedder
Schema element embedding generator.
SchemaId
Unique identifier for a stored schema.
SchemaLearner
Schema learner for automatic inference from data.
SchemaMerger
A schema merger with configurable strategies.
SchemaMetadata
Metadata about a stored schema.
SchemaRecommendations
Schema recommendations based on analysis.
SchemaRecommender
Schema recommendation engine.
SchemaScore
A scored schema recommendation.
SchemaStatistics
Comprehensive statistics about a schema.
SchemaValidator
Schema validator for symbol tables
SchemaVersion
Version information for a schema.
SignatureMatcher
Indexed structure for fast predicate signature matching.
SimilaritySearch
Schema similarity search engine.
SimilarityStats
Statistics about indexed elements in similarity search.
StatisticsUtils
Statistics utilities for metrics collection.
StringInterner
String interner for reducing memory usage of repeated strings.
SymbolTable
Symbol table containing all domain, predicate, and variable information
SymbolTableCache
A specialized cache for symbol table queries.
SymbolTableSync
Bidirectional synchronization utilities.
SyncEvent
A synchronization event representing a schema change.
SyncStatistics
Statistics about synchronization operations.
SynchronizationManager
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.
TypeBound
A type bound that constrains a type parameter.
TypeScriptCodegen
Code generator for TypeScript definitions from symbol tables.
ValidationCache
Cache for validation results
ValidationReport
Validation results with errors, warnings, and hints
ValidationResult
Result of bundle validation.
ValidationUtils
Validation utilities for enhanced checking.
ValueRange
Value range constraint for numeric predicates
VariableConflict
Information about a variable conflict.
VariableModification
Modification details for a variable binding.
VariableSuggestion
Suggestion for a variable name.
VectorClock
Vector clock for tracking causality in distributed systems.
VersionEntry
A version history entry tracking changes to a symbol.

Enums§

AdapterError
ApplyResult
Result of applying a sync event.
BoundConstraint
The kind of constraint in a type bound.
CacheKey
A cache key for query results.
ChangeImpact
Impact level of a change
ChangeKind
Type of schema change
ChangeType
Type of schema change
CompatibilityLevel
Compute schema compatibility between two versions.
ConflictResolution
Conflict resolution strategy.
DependentRelation
Relation for dependent predicates.
DimExpr
A dimension expression that can be evaluated.
DimRelation
Relation for dimension constraints.
DomainComputation
Types of domain computations.
Effect
A computational effect that can be tracked.
EffectRow
An effect row for row polymorphism.
IndexStrategy
Index strategy for predicate lookups
LinearError
Error types for linear type violations.
LinearKind
The kind of linearity constraint.
LoadStrategy
Strategy for loading schema elements.
MergeConflictResolution
How a merge conflict was resolved.
MergeStrategy
Strategy for resolving conflicts during schema merging.
MigrationStep
Migration step
Ownership
Ownership state of a resource.
PredicateBody
The body of a composite predicate.
PredicateProperty
Properties that can be associated with predicates
PredicateQuery
Query for predicates
RecommendationStrategy
Strategy for generating recommendations.
RefinementPredicate
A refinement predicate that constrains values.
SchemaIssue
Types of schema issues that can be detected.
SuggestionSource
Source of an auto-completion suggestion.
SyncChangeType
Type of synchronization change event.
TypeParameter
A type parameter that can be either a concrete type or another parametric type.
VersionBump
Semantic version bump recommendation

Constants§

EMBEDDING_DIM
Dimensionality of the embedding vectors.

Traits§

EventListener
Event listener for synchronization events.
LockWithTimeout
Extension trait for timeout-based lock acquisition.
ProductDomainExt
Extension trait for SymbolTable to support product domains.
SchemaDatabase
Database storage trait for symbol tables.
SchemaLoader
A loader trait for fetching schema elements on demand.
SyncProtocol
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.