SEM001: Mass Fraction Sum¶
Severity: Warning Category: Semantic Validation
Description¶
Material mass fractions should sum to 1.0 (100%).
Rule Details¶
This rule checks that the massFraction values in materialsProvenance sum to approximately 1.0. Per the UNTP specification, partial declarations (sum < 1.0) are valid but should be flagged as a warning to ensure completeness.
- Sum > 1.0: Physically impossible, always flagged
- Sum < 1.0: Valid partial declaration, flagged as warning
- Sum ≈ 1.0: Valid (within 0.01 tolerance)
Example¶
Invalid¶
{
"credentialSubject": {
"materialsProvenance": [
{"name": "Cotton", "massFraction": 0.5},
{"name": "Polyester", "massFraction": 0.3}
]
}
}
Message: Mass fractions sum to 0.800, expected 1.0 (partial declaration)
Valid¶
{
"credentialSubject": {
"materialsProvenance": [
{"name": "Cotton", "massFraction": 0.6},
{"name": "Polyester", "massFraction": 0.4}
]
}
}
How to Fix¶
Ensure all material mass fractions sum to 1.0. If some materials are unknown, consider:
- Adding an "Other" or "Unknown" material category
- Documenting the partial declaration in metadata
References¶
- UNTP DPP Specification
- JSON Path:
$.credentialSubject.materialsProvenance[*].massFraction