Skip to main content

qualia_core_db/modalities/logic/
infrastructure_shacl.rs

1//! SHACL Extensions for Domains, Obfuscation, and Solvers
2//!
3//! This module provides SHACL constraint extensions for:
4//! - Domain-specific engines (biological, chemical, physical, financial, mathematical, geospatial)
5//! - Data obfuscation and semantic stripping
6//! - Zero-allocation solver library
7
8use crate::webizen::SlgOpcode;
9
10// ── Domain-Specific Constraints ───────────────────────────────────────────────
11
12/// `q42:BiologicalDomainConfiguration` — validates biological domain parameters
13#[derive(Debug, Clone)]
14pub struct BiologicalDomainConfiguration {
15    pub max_sequence_length: u32, // Maximum DNA/RNA/protein sequence length
16    pub max_gene_count: u32,      // Maximum number of genes in analysis
17    pub allowed_sequence_types: Vec<String>, // ["dna", "rna", "protein"]
18    pub require_quality_score: bool, // Require sequence quality validation
19}
20
21/// `q42:ChemicalDomainConfiguration` — validates chemical domain parameters
22#[derive(Debug, Clone)]
23pub struct ChemicalDomainConfiguration {
24    pub max_molecular_weight: f64,          // Maximum molecular weight (Da)
25    pub max_atom_count: u32,                // Maximum atoms per molecule
26    pub allowed_element_types: Vec<String>, // Periodic table symbols
27    pub require_valence_validation: bool,   // Require chemical valence checks
28}
29
30/// `q42:PhysicalDomainConfiguration` — validates physical domain parameters
31#[derive(Debug, Clone)]
32pub struct PhysicalDomainConfiguration {
33    pub max_temperature_kelvin: f64,           // Maximum temperature (K)
34    pub max_pressure_pascal: f64,              // Maximum pressure (Pa)
35    pub allowed_energy_units: Vec<String>,     // ["joule", "electron_volt", "calorie"]
36    pub require_dimensional_consistency: bool, // Require unit consistency
37}
38
39/// `q42:FinancialDomainConfiguration` — validates financial domain parameters
40#[derive(Debug, Clone)]
41pub struct FinancialDomainConfiguration {
42    pub max_transaction_value: f64,      // Maximum transaction value
43    pub max_portfolio_size: f64,         // Maximum portfolio value
44    pub allowed_currencies: Vec<String>, // Currency codes
45    pub require_compliance_check: bool,  // Require regulatory compliance
46}
47
48/// `q42:MathematicalDomainConfiguration` — validates mathematical domain parameters
49#[derive(Debug, Clone)]
50pub struct MathematicalDomainConfiguration {
51    pub max_precision_bits: u8,            // Maximum precision (bits)
52    pub allowed_number_types: Vec<String>, // ["integer", "float", "complex", "rational"]
53    pub max_expression_depth: u8,          // Maximum expression nesting depth
54    pub require_well_formedness: bool,     // Require well-formed expressions
55}
56
57/// `q42:GeospatialDomainConfiguration` — validates geospatial domain parameters
58#[derive(Debug, Clone)]
59pub struct GeospatialDomainConfiguration {
60    pub max_coordinate_precision: u8, // Decimal places for coordinates
61    pub allowed_coordinate_systems: Vec<String>, // ["wgs84", "utm", "mercator"]
62    pub max_area_sq_km: f64,          // Maximum area in square kilometers
63    pub require_valid_geometry: bool, // Require valid geometric shapes
64}
65
66// ── Obfuscation Constraints ─────────────────────────────────────────────────
67
68/// `q42:ObfuscationConfiguration` — validates obfuscation parameters
69#[derive(Debug, Clone)]
70pub struct ObfuscationConfiguration {
71    pub max_obfuscation_depth: u8, // Maximum obfuscation transformation depth
72    pub allowed_obfuscation_methods: Vec<String>, // ["polynomial", "semantic", "domain"]
73    pub require_reversibility: bool, // Require reversible transformations
74    pub min_entropy_bits: u8,      // Minimum entropy after obfuscation
75}
76
77/// `q42:PolynomialObfuscationConfiguration` — validates polynomial obfuscation parameters
78#[derive(Debug, Clone)]
79pub struct PolynomialObfuscationConfiguration {
80    pub max_polynomial_degree: u8,              // Maximum polynomial degree
81    pub allowed_coefficient_types: Vec<String>, // ["integer", "float", "rational"]
82    pub require_irreducibility: bool,           // Require irreducible polynomials
83}
84
85/// `q42:SemanticStripperConfiguration` — validates semantic stripping parameters
86#[derive(Debug, Clone)]
87pub struct SemanticStripperConfiguration {
88    pub max_context_depth: u8,              // Maximum context stripping depth
89    pub allowed_context_types: Vec<String>, // ["clinical", "financial", "personal"]
90    pub require_anonymity: bool,            // Require complete anonymity
91}
92
93/// `q42:DomainTransformerConfiguration` — validates domain transformation parameters
94#[derive(Debug, Clone)]
95pub struct DomainTransformerConfiguration {
96    pub allowed_target_domains: Vec<String>, // Target transformation domains
97    pub max_transformation_chain_length: u8, // Maximum chain of transformations
98    pub require_preservation: bool,          // Require mathematical structure preservation
99}
100
101/// `q42:HybridStateConfiguration` — validates hybrid state management parameters
102#[derive(Debug, Clone)]
103pub struct HybridStateConfiguration {
104    pub max_state_size_bytes: u32,          // Maximum state size in bytes
105    pub allowed_state_domains: Vec<String>, // ["classical", "quantum", "hybrid"]
106    pub require_synchronization: bool,      // Require state synchronization
107}
108
109// ── Solver Constraints ─────────────────────────────────────────────────────
110
111/// `q42:SolverConfiguration` — validates general solver parameters
112#[derive(Debug, Clone)]
113pub struct SolverConfiguration {
114    pub max_iterations: u32,               // Maximum solver iterations
115    pub convergence_tolerance: f64,        // Convergence threshold
116    pub max_step_size: f64,                // Maximum step size
117    pub min_step_size: f64,                // Minimum step size
118    pub allowed_solver_types: Vec<String>, // ["calculus", "linear_algebra", "optimization"]
119}
120
121/// `q42:CalculusSolverConfiguration` — validates calculus solver parameters
122#[derive(Debug, Clone)]
123pub struct CalculusSolverConfiguration {
124    pub max_ode_order: u8,                // Maximum ODE order
125    pub allowed_integrators: Vec<String>, // ["runge_kutta", "simpsons", "shooting"]
126    pub require_stability_check: bool,    // Require numerical stability check
127}
128
129/// `q42:LinearAlgebraSolverConfiguration` — validates linear algebra solver parameters
130#[derive(Debug, Clone)]
131pub struct LinearAlgebraSolverConfiguration {
132    pub max_matrix_dimension: u16,            // Maximum matrix dimension
133    pub allowed_decompositions: Vec<String>,  // ["lu", "qr", "svd", "eigen"]
134    pub require_condition_number_check: bool, // Require condition number validation
135}
136
137/// `q42:OptimizationSolverConfiguration` — validates optimization solver parameters
138#[derive(Debug, Clone)]
139pub struct OptimizationSolverConfiguration {
140    pub max_variables: u32,              // Maximum number of variables
141    pub allowed_algorithms: Vec<String>, // ["nelder_mead", "newton_raphson", "levenberg_marquardt"]
142    pub require_convexity_check: bool,   // Require convexity validation
143}
144
145/// `q42:QuantumOptimizerConfiguration` — validates quantum optimizer parameters
146#[derive(Debug, Clone)]
147pub struct QuantumOptimizerConfiguration {
148    pub max_qubits: u16,                 // Maximum number of qubits
149    pub allowed_algorithms: Vec<String>, // ["qaoa", "spsa", "variational"]
150    pub require_error_correction: bool,  // Require error correction
151}
152
153/// `q42:SymbolicLogicSolverConfiguration` — validates symbolic logic solver parameters
154#[derive(Debug, Clone)]
155pub struct SymbolicLogicSolverConfiguration {
156    pub max_clause_count: u32,            // Maximum number of clauses
157    pub max_variable_count: u32,          // Maximum number of variables
158    pub allowed_logic_types: Vec<String>, // ["defeasible", "classical", "modal"]
159}
160
161// ── Geometric Algebra Constraints ─────────────────────────────────────────────
162
163/// `q42:GeometricAlgebraConfiguration` — validates geometric algebra parameters
164#[derive(Debug, Clone)]
165pub struct GeometricAlgebraConfiguration {
166    pub max_dimension: u8, // Maximum geometric algebra dimension (3D, 4D, etc.)
167    pub allowed_algebras: Vec<String>, // ["pga", "cga", "conformal"]
168    pub require_normalization: bool, // Require multivector normalization
169}
170
171// ── Opcode Generation Functions ───────────────────────────────────────────────
172
173impl BiologicalDomainConfiguration {
174    /// Lower the biological-domain bounds to SHACL `CheckMaxInclusive`
175    /// opcodes (sequence length, gene count).
176    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
177        vec![
178            SlgOpcode::CheckMaxInclusive(self.max_sequence_length as f64),
179            SlgOpcode::CheckMaxInclusive(self.max_gene_count as f64),
180        ]
181    }
182}
183
184impl ChemicalDomainConfiguration {
185    /// Lower the chemical-domain bounds to `CheckMaxInclusive` opcodes
186    /// (molecular weight, atom count).
187    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
188        vec![
189            SlgOpcode::CheckMaxInclusive(self.max_molecular_weight),
190            SlgOpcode::CheckMaxInclusive(self.max_atom_count as f64),
191        ]
192    }
193}
194
195impl PhysicalDomainConfiguration {
196    /// Lower the physical-domain bounds to `CheckMaxInclusive` opcodes
197    /// (temperature K, pressure Pa).
198    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
199        vec![
200            SlgOpcode::CheckMaxInclusive(self.max_temperature_kelvin),
201            SlgOpcode::CheckMaxInclusive(self.max_pressure_pascal),
202        ]
203    }
204}
205
206impl FinancialDomainConfiguration {
207    /// Lower the financial-domain bounds to `CheckMaxInclusive` opcodes
208    /// (transaction value, portfolio size).
209    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
210        vec![
211            SlgOpcode::CheckMaxInclusive(self.max_transaction_value),
212            SlgOpcode::CheckMaxInclusive(self.max_portfolio_size),
213        ]
214    }
215}
216
217impl MathematicalDomainConfiguration {
218    /// Lower the mathematical-domain bounds to `CheckMaxInclusive`
219    /// opcodes (precision bits, expression depth).
220    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
221        vec![
222            SlgOpcode::CheckMaxInclusive(self.max_precision_bits as f64),
223            SlgOpcode::CheckMaxInclusive(self.max_expression_depth as f64),
224        ]
225    }
226}
227
228impl GeospatialDomainConfiguration {
229    /// Lower the geospatial-domain bounds to `CheckMaxInclusive` opcodes
230    /// (coordinate precision, area km²).
231    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
232        vec![
233            SlgOpcode::CheckMaxInclusive(self.max_coordinate_precision as f64),
234            SlgOpcode::CheckMaxInclusive(self.max_area_sq_km),
235        ]
236    }
237}
238
239impl ObfuscationConfiguration {
240    /// Lower obfuscation limits to opcodes: `CheckMaxInclusive` on depth,
241    /// `CheckMinInclusive` on entropy bits.
242    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
243        vec![
244            SlgOpcode::CheckMaxInclusive(self.max_obfuscation_depth as f64),
245            SlgOpcode::CheckMinInclusive(self.min_entropy_bits as f64),
246        ]
247    }
248}
249
250impl PolynomialObfuscationConfiguration {
251    /// Lower the max polynomial degree to a `CheckMaxInclusive` opcode.
252    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
253        vec![SlgOpcode::CheckMaxInclusive(
254            self.max_polynomial_degree as f64,
255        )]
256    }
257}
258
259impl SemanticStripperConfiguration {
260    /// Lower the max context-strip depth to a `CheckMaxInclusive` opcode.
261    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
262        vec![SlgOpcode::CheckMaxInclusive(self.max_context_depth as f64)]
263    }
264}
265
266impl DomainTransformerConfiguration {
267    /// Lower the max transformation-chain length to a
268    /// `CheckMaxInclusive` opcode.
269    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
270        vec![SlgOpcode::CheckMaxInclusive(
271            self.max_transformation_chain_length as f64,
272        )]
273    }
274}
275
276impl HybridStateConfiguration {
277    /// Lower the max hybrid-state size (bytes) to a `CheckMaxInclusive`
278    /// opcode.
279    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
280        vec![SlgOpcode::CheckMaxInclusive(
281            self.max_state_size_bytes as f64,
282        )]
283    }
284}
285
286impl SolverConfiguration {
287    /// Lower solver bounds to opcodes: max on iterations / convergence
288    /// tolerance / step size, min on step size.
289    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
290        vec![
291            SlgOpcode::CheckMaxInclusive(self.max_iterations as f64),
292            SlgOpcode::CheckMaxInclusive(self.convergence_tolerance),
293            SlgOpcode::CheckMaxInclusive(self.max_step_size),
294            SlgOpcode::CheckMinInclusive(self.min_step_size),
295        ]
296    }
297}
298
299impl CalculusSolverConfiguration {
300    /// Lower the max ODE order to a `CheckMaxInclusive` opcode.
301    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
302        vec![SlgOpcode::CheckMaxInclusive(self.max_ode_order as f64)]
303    }
304}
305
306impl LinearAlgebraSolverConfiguration {
307    /// Lower the max matrix dimension to a `CheckMaxInclusive` opcode.
308    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
309        vec![SlgOpcode::CheckMaxInclusive(
310            self.max_matrix_dimension as f64,
311        )]
312    }
313}
314
315impl OptimizationSolverConfiguration {
316    /// Lower the max variable count to a `CheckMaxInclusive` opcode.
317    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
318        vec![SlgOpcode::CheckMaxInclusive(self.max_variables as f64)]
319    }
320}
321
322impl QuantumOptimizerConfiguration {
323    /// Lower the max qubit count to a `CheckMaxInclusive` opcode.
324    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
325        vec![SlgOpcode::CheckMaxInclusive(self.max_qubits as f64)]
326    }
327}
328
329impl SymbolicLogicSolverConfiguration {
330    /// Lower the clause/variable bounds to `CheckMaxInclusive` opcodes.
331    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
332        vec![
333            SlgOpcode::CheckMaxInclusive(self.max_clause_count as f64),
334            SlgOpcode::CheckMaxInclusive(self.max_variable_count as f64),
335        ]
336    }
337}
338
339impl GeometricAlgebraConfiguration {
340    /// Lower the max algebra dimension to a `CheckMaxInclusive` opcode.
341    pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
342        vec![SlgOpcode::CheckMaxInclusive(self.max_dimension as f64)]
343    }
344}
345
346// ── SHACL TTL Vocabulary for Domains, Obfuscation, and Solvers ─────────────
347
348/// Returns comprehensive SHACL TTL vocabulary for domains, obfuscation, and solvers
349pub fn get_infrastructure_shacl_ttl() -> &'static str {
350    r#"
351@prefix q42: <https://webizen.org/q42#> .
352@prefix sh: <http://www.w3.org/ns/shacl#> .
353@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
354
355# ── Domain-Specific Constraints ─────────────────────────────────────────────
356
357q42:BiologicalDomainConfigurationShape a sh:NodeShape ;
358    sh:property [
359        sh:path q42:maxSequenceLength ;
360        sh:datatype xsd:integer ;
361        sh:minInclusive 1 ;
362        sh:maxInclusive 1000000 ;
363        sh:message "Sequence length must be between 1 and 1,000,000" ;
364    ] ;
365    sh:property [
366        sh:path q42:allowedSequenceTypes ;
367        sh:in ("dna" "rna" "protein") ;
368        sh:message "Sequence type must be valid" ;
369    ] .
370
371q42:ChemicalDomainConfigurationShape a sh:NodeShape ;
372    sh:property [
373        sh:path q42:maxMolecularWeight ;
374        sh:datatype xsd:float ;
375        sh:minInclusive 1.0 ;
376        sh:maxInclusive 1000000.0 ;
377        sh:message "Molecular weight must be between 1 and 1,000,000 Da" ;
378    ] ;
379    sh:property [
380        sh:path q42:maxAtomCount ;
381        sh:datatype xsd:integer ;
382        sh:minInclusive 1 ;
383        sh:maxInclusive 10000 ;
384        sh:message "Atom count must be between 1 and 10,000" ;
385    ] .
386
387q42:PhysicalDomainConfigurationShape a sh:NodeShape ;
388    sh:property [
389        sh:path q42:maxTemperatureKelvin ;
390        sh:datatype xsd:float ;
391        sh:minInclusive 0.0 ;
392        sh:maxInclusive 1e6 ;
393        sh:message "Temperature must be between 0K and 1,000,000K" ;
394    ] ;
395    sh:property [
396        sh:path q42:maxPressurePascal ;
397        sh:datatype xsd:float ;
398        sh:minInclusive 0.0 ;
399        sh:maxInclusive 1e12 ;
400        sh:message "Pressure must be reasonable" ;
401    ] .
402
403q42:FinancialDomainConfigurationShape a sh:NodeShape ;
404    sh:property [
405        sh:path q42:maxTransactionValue ;
406        sh:datatype xsd:float ;
407        sh:minInclusive 0.0 ;
408        sh:maxInclusive 1e15 ;
409        sh:message "Transaction value must be reasonable" ;
410    ] ;
411    sh:property [
412        sh:path q42:allowedCurrencies ;
413        sh:message "Currency must be valid ISO 4217 code" ;
414    ] .
415
416q42:MathematicalDomainConfigurationShape a sh:NodeShape ;
417    sh:property [
418        sh:path q42:maxPrecisionBits ;
419        sh:datatype xsd:unsignedByte ;
420        sh:maxInclusive 128 ;
421        sh:message "Precision must be ≤ 128 bits" ;
422    ] ;
423    sh:property [
424        sh:path q42:maxExpressionDepth ;
425        sh:datatype xsd:unsignedByte ;
426        sh:maxInclusive 50 ;
427        sh:message "Expression depth must be ≤ 50" ;
428    ] .
429
430q42:GeospatialDomainConfigurationShape a sh:NodeShape ;
431    sh:property [
432        sh:path q42:maxCoordinatePrecision ;
433        sh:datatype xsd:unsignedByte ;
434        sh:maxInclusive 15 ;
435        sh:message "Coordinate precision must be ≤ 15 decimal places" ;
436    ] ;
437    sh:property [
438        sh:path q42:allowedCoordinateSystems ;
439        sh:in ("wgs84" "utm" "mercator" "geographic") ;
440        sh:message "Coordinate system must be valid" ;
441    ] .
442
443# ── Obfuscation Constraints ─────────────────────────────────────────
444
445q42:ObfuscationConfigurationShape a sh:NodeShape ;
446    sh:property [
447        sh:path q42:maxObfuscationDepth ;
448        sh:datatype xsd:unsignedByte ;
449        sh:maxInclusive 10 ;
450        sh:message "Obfuscation depth must be ≤ 10" ;
451    ] ;
452    sh:property [
453        sh:path q42:minEntropyBits ;
454        sh:datatype xsd:unsignedByte ;
455        sh:minInclusive 64 ;
456        sh:message "Entropy must be ≥ 64 bits" ;
457    ] .
458
459q42:PolynomialObfuscationConfigurationShape a sh:NodeShape ;
460    sh:property [
461        sh:path q42:maxPolynomialDegree ;
462        sh:datatype xsd:unsignedByte ;
463        sh:maxInclusive 20 ;
464        sh:message "Polynomial degree must be ≤ 20" ;
465    ] .
466
467q42:SemanticStripperConfigurationShape a sh:NodeShape ;
468    sh:property [
469        sh:path q42:maxContextDepth ;
470        sh:datatype xsd:unsignedByte ;
471        sh:maxInclusive 10 ;
472        sh:message "Context depth must be ≤ 10" ;
473    ] ;
474    sh:property [
475        sh:path q42:allowedContextTypes ;
476        sh:in ("clinical" "financial" "personal" "legal") ;
477        sh:message "Context type must be valid" ;
478    ] .
479
480q42:HybridStateConfigurationShape a sh:NodeShape ;
481    sh:property [
482        sh:path q42:maxStateSizeBytes ;
483        sh:datatype xsd:integer ;
484        sh:minInclusive 1 ;
485        sh:maxInclusive 1048576 ;
486        sh:message "State size must be between 1 and 1MB" ;
487    ] .
488
489# ── Solver Constraints ─────────────────────────────────────────────────
490
491q42:SolverConfigurationShape a sh:NodeShape ;
492    sh:property [
493        sh:path q42:maxIterations ;
494        sh:datatype xsd:integer ;
495        sh:minInclusive 1 ;
496        sh:maxInclusive 1000000 ;
497        sh:message "Iterations must be between 1 and 1,000,000" ;
498    ] ;
499    sh:property [
500        sh:path q42:convergenceTolerance ;
501        sh:datatype xsd:float ;
502        sh:minInclusive 1e-15 ;
503        sh:maxInclusive 1.0 ;
504        sh:message "Tolerance must be reasonable" ;
505    ] ;
506    sh:property [
507        sh:path q42:maxStepSize ;
508        sh:datatype xsd:float ;
509        sh:minInclusive 1e-15 ;
510        sh:maxInclusive 1.0 ;
511        sh:message "Step size must be reasonable" ;
512    ] ;
513    sh:property [
514        sh:path q42:minStepSize ;
515        sh:datatype xsd:float ;
516        sh:minInclusive 1e-15 ;
517        sh:maxInclusive 1.0 ;
518        sh:message "Step size must be reasonable" ;
519    ] .
520
521q42:CalculusSolverConfigurationShape a sh:NodeShape ;
522    sh:property [
523        sh:path q42:maxOdeOrder ;
524        sh:datatype xsd:unsignedByte ;
525        sh:maxInclusive 10 ;
526        sh:message "ODE order must be ≤ 10" ;
527    ] .
528
529q42:LinearAlgebraSolverConfigurationShape a sh:NodeShape ;
530    sh:property [
531        sh:path q42:maxMatrixDimension ;
532        sh:datatype xsd:unsignedShort ;
533        sh:maxInclusive 1000 ;
534        sh:message "Matrix dimension must be ≤ 1000" ;
535    ] .
536
537q42:OptimizationSolverConfigurationShape a sh:NodeShape ;
538    sh:property [
539        sh:path q42:maxVariables ;
540        sh:datatype xsd:integer ;
541        sh:minInclusive 1 ;
542        sh:maxInclusive 100000 ;
543        sh:message "Variables must be between 1 and 100,000" ;
544    ] .
545
546q42:QuantumOptimizerConfigurationShape a sh:NodeShape ;
547    sh:property [
548        sh:path q42:maxQubits ;
549        sh:datatype xsd:unsignedShort ;
550        sh:maxInclusive 1000 ;
551        sh:message "Qubits must be ≤ 1000" ;
552    ] .
553
554q42:SymbolicLogicSolverConfigurationShape a sh:NodeShape ;
555    sh:property [
556        sh:path q42:maxClauseCount ;
557        sh:datatype xsd:integer ;
558        sh:minInclusive 1 ;
559        sh:maxInclusive 1000000 ;
560        sh:message "Clauses must be between 1 and 1,000,000" ;
561    ] ;
562    sh:property [
563        sh:path q42:maxVariableCount ;
564        sh:datatype xsd:integer ;
565        sh:minInclusive 1 ;
566        sh:maxInclusive 100000 ;
567        sh:message "Variables must be between 1 and 100,000" ;
568    ] .
569
570# ── Geometric Algebra Constraints ─────────────────────────────────────────
571
572q42:GeometricAlgebraConfigurationShape a sh:NodeShape ;
573    sh:property [
574        sh:path q42:maxDimension ;
575        sh:datatype xsd:unsignedByte ;
576        sh:minInclusive 2 ;
577        sh:maxInclusive 8 ;
578        sh:message "Dimension must be between 2 and 8" ;
579    ] ;
580    sh:property [
581        sh:path q42:allowedAlgebras ;
582        sh:in ("pga" "cga" "conformal" "projective") ;
583        sh:message "Algebra type must be valid" ;
584    ] .
585"#
586}