Infer QUDT/SOSA/PROV annotations for FAIR exports #112
+1,054
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Equipment registered through the web form stores plain unit strings ("sccm", "mTorr", "°C/min") and a free-text equipment type. The FAIR exporter could emit QUDT / SOSA / PROV-O terms, but only when the config already carried them, so most registered equipment was exported without them.
api/fair_ontology.pyinfers those terms from what the owner entered:Rules: never overwrite an existing value; never guess an ambiguous unit ("A"), report it instead.
Where it applies
At export time only (
fair_archiver._prepare_domain_config), becausePATCH /equipmentrebuildsconfig_jsonand would drop stored values. If inference fails, the export falls back to the normalized config unchanged.Inferred terms are marked in both the per-run JSON-LD and the RO-Crate manifest with a schema.org
additionalPropertynamedontologyInferred, so consumers can tell them apart from owner-entered terms.api/scripts/fair_ontology_dry_run.pyreports, per equipment, what would be filled in and what still needs the owner. It is read-only.Also handles production config shapes: workflow-example equipment store
domainas a bare id and list features/targets by name.Tests
api/tests/test_fair_ontology.py: 26 tests, including the RO-Crate manifest.test_e2e_platformneeds a live database and was not run.Reviewed by Codex over three rounds, ending in APPROVE.
No schema change and no migration. Only the FAIR export output changes.
🤖 Generated with Claude Code