This specification defines the Qualia SHACL Extension Vocabulary, a set of SHACL (Shapes Constraint Language) extensions for validating configuration parameters across the Qualia Protocol Ecosystem. These extensions provide constraints for client features, specialized libraries, core modalities, and infrastructure components, ensuring data integrity, security, and regulatory compliance across distributed semantic graph operations.
This document is an editor's draft and does not carry the endorsement of any standards body. It is intended for review and feedback within the Qualia Protocol Ecosystem community.
SHACL (Shapes Constraint Language) is a W3C recommendation for validating RDF graphs against shapes. The Qualia Protocol Ecosystem extends SHACL with domain-specific constraints for scientific computing, financial modeling, medical data processing, and quantum computing operations.
Standard SHACL provides general-purpose constraint mechanisms but lacks domain-specific validations needed for:
This specification defines SHACL extension constraints for four major categories:
logic_modalities_shacl.rs) - the computational legal-logic surface (legal_logic.md §1–§30): SDL⁺ deontic lifecycle & extensions, the Hohfeldian jural square, STIT agency, mens rea, causal/but-for, responsibility (allegation→adjudication), juridical capacity, delegation chains, contract formation, value-flow, capability gap, resilient identity, ZK-gate, proportionality, sense-translation, consensus, manifold logic, carrier binding, systemic meta-guard. One q42:<Name>ConfigurationShape per modality, gated by an engine↔SHACL completeness test.A conforming implementation MUST:
The following terms are used in this specification:
Client feature constraints validate parameters for the Qualia Client application including logging, system tray, and settings.
Validates logging system configuration parameters.
| Property | Type | Range | Description |
|---|---|---|---|
| maxMemoryLogs | xsd:integer | 1-100,000 | Maximum logs in memory |
| maxDiskLogs | xsd:integer | 1-1,000,000 | Maximum logs on disk |
| flushIntervalMs | xsd:integer | 100-60,000 | Buffer flush interval (ms) |
Severity: Violation for limits, Warning for flush interval
Validates log level enumeration values.
Allowed Values: DEBUG, INFO, WARN, ERROR, CRITICAL
Severity: Violation
Validates individual log entry structure.
| Property | Type | Requirement |
|---|---|---|
| timestamp | xsd:dateTime | Required, minCount=1 |
| level | xsd:string | Required, minCount=1 |
| message | xsd:string | Required, maxLength=10,000 |
| context | xsd:string | Optional, maxLength=100 |
Severity: Violation for required fields, Warning for length limits
Validates system tray menu configuration.
| Property | Type | Range |
|---|---|---|
| maxMenuItems | xsd:integer | 1-20 |
| requireSeparatorLogic | xsd:boolean | Boolean flag |
| allowNestedMenus | xsd:boolean | Boolean flag |
Validates individual system tray menu items.
| Property | Type | Range |
|---|---|---|
| label | xsd:string | Required, maxLength=50 |
| action | xsd:string | Required |
| icon | xsd:string | Optional |
Validates storage path and quota settings.
| Property | Type | Range |
|---|---|---|
| storagePath | xsd:string | Required, pattern="^[/\\]" |
| storageQuotaGb | xsd:integer | 1-1,000 |
Security: Pattern validation prevents directory traversal
Validates daemon network settings.
| Property | Type | Range |
|---|---|---|
| daemonPort | xsd:integer | 1,024-65,535 |
| daemonHost | xsd:string | localhost, 127.0.0.1, 0.0.0.0, ::1 |
Security: Host addresses restricted to safe values
Validates ILP tax recipient configuration.
| Property | Type | Range |
|---|---|---|
| ilpAddress | xsd:string | Required, pattern="^\\$ilp." |
| sharePercent | xsd:integer | 0-100 |
Security: ILP address validation prevents payment routing errors
Validates security-related settings.
| Property | Type | Range |
|---|---|---|
| minKeyLengthBits | xsd:integer | 128-4,096 |
| requireEncryption | xsd:boolean | Boolean flag |
Security: Minimum key length ensures adequate encryption strength
Specialized library constraints validate parameters for scientific and engineering libraries including linear algebra, machine learning, physics simulation, chemistry modeling, medical computing, financial modeling, engineering analysis, statistical computing, cryptographic library, QPU bridge, and quantum biology.
Validates matrix storage and computation configuration.
| Property | Type | Range |
|---|---|---|
| maxMatrixSize | xsd:integer | 1-1,000,000 |
| maxZoneCapacity | xsd:integer | 1KB-1TB |
| allowedZoneTypes | xsd:string | Dense, Sparse, Structured, Temporary |
Safety: Numerical stability enforced via condition number limits
Validates ML model configuration.
| Property | Type | Range |
|---|---|---|
| maxModelSizeMb | xsd:integer | 1-100,000 |
| maxParameters | xsd:integer | 1-10,000,000,000 |
Validates training hyperparameters.
| Property | Type | Range |
|---|---|---|
| maxEpochs | xsd:integer | 1-10,000 |
| learningRateRange | xsd:float | 0.0-1.0 |
Validates physics simulation configuration.
| Property | Type | Range |
|---|---|---|
| maxTimeSteps | xsd:integer | 1-1,000,000,000 |
| maxCflNumber | xsd:float | ≤ 1.0 |
Safety: CFL number ≤ 1.0 ensures numerical stability
Validates molecular structure configuration.
| Property | Type | Range |
|---|---|---|
| maxAtoms | xsd:integer | 1-10,000 |
| requireValenceSatisfaction | xsd:boolean | Boolean flag |
Safety: Valence satisfaction ensures chemically valid structures
Validates chemical reaction parameters.
| Property | Type | Range |
|---|---|---|
| requireMassBalance | xsd:boolean | Boolean flag |
| requireChargeBalance | xsd:boolean | Boolean flag |
Safety: Mass and charge balance ensure physical realism
Validates medical data parameters.
| Property | Type | Requirement |
|---|---|---|
| requireHipaaCompliance | xsd:boolean | Required |
| requireDeIdentification | xsd:boolean | Required |
| allowedDataTypes | xsd:string | FHIR, DICOM, HL7 |
Compliance: HIPAA compliance requirements enforced
Validates clinical decision support parameters.
| Property | Type | Range |
|---|---|---|
| requireEvidenceBased | xsd:boolean | Boolean flag |
| requirePhysicianReview | xsd:boolean | Boolean flag |
Safety: Evidence-based and physician oversight requirements
Validates medical imaging parameters.
| Property | Type | Range |
|---|---|---|
| requireDicomCompliance | xsd:boolean | Boolean flag |
| allowedModalities | xsd:string | MRI, CT, X-ray, ultrasound |
Compliance: DICOM compliance enforcement
Validates financial model parameters.
| Property | Type | Range |
|---|---|---|
| maxLeverageRatio | xsd:float | 0-100 |
| maxTimeHorizonDays | xsd:integer | 1-36,500 (100 years) |
Risk Management: Leverage and time horizon limits enforced
Validates risk calculation parameters.
| Property | Type | Range |
|---|---|---|
| confidenceLevelRange | xsd:float | 0.9-0.999 |
| maxLookbackDays | xsd:integer | 1-3,650 (10 years) |
Validates cryptographic operation parameters.
| Property | Type | Range |
|---|---|---|
| minKeyLengthBits | xsd:integer | 128-4,096 |
| allowedAlgorithms | xsd:string | AES, RSA, ECC, SHA256, Ed25519 |
Security: Key length requirements and algorithm validation
Validates key management parameters.
| Property | Type | Range |
|---|---|---|
| maxKeyLifetimeDays | xsd:integer | 1-3,650 (10 years) |
| requireKeyRotation | xsd:boolean | Boolean flag |
Security: Key rotation and lifetime management
Validates quantum processing unit parameters.
| Property | Type | Range |
|---|---|---|
| maxQubits | xsd:integer | 1-10,000 |
| maxCircuitDepth | xsd:integer | 1-100,000 |
Core modality constraints validate parameters for logical reasoning modalities including epistemic logic, paraconsistent logic, temporal LTL, spatio-temporal reasoning, graph theory, calculus, argumentation, dialectical logic, ASP, probabilistic reasoning, description logic, diffusion, linear logic, control feedback, and interval reasoning.
Validates epistemic reasoning parameters.
| Property | Type | Range |
|---|---|---|
| maxCertainty | xsd:unsignedByte | 0-255 |
| maxNestingDepth | xsd:unsignedByte | ≤ 10 (RDF-Star depth) |
| maxAgentContexts | xsd:integer | 1-1,000 |
Validates temporal LTL formula parameters.
| Property | Type | Range |
|---|---|---|
| maxTraceLength | xsd:integer | 1-1,000,000 |
| maxFormulaDepth | xsd:unsignedByte | ≤ 20 |
| allowedOperators | xsd:string | G, F, X, U, R |
Validates graph structure parameters.
| Property | Type | Range |
|---|---|---|
| maxNodes | xsd:integer | 1-10,000,000 |
| maxEdges | xsd:integer | 0-100,000,000 |
| maxNodeDegree | xsd:integer | 1-100,000 |
Validates numerical integration parameters.
| Property | Type | Range |
|---|---|---|
| maxGridPoints | xsd:integer | 1-1,000,000,000 |
| maxIntegrationSteps | xsd:integer | 1-100,000,000 |
Validates ODE solver parameters.
| Property | Type | Range |
|---|---|---|
| maxOdeOrder | xsd:unsignedByte | ≤ 10 |
| maxStepSize | xsd:float | 1e-15 - 1.0 |
| minStepSize | xsd:float | 1e-15 - 1.0 |
The computational-mathematics engine — units & dimensional analysis, number theory,
special functions, interpolation, integral transforms, vector calculus, arbitrary-precision
exact arithmetic, the symbolic CAS, and general-dimension numerical methods — carries a SHACL
q42:*ConfigurationShape per capability. Each shape bounds the capability's resource
parameters (compiled to a bounded Vec<SlgOpcode> at config time, off the hot
path) and restricts its operation set with sh:in. Namespace
q42: <https://webizen.org/q42#>. The normative shapes are emitted by
get_computational_maths_shacl_ttl() in
crates/qualia-core-db/src/modalities/logic/computational_maths_shacl.rs (mirrors the
in-browser computational engine — see the Computational Engine
demo).
Bounds SI dimensional analysis and the supported unit systems.
| Property | Type | Range / values |
|---|---|---|
| q42:dimensionComponents | xsd:integer | 1 – 7 (SI base-dimension vector) |
| q42:allowedUnitSystems | sh:in | si | cgs | imperial |
Bounds number-theory input size and the supported primitives.
| Property | Type | Range / values |
|---|---|---|
| q42:maxInputBits | xsd:integer | 1 – 4096 |
| q42:allowedOperations | sh:in | primality | factorization | gcd | totient | modular | combinatorics |
Bounds series truncation and the supported special-function families.
| Property | Type | Range / values |
|---|---|---|
| q42:maxSeriesTerms | xsd:integer | 1 – 100,000 |
| q42:allowedFamilies | sh:in | bessel | airy | zeta | legendre | chebyshev | hermite | laguerre |
Bounds interpolation node count and the supported methods.
| Property | Type | Range / values |
|---|---|---|
| q42:maxNodes | xsd:integer | 2 – 1,000,000 |
| q42:allowedMethods | sh:in | lagrange | newton | cubic_spline | least_squares |
Bounds transform sample count and the supported transforms.
| Property | Type | Range / values |
|---|---|---|
| q42:maxSamples | xsd:integer | 2 – 16,777,216 |
| q42:allowedTransforms | sh:in | dft | laplace | ztransform |
Bounds the spatial dimension and the supported differential/integral operators.
| Property | Type | Range / values |
|---|---|---|
| q42:maxSpatialDimension | xsd:integer | 2 – 3 (2-D / 3-D fields) |
| q42:allowedOperators | sh:in | gradient | divergence | curl | laplacian | line_integral | surface_integral |
Bounds arbitrary-precision digit count and the supported exact types.
| Property | Type | Range / values |
|---|---|---|
| q42:maxDigits | xsd:integer | 1 – 1,000,000 |
| q42:allowedTypes | sh:in | bigint | bigrational |
Bounds the symbolic CAS order and the supported symbolic operations.
| Property | Type | Range / values |
|---|---|---|
| q42:maxOrder | xsd:integer | 1 – 1024 |
| q42:allowedOperations | sh:in | integrate | series | limit | solve | ode_solve | pde_classify | gradient | jacobian | hessian |
Keeps assumption-gated symbolic rewrites sound, and restricts the sign-assumption domain.
| Property | Type | Range / values |
|---|---|---|
| q42:requireSoundRewrite | xsd:boolean | true ⇒ rewrites must preserve soundness |
| q42:allowedSigns | sh:in | positive | nonnegative | negative | nonpositive | nonzero |
Bounds the ODE state dimension and the supported general-dimension integrators.
| Property | Type | Range / values |
|---|---|---|
| q42:maxStateDimension | xsd:integer | 1 – 100,000 |
| q42:allowedIntegrators | sh:in | rk4 | simpson | shooting_bvp |
Infrastructure constraints validate parameters for domain-specific engines, obfuscation, solvers, and geometric algebra.
Validates biological domain parameters.
| Property | Type | Range |
|---|---|---|
| maxSequenceLength | xsd:integer | 1-1,000,000 |
| allowedSequenceTypes | xsd:string | DNA, RNA, protein |
Validates chemical domain parameters.
| Property | Type | Range |
|---|---|---|
| maxMolecularWeight | xsd:float | 1-1,000,000 Da |
| maxAtomCount | xsd:integer | 1-10,000 |
Validates financial domain parameters.
| Property | Type | Range |
|---|---|---|
| maxTransactionValue | xsd:float | 0-1e15 |
| requireComplianceCheck | xsd:boolean | Boolean flag |
Compliance: Regulatory compliance requirements
Validates obfuscation parameters.
| Property | Type | Range |
|---|---|---|
| maxObfuscationDepth | xsd:unsignedByte | ≤ 10 |
| minEntropyBits | xsd:unsignedByte | ≥ 64 |
Security: Minimum entropy requirements for data privacy
Validates semantic stripping parameters.
| Property | Type | Range |
|---|---|---|
| allowedContextTypes | xsd:string | Clinical, financial, personal |
| requireAnonymity | xsd:boolean | Boolean flag |
Privacy: Context stripping for sensitive data
Validates general solver parameters.
| Property | Type | Range |
|---|---|---|
| maxIterations | xsd:integer | 1-1,000,000 |
| convergenceTolerance | xsd:float | 1e-15 - 1.0 |
| maxStepSize | xsd:float | 1e-15 - 1.0 |
Validates quantum optimizer parameters.
| Property | Type | Range |
|---|---|---|
| maxQubits | xsd:unsignedShort | ≤ 1,000 |
| requireErrorCorrection | xsd:boolean | Boolean flag |
All constraint types implement a to_opcodes() method that generates
appropriate SlgOpcode sequences for validation in the SLG Virtual Machine.
impl ConstraintType {
pub fn to_opcodes(&self) -> Vec<SlgOpcode> {
vec![
SlgOpcode::CheckMaxInclusive(self.max_value as f64),
SlgOpcode::CheckMinInclusive(self.min_value as f64),
]
}
}
Common opcode types include:
CheckMaxInclusive - Validates upper boundsCheckMinInclusive - Validates lower boundsCheckHasValue - Validates enumeration membershipCheckMaxLength - Validates string length limitsCheckMinCount - Validates minimum occurrence requirementsConstraints use three severity levels to classify validation failures:
Medical computing constraints enforce HIPAA compliance through:
Financial modeling constraints enforce risk management through:
Cryptographic constraints enforce security through:
Scientific computing constraints enforce safety through:
This specification was developed by the Qualia Protocol Ecosystem community with contributions from the QualiaDB development team.