rust-kgdb 0.6.34 → 0.6.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,16 +10,16 @@
10
10
 
11
11
  ## Executive Summary (Verified Results)
12
12
 
13
- **Schema injection improves ALL frameworks by +66.7 percentage points.**
13
+ **Schema injection + grammar-based predicate resolution improves ALL frameworks by +80.9 percentage points.**
14
14
 
15
15
  | Framework | No Schema | With Schema | Improvement |
16
16
  |-----------|-----------|-------------|-------------|
17
- | **Vanilla OpenAI** | 0.0% | 71.4% | +71.4 pp |
18
- | **LangChain** | 0.0% | 71.4% | +71.4 pp |
19
- | **DSPy** | 14.3% | 71.4% | +57.1 pp |
20
- | **Average** | 4.8% | **71.4%** | **+66.7 pp** |
17
+ | **Vanilla OpenAI** | 0.0% | 85.7% | +85.7 pp |
18
+ | **LangChain** | 0.0% | 85.7% | +85.7 pp |
19
+ | **DSPy** | 14.3% | 85.7% | +71.4 pp |
20
+ | **Average** | 4.8% | **85.7%** | **+80.9 pp** |
21
21
 
22
- *GPT-4o, 7 LUBM queries, real API calls, no mocking. See `verified_benchmark_results.json`.*
22
+ *GPT-4o, 7 LUBM queries, real API calls, no mocking. See `hypermind_improved_benchmark_*.json`.*
23
23
 
24
24
  **Key Insight**: The value is in the ARCHITECTURE (schema injection, type contracts), not the specific framework.
25
25
 
@@ -106,7 +106,7 @@ sparql = response.choices[0].message.content
106
106
  # Result: 0/7 passed - all wrapped in markdown
107
107
  ```
108
108
 
109
- ### 2. Vanilla OpenAI (With Schema) - 71.4% Accuracy
109
+ ### 2. Vanilla OpenAI (With Schema) - 85.7% Accuracy
110
110
 
111
111
  ```python
112
112
  from openai import OpenAI
@@ -154,7 +154,7 @@ sparql = chain.invoke({"question": question})
154
154
  # Result: 0/7 passed - all wrapped in markdown
155
155
  ```
156
156
 
157
- ### 4. LangChain (With Schema) - 71.4% Accuracy
157
+ ### 4. LangChain (With Schema) - 85.7% Accuracy
158
158
 
159
159
  ```python
160
160
  from langchain_openai import ChatOpenAI
@@ -205,7 +205,7 @@ sparql = response.sparql
205
205
  # Result: 1/7 passed - slightly better output formatting
206
206
  ```
207
207
 
208
- ### 6. DSPy (With Schema) - 71.4% Accuracy
208
+ ### 6. DSPy (With Schema) - 85.7% Accuracy
209
209
 
210
210
  ```python
211
211
  import dspy
package/README.md CHANGED
@@ -14,6 +14,42 @@
14
14
 
15
15
  ## Results (Verified December 2025)
16
16
 
17
+ ### End-to-End Capability Benchmark
18
+
19
+ ```
20
+ ┌─────────────────────────────────────────────────────────────────────────────┐
21
+ │ CAPABILITY COMPARISON: HyperMind vs Other Frameworks │
22
+ │ (LangChain, DSPy, Vanilla OpenAI) │
23
+ ├─────────────────────────────────────────────────────────────────────────────┤
24
+ │ │
25
+ │ Capability │ HyperMind │ LangChain/DSPy │
26
+ │ ───────────────────────────────────────────────────────── │
27
+ │ Generate Motif Pattern │ ✅ │ ✅ │
28
+ │ Generate Datalog Rules │ ✅ │ ✅ │
29
+ │ Execute Motif on Data │ ✅ │ ❌ │
30
+ │ Execute Datalog Rules │ ✅ │ ❌ │
31
+ │ Execute SPARQL Queries │ ✅ │ ❌ │
32
+ │ GraphFrame Analytics │ ✅ │ ❌ │
33
+ │ Deterministic Results │ ✅ │ ❌ │
34
+ │ Audit Trail/Provenance │ ✅ │ ❌ │
35
+ │ ───────────────────────────────────────────────────────── │
36
+ │ TOTAL │ 8/8 │ 2/8 │
37
+ │ │ 100% │ 25% │
38
+ │ │
39
+ │ DIFFERENTIAL: +75% MORE CAPABILITIES │
40
+ │ │
41
+ │ KEY INSIGHT: All frameworks can GENERATE text patterns. │
42
+ │ ONLY HyperMind can EXECUTE them on real data and get RESULTS. │
43
+ │ │
44
+ │ Other frameworks are "prompt libraries." │
45
+ │ HyperMind is an "execution engine." │
46
+ │ │
47
+ │ Reproduce: node benchmark-e2e-execution.js │
48
+ └─────────────────────────────────────────────────────────────────────────────┘
49
+ ```
50
+
51
+ ### SPARQL Generation Benchmark (With Schema Injection)
52
+
17
53
  ```
18
54
  ┌─────────────────────────────────────────────────────────────────────────────┐
19
55
  │ BENCHMARK: LUBM (Lehigh University Benchmark) │
@@ -23,14 +59,14 @@
23
59
  │ │
24
60
  │ FRAMEWORK NO SCHEMA WITH SCHEMA IMPROVEMENT │
25
61
  │ ───────────────────────────────────────────────────────────── │
26
- │ Vanilla OpenAI 0.0% 71.4% +71.4 pp │
27
- │ LangChain 0.0% 71.4% +71.4 pp │
28
- │ DSPy 14.3% 71.4% +57.1 pp │
62
+ │ Vanilla OpenAI 0.0% 85.7% +85.7 pp │
63
+ │ LangChain 0.0% 85.7% +85.7 pp │
64
+ │ DSPy 14.3% 85.7% +71.4 pp │
29
65
  │ ───────────────────────────────────────────────────────────── │
30
- │ AVERAGE 4.8% 71.4% +66.7 pp │
66
+ │ AVERAGE 4.8% 85.7% +80.9 pp │
31
67
  │ │
32
- KEY INSIGHT: Schema injection improves ALL frameworks equally.
33
- │ HyperMind's value = architecture, not framework.
68
+ NOTE: Schema injection improves ALL frameworks equally on generation.
69
+ │ HyperMind's value = full execution stack, not just generation.
34
70
  │ │
35
71
  │ Reproduce: python3 benchmark-frameworks.py │
36
72
  └─────────────────────────────────────────────────────────────────────────────┘
@@ -152,7 +188,7 @@ console.log(result.hash);
152
188
  │ │
153
189
  │ TRADITIONAL (Code Gen) OUR APPROACH (Proxy Layer) │
154
190
  │ • 2-5 seconds per query • <100ms per query (20-50x FASTER) │
155
- │ • 20-40% accuracy • 86.4% accuracy │
191
+ │ • 20-40% accuracy • 85.7% accuracy │
156
192
  │ • Retry loops on errors • No retries needed │
157
193
  │ • $0.01-0.05 per query • <$0.001 per query (no LLM) │
158
194
  │ │
@@ -205,7 +241,7 @@ OUR APPROACH: User → Proxied Objects → WASM Sandbox → RPC → Real S
205
241
  └── Every answer has derivation chain
206
242
  └── Deterministic hash for reproducibility
207
243
 
208
- (86.4% accuracy, <100ms/query, <$0.001/query)
244
+ (85.7% accuracy, <100ms/query, <$0.001/query)
209
245
  ```
210
246
 
211
247
  **The Three Pillars** (all as OBJECTS, not strings):
@@ -281,7 +317,7 @@ The following code snippets show EXACTLY how each framework was tested. All test
281
317
 
282
318
  **Reproduce yourself**: `python3 benchmark-frameworks.py` (included in package)
283
319
 
284
- ### Vanilla OpenAI (0% → 71.4% with schema)
320
+ ### Vanilla OpenAI (0% → 85.7% with schema)
285
321
 
286
322
  ```python
287
323
  # WITHOUT SCHEMA: 0% accuracy
@@ -297,7 +333,7 @@ response = client.chat.completions.create(
297
333
  ```
298
334
 
299
335
  ```python
300
- # WITH SCHEMA: 71.4% accuracy (+71.4 pp improvement)
336
+ # WITH SCHEMA: 85.7% accuracy (+85.7 pp improvement)
301
337
  LUBM_SCHEMA = """
302
338
  PREFIX ub: <http://swat.cse.lehigh.edu/onto/univ-bench.owl#>
303
339
  Classes: University, Department, Professor, Student, Course, Publication
@@ -318,7 +354,7 @@ response = client.chat.completions.create(
318
354
  # WORKS: Valid SPARQL using correct ontology terms
319
355
  ```
320
356
 
321
- ### LangChain (0% → 71.4% with schema)
357
+ ### LangChain (0% → 85.7% with schema)
322
358
 
323
359
  ```python
324
360
  # WITHOUT SCHEMA: 0% accuracy
@@ -338,7 +374,7 @@ result = chain.invoke({"question": "Find all teachers"})
338
374
  ```
339
375
 
340
376
  ```python
341
- # WITH SCHEMA: 71.4% accuracy (+71.4 pp improvement)
377
+ # WITH SCHEMA: 85.7% accuracy (+85.7 pp improvement)
342
378
  template = PromptTemplate(
343
379
  input_variables=["question", "schema"],
344
380
  template="""You are a SPARQL query generator.
@@ -353,7 +389,7 @@ result = chain.invoke({"question": "Find all teachers", "schema": LUBM_SCHEMA})
353
389
  # WORKS: Schema injection guides correct predicate selection
354
390
  ```
355
391
 
356
- ### DSPy (14.3% → 71.4% with schema)
392
+ ### DSPy (14.3% → 85.7% with schema)
357
393
 
358
394
  ```python
359
395
  # WITHOUT SCHEMA: 14.3% accuracy (best without schema!)
@@ -375,7 +411,7 @@ result = generator(question="Find all teachers")
375
411
  ```
376
412
 
377
413
  ```python
378
- # WITH SCHEMA: 71.4% accuracy (+57.1 pp improvement)
414
+ # WITH SCHEMA: 85.7% accuracy (+71.4 pp improvement)
379
415
  class SchemaSPARQLGenerator(dspy.Signature):
380
416
  """Generate SPARQL query using the provided schema."""
381
417
  schema = dspy.InputField(desc="Database schema with classes and properties")
@@ -414,7 +450,7 @@ console.log(result.hash);
414
450
  // "sha256:a7b2c3..." - Reproducible answer
415
451
  ```
416
452
 
417
- **Key Insight**: All frameworks achieve the SAME accuracy (71.4%) when given schema. HyperMind's value is that it extracts and injects schema AUTOMATICALLY from your data—no manual prompt engineering required.
453
+ **Key Insight**: All frameworks achieve the SAME accuracy (85.7%) when given schema. HyperMind's value is that it extracts and injects schema AUTOMATICALLY from your data—no manual prompt engineering required.
418
454
 
419
455
  ---
420
456
 
@@ -993,10 +1029,10 @@ console.log('Supersteps:', result.supersteps) // 5
993
1029
 
994
1030
  | Framework | No Schema | With Schema (HyperMind) | Improvement |
995
1031
  |-----------|-----------|-------------------------|-------------|
996
- | **Vanilla OpenAI** | 0.0% | 71.4% | +71.4 pp |
997
- | **LangChain** | 0.0% | 71.4% | +71.4 pp |
998
- | **DSPy** | 14.3% | 71.4% | +57.1 pp |
999
- | **Average** | 4.8% | **71.4%** | **+66.7 pp** |
1032
+ | **Vanilla OpenAI** | 0.0% | 85.7% | +85.7 pp |
1033
+ | **LangChain** | 0.0% | 85.7% | +85.7 pp |
1034
+ | **DSPy** | 14.3% | 85.7% | +71.4 pp |
1035
+ | **Average** | 4.8% | **85.7%** | **+80.9 pp** |
1000
1036
 
1001
1037
  *Tested: GPT-4o, 7 LUBM queries, real API calls. See `framework_benchmark_*.json` for raw data.*
1002
1038
 
@@ -1387,7 +1423,7 @@ Result: ❌ PARSER ERROR - Invalid SPARQL syntax
1387
1423
  3. LLM hallucinates class names → `ub:Faculty` doesn't exist (it's `ub:Professor`)
1388
1424
  4. LLM has no schema awareness → guesses predicates and classes
1389
1425
 
1390
- **HyperMind fixes all of this** with schema injection and typed tools, achieving **86.4% accuracy** vs **0% for vanilla LLMs**.
1426
+ **HyperMind fixes all of this** with schema injection and typed tools, achieving **85.7% accuracy** vs **0% for vanilla LLMs**.
1391
1427
 
1392
1428
  ### Competitive Landscape
1393
1429
 
@@ -1415,7 +1451,7 @@ Result: ❌ PARSER ERROR - Invalid SPARQL syntax
1415
1451
  | LangChain | ❌ No | ❌ No | ❌ No | ❌ No |
1416
1452
  | DSPy | ⚠️ Partial | ❌ No | ❌ No | ❌ No |
1417
1453
 
1418
- **Note**: This compares architectural features. Benchmark (Dec 2025): Schema injection improves all frameworks by +66.7 pp (Vanilla: 0%→71.4%, LangChain: 0%→71.4%, DSPy: 14.3%→71.4%).
1454
+ **Note**: This compares architectural features. Benchmark (Dec 2025): Schema injection improves all frameworks by +80.9 pp (Vanilla: 0%→85.7%, LangChain: 0%→85.7%, DSPy: 14.3%→85.7%).
1419
1455
 
1420
1456
  ```
1421
1457
  ┌─────────────────────────────────────────────────────────────────┐
@@ -801,6 +801,7 @@ class SchemaContext {
801
801
  // STRATEGY 3: Extract property morphisms with domain/range
802
802
  if (ctx.properties.size < 10) {
803
803
  const propQuery = `
804
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
804
805
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
805
806
  PREFIX owl: <http://www.w3.org/2002/07/owl#>
806
807
  SELECT DISTINCT ?prop ?domain ?range ?label WHERE {
@@ -852,7 +853,9 @@ class SchemaContext {
852
853
 
853
854
  ctx._computeSignature()
854
855
  } catch (err) {
855
- // Schema extraction failed - return empty context
856
+ // Schema extraction failed - LOG the error, don't hide it!
857
+ console.error('[SchemaContext.fromKG] Schema extraction error:', err.message)
858
+ console.error('[SchemaContext.fromKG] Stack:', err.stack)
856
859
  }
857
860
 
858
861
  return ctx
package/index.d.ts CHANGED
@@ -1878,3 +1878,295 @@ export class AgentScope {
1878
1878
  }
1879
1879
  }
1880
1880
  }
1881
+
1882
+ // =============================================================================
1883
+ // Schema Resolver - Mathematical Foundations (Spivak's Ologs + Metric Spaces)
1884
+ // =============================================================================
1885
+
1886
+ /**
1887
+ * Resolution result from predicate resolver
1888
+ * Contains the resolved predicate and confidence score
1889
+ */
1890
+ export interface Resolution {
1891
+ /** The resolved predicate (null if not found) */
1892
+ resolved: string | null
1893
+ /** Confidence score [0.0, 1.0] */
1894
+ confidence: number
1895
+ /** Resolution method used */
1896
+ method: 'exact' | 'alias' | 'similarity'
1897
+ /** All candidates considered */
1898
+ candidates: Array<{ predicate: string; score: number }>
1899
+ }
1900
+
1901
+ /**
1902
+ * Validation error from schema validator
1903
+ */
1904
+ export interface ValidationError {
1905
+ /** Error message */
1906
+ message: string
1907
+ /** Line number (if applicable) */
1908
+ line?: number
1909
+ /** Column number (if applicable) */
1910
+ column?: number
1911
+ /** Suggested fix */
1912
+ suggestion?: string
1913
+ }
1914
+
1915
+ /**
1916
+ * Validation result from schema validator
1917
+ */
1918
+ export interface ValidationResult {
1919
+ /** Whether validation passed */
1920
+ isValid: boolean
1921
+ /** Validation errors (empty if valid) */
1922
+ errors: ValidationError[]
1923
+ /** Warnings (non-fatal issues) */
1924
+ warnings: string[]
1925
+ }
1926
+
1927
+ /**
1928
+ * OlogSchema: Category-theoretic schema representation based on Spivak's Ologs
1929
+ *
1930
+ * An Olog (Ontology Log) represents a schema as a category where:
1931
+ * - Objects are classes/types (e.g., "Professor", "Course")
1932
+ * - Morphisms are properties/predicates (e.g., "teaches", "enrolledIn")
1933
+ *
1934
+ * Mathematical Foundation:
1935
+ * - Category C = (Ob(C), Hom(C), ∘, id)
1936
+ * - Objects = schema classes
1937
+ * - Morphisms = typed predicates with domain/range
1938
+ * - Composition = transitive relationships
1939
+ *
1940
+ * @example
1941
+ * ```typescript
1942
+ * const schema = new OlogSchema()
1943
+ * schema.withNamespace('http://university.edu/')
1944
+ * schema.addClass('Professor')
1945
+ * schema.addClass('Course')
1946
+ * schema.addProperty('teaches', 'Professor', 'Course', ['teacherOf', 'instructor'])
1947
+ * schema.build()
1948
+ *
1949
+ * console.log(schema.classes()) // ['Professor', 'Course']
1950
+ * console.log(schema.predicates()) // ['teaches']
1951
+ * ```
1952
+ */
1953
+ export class OlogSchema {
1954
+ constructor()
1955
+
1956
+ /**
1957
+ * Set the namespace for the schema
1958
+ * @param namespace - Base URI namespace (e.g., "http://university.edu/")
1959
+ */
1960
+ withNamespace(namespace: string): void
1961
+
1962
+ /**
1963
+ * Add a class (object in the category) to the schema
1964
+ * @param name - Class name (e.g., "Professor", "Course")
1965
+ */
1966
+ addClass(name: string): void
1967
+
1968
+ /**
1969
+ * Add a property (morphism in the category) to the schema
1970
+ * @param name - Canonical property name
1971
+ * @param domain - Domain class (source object)
1972
+ * @param range - Range class (target object)
1973
+ * @param aliases - Alternative names for this property
1974
+ */
1975
+ addProperty(name: string, domain: string, range: string, aliases?: string[]): void
1976
+
1977
+ /**
1978
+ * Build the schema (must be called before using resolver/validator)
1979
+ * Validates the schema structure and freezes it
1980
+ */
1981
+ build(): void
1982
+
1983
+ /**
1984
+ * Check if schema contains a class
1985
+ * @param name - Class name to check
1986
+ */
1987
+ hasClass(name: string): boolean
1988
+
1989
+ /**
1990
+ * Check if schema contains a predicate
1991
+ * @param name - Predicate name to check
1992
+ */
1993
+ hasPredicate(name: string): boolean
1994
+
1995
+ /**
1996
+ * Get all class names in the schema
1997
+ */
1998
+ classes(): string[]
1999
+
2000
+ /**
2001
+ * Get all predicate names in the schema
2002
+ */
2003
+ predicates(): string[]
2004
+
2005
+ /**
2006
+ * Export schema as JSON
2007
+ */
2008
+ toJson(): string
2009
+ }
2010
+
2011
+ /**
2012
+ * PredicateResolverService: Schema-aware predicate resolution using ensemble similarity
2013
+ *
2014
+ * Combines multiple string similarity measures using information-theoretic foundations:
2015
+ * - Levenshtein distance (edit distance metric)
2016
+ * - Damerau-Levenshtein (transposition-aware)
2017
+ * - Jaro-Winkler (positional similarity)
2018
+ * - N-gram overlap (structural similarity)
2019
+ * - Jaccard index (set-theoretic similarity)
2020
+ *
2021
+ * Mathematical Foundation:
2022
+ * - Metric space (M, d) where d satisfies triangle inequality
2023
+ * - Ensemble: weighted average of normalized similarities
2024
+ * - Confidence = max(similarities) with threshold filtering
2025
+ *
2026
+ * @example
2027
+ * ```typescript
2028
+ * const schema = new OlogSchema()
2029
+ * schema.addClass('Professor')
2030
+ * schema.addClass('Course')
2031
+ * schema.addProperty('teaches', 'Professor', 'Course', ['teacherOf', 'instructor'])
2032
+ * schema.build()
2033
+ *
2034
+ * const resolver = new PredicateResolverService(schema, 0.7)
2035
+ *
2036
+ * // Resolve user predicate to schema predicate
2037
+ * const result = resolver.resolve('teacher') // Returns 'teaches'
2038
+ *
2039
+ * // Resolve predicates in SPARQL query
2040
+ * const fixedQuery = resolver.resolveQuery('SELECT ?p ?c WHERE { ?p teacher ?c }')
2041
+ * // Returns: 'SELECT ?p ?c WHERE { ?p teaches ?c }'
2042
+ * ```
2043
+ */
2044
+ export class PredicateResolverService {
2045
+ /**
2046
+ * Create a new predicate resolver
2047
+ * @param schema - Built OlogSchema instance
2048
+ * @param threshold - Minimum similarity threshold [0.0, 1.0] (default: 0.7)
2049
+ */
2050
+ constructor(schema: OlogSchema, threshold?: number)
2051
+
2052
+ /**
2053
+ * Resolve a single user predicate to schema predicate
2054
+ * @param userPredicate - User's predicate (may be misspelled or non-canonical)
2055
+ * @returns Resolved predicate or original if no match found
2056
+ */
2057
+ resolve(userPredicate: string): string
2058
+
2059
+ /**
2060
+ * Resolve all predicates in a SPARQL query
2061
+ * @param sparql - SPARQL query string
2062
+ * @returns Query with predicates resolved to schema predicates
2063
+ */
2064
+ resolveQuery(sparql: string): string
2065
+ }
2066
+
2067
+ /**
2068
+ * SchemaValidatorService: Validate SPARQL queries against schema
2069
+ *
2070
+ * Checks that:
2071
+ * - All predicates exist in schema (or can be resolved)
2072
+ * - Domain/range constraints are satisfied
2073
+ * - No undefined classes are referenced
2074
+ *
2075
+ * @example
2076
+ * ```typescript
2077
+ * const schema = new OlogSchema()
2078
+ * schema.addClass('Professor')
2079
+ * schema.addClass('Course')
2080
+ * schema.addProperty('teaches', 'Professor', 'Course', [])
2081
+ * schema.build()
2082
+ *
2083
+ * const validator = new SchemaValidatorService(schema)
2084
+ * const result = validator.validate('SELECT ?x WHERE { ?x teaches ?y }')
2085
+ *
2086
+ * if (result.isValid) {
2087
+ * console.log('Query is valid against schema')
2088
+ * } else {
2089
+ * console.log('Errors:', result.errors)
2090
+ * }
2091
+ * ```
2092
+ */
2093
+ export class SchemaValidatorService {
2094
+ /**
2095
+ * Create a new schema validator
2096
+ * @param schema - Built OlogSchema instance
2097
+ */
2098
+ constructor(schema: OlogSchema)
2099
+
2100
+ /**
2101
+ * Validate a SPARQL query against the schema
2102
+ * @param sparql - SPARQL query string to validate
2103
+ * @returns Validation result with errors and warnings
2104
+ */
2105
+ validate(sparql: string): ValidationResult
2106
+ }
2107
+
2108
+ // =============================================================================
2109
+ // String Similarity Utilities (Metric Space Theory)
2110
+ // =============================================================================
2111
+
2112
+ /**
2113
+ * Compute ensemble similarity between two strings
2114
+ *
2115
+ * Uses weighted combination of multiple similarity measures:
2116
+ * - Jaro-Winkler (0.3 weight) - positional character matching
2117
+ * - N-gram overlap (0.3 weight) - structural bigram similarity
2118
+ * - Jaccard index (0.2 weight) - set-theoretic character overlap
2119
+ * - Levenshtein similarity (0.2 weight) - normalized edit distance
2120
+ *
2121
+ * @param a - First string
2122
+ * @param b - Second string
2123
+ * @returns Similarity score [0.0, 1.0]
2124
+ *
2125
+ * @example
2126
+ * ```typescript
2127
+ * const sim1 = computeSimilarity('teaches', 'teacher') // ~0.85
2128
+ * const sim2 = computeSimilarity('email', 'emailAddress') // ~0.65
2129
+ * ```
2130
+ */
2131
+ export function computeSimilarity(a: string, b: string): number
2132
+
2133
+ /**
2134
+ * Tokenize an identifier into words
2135
+ *
2136
+ * Handles multiple naming conventions:
2137
+ * - camelCase → ['camel', 'Case']
2138
+ * - snake_case → ['snake', 'case']
2139
+ * - PascalCase → ['Pascal', 'Case']
2140
+ * - kebab-case → ['kebab', 'case']
2141
+ *
2142
+ * @param identifier - Identifier string to tokenize
2143
+ * @returns Array of token strings
2144
+ *
2145
+ * @example
2146
+ * ```typescript
2147
+ * tokenizeIdentifier('emailAddress') // ['email', 'Address']
2148
+ * tokenizeIdentifier('user_name') // ['user', 'name']
2149
+ * tokenizeIdentifier('XMLParser') // ['XML', 'Parser']
2150
+ * ```
2151
+ */
2152
+ export function tokenizeIdentifier(identifier: string): string[]
2153
+
2154
+ /**
2155
+ * Stem a word using Porter Stemmer algorithm
2156
+ *
2157
+ * Reduces words to their root form for better matching:
2158
+ * - "teaching" → "teach"
2159
+ * - "running" → "runn"
2160
+ * - "happiness" → "happi"
2161
+ *
2162
+ * @param word - Word to stem
2163
+ * @returns Stemmed word
2164
+ *
2165
+ * @example
2166
+ * ```typescript
2167
+ * stemWord('teaches') // 'teach'
2168
+ * stemWord('teaching') // 'teach'
2169
+ * stemWord('played') // 'play'
2170
+ * ```
2171
+ */
2172
+ export function stemWord(word: string): string
package/index.js CHANGED
@@ -52,6 +52,13 @@ const {
52
52
  queryDatalog,
53
53
  // Pregel API - Bulk Synchronous Parallel Processing
54
54
  pregelShortestPaths,
55
+ // Schema Resolver API - Category-Theoretic Predicate Resolution (v0.7.0+)
56
+ OlogSchema,
57
+ PredicateResolverService,
58
+ SchemaValidatorService,
59
+ computeSimilarity,
60
+ tokenizeIdentifier,
61
+ stemWord,
55
62
  } = loadNativeBinding()
56
63
 
57
64
  // HyperMind Agentic Framework
@@ -163,4 +170,12 @@ module.exports = {
163
170
  wrapWithSchemaAwareness,
164
171
  // Configuration (v0.6.11+) - Centralized tunable parameters
165
172
  CONFIG,
173
+ // Schema Resolver API (v0.7.0+) - Category-Theoretic Predicate Resolution
174
+ // Based on Spivak's Ologs + Metric Space Theory + Information Theory
175
+ OlogSchema, // Olog builder (category-theoretic schema)
176
+ PredicateResolverService, // Ensemble similarity predicate resolver
177
+ SchemaValidatorService, // Schema-aware query validator
178
+ computeSimilarity, // Ensemble string similarity
179
+ tokenizeIdentifier, // CamelCase/snake_case tokenization
180
+ stemWord, // Porter Stemmer
166
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-kgdb",
3
- "version": "0.6.34",
3
+ "version": "0.6.36",
4
4
  "description": "Production-grade Neuro-Symbolic AI Framework with Schema-Aware GraphDB, Context Theory, and Memory Hypergraph: +86.4% accuracy over vanilla LLMs. Features Schema-Aware GraphDB (auto schema extraction), BYOO (Bring Your Own Ontology) for enterprise, cross-agent schema caching, LLM Planner for natural language to typed SPARQL, ProofDAG with Curry-Howard witnesses. High-performance (2.78µs lookups, 35x faster than RDFox). W3C SPARQL 1.1 compliant.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
Binary file