Agent skill
ontology-validator
Validate material sample annotations against ontology constraints — check that class names and property names exist in the ontology, verify domain and range consistency for object property relationships, assess annotation completeness (required, recommended, and optional properties), and flag unknown or misspelled terms. Use when verifying that CMSO or other ontology annotations are correct before publishing, checking whether all required properties are present for a class like Crystal Structure or Unit Cell, auditing relationship triples between instances, or catching annotation errors early in a FAIR data workflow, even if the user only says "is my annotation correct" or "what am I missing."
Install this agent skill to your Project
npx add-skill https://github.com/HeshamFS/materials-simulation-skills/tree/main/skills/ontology/ontology-validator
Metadata
Additional technical details for this skill
- author
- HeshamFS
- version
- 1.1.0
- eval cases
- 2
- tested with
-
[ "claude-code", "gemini-cli", "vs-code-copilot" ] - last reviewed
- 2026-03-26
- security tier
- high
- security reviewed
- YES
SKILL.md
Ontology Validator
Goal
Validate that material sample annotations comply with ontology constraints: correct class names, valid properties, consistent domain/range relationships, and required fields present.
Requirements
- Python 3.8+
- No external dependencies (Python standard library only)
- Requires ontology-explorer's
cmso_summary.jsonandontology_registry.json
Inputs to Gather
| Input | Description | Example |
|---|---|---|
| Annotation | JSON dict or list of annotation dicts | {"class":"UnitCell","properties":{"has Bravais lattice":"cF"}} |
| Class name | Class to check completeness for | Crystal Structure |
| Provided properties | Comma-separated property names | "has unit cell,has space group" |
| Relationships | JSON array of subject-property-object triples | [{"subject_class":"Material","property":"has structure","object_class":"Crystal Structure"}] |
Decision Guidance
What do you need to validate?
├── An annotation (classes and properties are correct)
│ └── schema_checker.py --ontology cmso --annotation '<json>'
├── Completeness of a class annotation
│ └── completeness_checker.py --ontology cmso --class <name> --provided <props>
└── Object property relationships
└── relationship_checker.py --ontology cmso --relationships '<json>'
Script Outputs (JSON Fields)
| Script | Key Outputs |
|---|---|
scripts/schema_checker.py |
results.valid, results.errors, results.warnings, results.class_valid, results.properties_valid |
scripts/completeness_checker.py |
results.completeness_score, results.required_missing, results.recommended_missing, results.optional_missing, results.unrecognized |
scripts/relationship_checker.py |
results.valid, results.results, results.errors |
Workflow
- After mapping a sample with ontology-mapper, pass the annotations to
schema_checker.pyto verify correctness. - For a specific class, use
completeness_checker.pyto see what required/recommended properties are missing. - When building relationships between instances, use
relationship_checker.pyto ensure domain/range consistency.
Conversational Workflow Example
User: I annotated my sample as CrystalStructure with properties hasUnitCell and hasBasis.
Is this correct and complete?
Agent: Let me validate your annotation and check completeness.
[Runs: completeness_checker.py --ontology cmso --class "Crystal Structure" --provided "has unit cell,has basis" --json]
Your annotation is partially complete:
- has unit cell: provided (required)
- has basis: not a direct property of Crystal Structure (it belongs to Unit Cell)
- **Missing required**: has space group
The "has basis" property belongs to the Unit Cell class, not Crystal Structure.
You should add "has space group" to Crystal Structure and move "has basis"
to the Unit Cell annotation.
CLI Examples
# Validate an annotation
python3 skills/ontology/ontology-validator/scripts/schema_checker.py \
--ontology cmso \
--annotation '{"class":"Unit Cell","properties":{"has Bravais lattice":"cF"}}' \
--json
# Check completeness
python3 skills/ontology/ontology-validator/scripts/completeness_checker.py \
--ontology cmso \
--class "Crystal Structure" \
--provided "has unit cell,has space group" \
--json
# Validate relationships
python3 skills/ontology/ontology-validator/scripts/relationship_checker.py \
--ontology cmso \
--relationships '[{"subject_class":"Computational Sample","property":"has material","object_class":"Material"}]' \
--json
Error Handling
| Error | Cause | Resolution |
|---|---|---|
Class 'X' not found |
Invalid class name | Use ontology-explorer to find correct name |
Property 'X' not found |
Invalid property name | Use property_lookup.py to search |
Annotation must be a dict |
Wrong input format | Provide valid JSON dict |
Relationships must be a non-empty list |
Wrong input format | Provide JSON array of relationship dicts |
Interpretation Guidance
- Errors indicate definite problems (unknown class/property, range mismatch)
- Warnings indicate potential issues (domain mismatch — may be intentional for subclasses)
- Completeness score: 0.0-1.0 ratio of provided vs. total tracked properties
- required_missing: must fix for valid annotation
- recommended_missing: should fix for quality
- unrecognized: may indicate typos or properties from a different ontology
Security
Input Validation
--ontologyis validated against registered ontology names inontology_registry.json(fixed allowlist)--annotationJSON is parsed withjson.loads()and validated as a dict with requiredclassandpropertieskeys--classnames are validated against known classes in the ontology summary; unknown classes produce clear errors--providedproperty names are validated as comma-separated strings and matched against known properties--relationshipsJSON is parsed and validated as a non-empty list of dicts, each requiringsubject_class,property, andobject_classkeys
File Access
- Scripts read pre-processed JSON files from the
references/directory:ontology_registry.json,cmso_summary.json,cmso_constraints.json(all read-only) - No scripts write to the filesystem; all output goes to stdout
- No network access is required
Tool Restrictions
- Read: Used to inspect script source, reference files, and ontology constraint data
- Bash: Used to execute the three Python validation scripts (
schema_checker.py,completeness_checker.py,relationship_checker.py) with explicit argument lists
Safety Measures
- No
eval(),exec(), or dynamic code generation - All subprocess calls use explicit argument lists (no
shell=True) - JSON input parsing uses
json.loads()only (no pickle, no YAML with unsafe loaders) - Validation logic operates on pre-loaded in-memory data structures; no dynamic file discovery or traversal
Limitations
- Constraints file is manually curated, not derived from OWL axioms
- Does not validate data types (e.g., whether a value is actually a float vs string)
- Does not validate cardinality (e.g., exactly one space group per structure)
- Subclass checking uses simple parent traversal, not full OWL reasoning
References
- Validation Rules — what is validated and why
- CMSO Constraints — required/recommended properties per class
- CMSO Guide — CMSO ontology overview
Version History
| Date | Version | Changes |
|---|---|---|
| 2026-02-25 | 1.0 | Initial release with CMSO validation support |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
post-processing
Extract, analyze, and summarize simulation output data — pull spatial fields at specific timesteps, compute time-series trends and detect steady state, extract line profiles through the domain, generate statistical summaries and distributions, calculate derived quantities (gradients, fluxes, volume fractions, interface area), compare results against analytical solutions or experimental data, and produce automated analysis reports. Use when interpreting finished simulation results, checking mass or energy conservation, comparing two runs or meshes, extracting interface profiles from phase-field output, or preparing publication-quality analysis, even if the user only says "what do my results look like" or "did my simulation reach steady state."
performance-profiling
Identify computational bottlenecks, analyze parallel scaling, estimate memory requirements, and generate optimization recommendations for materials simulations — parse timing logs to find dominant phases (solver, assembly, I/O), evaluate strong and weak scaling efficiency, profile memory from mesh and field parameters, and detect bottlenecks with actionable fix suggestions. Use when a simulation is running slower than expected, investigating MPI scaling efficiency, planning HPC resource allocation, deciding whether to tune the preconditioner or reduce I/O frequency, or estimating if a problem fits in available RAM, even if the user only says "my simulation is too slow" or "how many nodes do I need."
parameter-optimization
Explore and optimize simulation parameters via design of experiments (DOE), sensitivity analysis, and optimizer selection — generate Latin Hypercube, quasi-random, or factorial sample plans, rank parameter influence with sensitivity scores, recommend Bayesian optimization, CMA-ES, or gradient- based methods based on dimension and budget, and fit surrogate models for expensive evaluations. Use when calibrating material properties against experimental data, planning a parameter sweep, performing uncertainty quantification, or choosing an optimization strategy for a simulation with a limited evaluation budget, even if the user only says "which parameters matter most" or "how do I calibrate my model."
simulation-validator
Validate simulations across three stages — run pre-flight checks on configuration files (parameter ranges, required fields, disk space), monitor runtime logs for residual growth, NaN/Inf, and adaptive dt collapse, and perform post-flight validation of results (physical bounds, mass/energy conservation, convergence). Diagnose failed simulations with probable-cause analysis and recommended fixes. Use when preparing to launch a simulation, checking whether a running job is healthy, verifying that finished results are trustworthy, or debugging a crash or blow-up, even if the user only says "my simulation crashed" or "can I trust these results."
simulation-orchestrator
Orchestrate multi-simulation campaigns — generate parameter sweep configurations (grid, linspace, or Latin Hypercube sampling), initialize and track batch job campaigns, monitor job completion status, and aggregate results with summary statistics across all runs. Use when running a parameter study across dt, kappa, or other simulation inputs, managing dozens or hundreds of simulation configurations, combining outputs from completed batch runs to find the best result, or automating the generate-run-collect workflow for systematic studies, even if the user only says "I need to try many parameter combinations" or "how do I organize a sweep."
ontology-explorer
Parse, navigate, and query materials science ontology structures — browse class hierarchies, inspect individual classes and their properties, look up object and data property definitions with domain/range, search for ontology terms by keyword, and parse or summarize raw OWL/XML files. Supports the OCDO ecosystem (CMSO, ASMO, CDCO, PODO, PLDO, LDO). Use when exploring what classes or properties an ontology provides, finding the right CMSO term for a crystal structure or simulation concept, understanding parent-child class relationships, or onboarding to an unfamiliar materials ontology, even if the user only says "what ontology terms describe my FCC copper simulation" or "show me the CMSO class hierarchy."
Didn't find tool you were looking for?