heshamfs/materials-simulation-skills/ontology-mapper
Claude Code and agent skill by heshamfs/materials-simulation-skills
- community
Checking that the SKILL.md file is still in the repository.
Map materials science terms, crystal structures, and sample descriptions to standardized ontology classes and properties — resolve natural-language concepts to ontology entries with confidence scores, translate Bravais lattice types, space groups, and lattice constants into ontology-compliant annotations, and produce full sample metadata from structured descriptions. Supports any ontology in ontology_registry.json (CMSO, ASMO, etc.). Use when annotating simulation inputs with FAIR metadata, translating "BCC iron" or "FCC copper" into formal ontology terms, preparing machine- readable sample descriptions, or bridging between lab vocabulary and ontology vocabulary, even if the user only says "what CMSO terms describe my material" or "annotate this sample for me."
Install
npx vskill@latest install heshamfs/materials-simulation-skills/ontology-mapperSKILL.md
Ontology Mapper
Goal
Translate real-world materials science descriptions into standardized ontology annotations. Given terms like "FCC copper" or structured data like {"material": "iron", "structure": "BCC", "lattice_a": 2.87}, produce the corresponding ontology classes and properties for any registered ontology.
Requirements
- Python 3.10+
- No external dependencies (Python standard library only)
- Requires ontology-explorer's summary JSON and
ontology_registry.json - Per-ontology mapping config (
<name>_mappings.json) for ontology-specific synonyms and labels
Inputs to Gather
| Input | Description | Example | |
|---|---|---|---|
| Ontology | Ontology name from registry | cmso, asmo | |
| Term(s) | Natural-language materials concept(s) | "unit cell", "FCC,copper,lattice" | |
| Crystal system | One of the 7 crystal systems | cubic, hexagonal | |
| Bravais lattice | Lattice type (symbol or common name) | FCC, cF, BCC | |
| Space group | Space group number (1-230) | 225 | |
| Lattice parameters | a, b, c in angstroms; alpha, beta, gamma in degrees | a=3.615 | |
| Sample description | JSON dict with material properties | {"material":"copper","structure":"FCC"} |
Decision Guidance
Ontology scope — crystal/sample annotation is CMSO-only.crystal_mapper.pyandsample_annotator.pyemit crystal-structure vocabulary (Crystalline Material,Crystal Structure, Unit Cell, Space Group, lattice properties). This vocabulary isdefined by CMSO. **ASMO is a simulation-methods ontology and does not define anycrystal/sample classes** — so for ASMO use the concept-mapping path(concept_mapper.py, which resolves terms like DFT, NPT, timestep, PBE to real ASMOclasses) only. Ifsample_annotator.py/crystal_mapper.pyis run with an ontologywhose summary lacks the required classes (e.g.--ontology asmo), each unresolvableterm is flagged inresults.validation_warningsand givenconfidence: 0.0ratherthan silently emitting an invalid term.
Script Outputs (JSON Fields)
| Script | Key Outputs | |
|---|---|---|
scripts/concept_mapper.py | results.matches, results.unmatched, results.suggestions | |
scripts/crystal_mapper.py | results.ontology_classes, results.ontology_properties, results.effective_system, results.bravais_lattice, results.validation_warnings | |
scripts/sample_annotator.py | results.annotations, results.sample_type, results.material_type, results.unmapped_fields, results.suggested_properties, results.validation_warnings |
Workflow
- If the user provides natural-language terms, use
concept_mapper.pyto find matching ontology classes. - If the user describes crystal structure parameters, use
crystal_mapper.pyto map them and validate constraints. - For a complete sample description, use
sample_annotator.pyto produce full ontology annotations. - Review any validation warnings (e.g., lattice parameter mismatches for the crystal system).
- Check
unmapped_fieldsandsuggested_propertiesfor completeness.
Conversational Workflow Example
CLI Examples
Adding a New Ontology
To support a new ontology, create a <name>_mappings.json in references/:
Then add "mappings_file": "myonto_mappings.json" to the ontology's entry in ontology_registry.json. No code changes needed.
Only include the `sample_schema`, `crystal_output`, `material_type_rules` and `annotation_routing` blocks if every class/property they name actually exists in that ontology's summary. sample_annotator.py validates emitted terms against the loaded summary and flags any that are undefined (results.validation_warnings, confidence: 0.0). For example, asmo_mappings.json deliberately ships only synonyms and property_synonyms because ASMO is a simulation-methods ontology with no crystal/sample vocabulary — its concept terms (DFT, NPT, timestep, PBE) all resolve, but a crystal/sample config would emit unresolvable terms.
Error Handling
| Error | Cause | Resolution | |
|---|---|---|---|
space_group must be between 1 and 230 | Invalid space group number | Use a valid space group number | |
a must be positive | Non-positive lattice parameter | Provide positive values in angstroms | |
Unrecognized Bravais lattice '<x>' | Bravais symbol/name not in the recognized set | Use a common name (FCC, BCC, HCP) or a Pearson symbol (cF, cI, hP, ...) | |
Term exceeds maximum length of 200 characters | A --term/--terms entry is too long | Shorten the term | |
Too many terms (max 100) | More than 100 terms supplied | Split into smaller batches | |
Sample must be a non-empty dict | Empty or missing sample data | Provide a valid JSON sample dict | |
Sample has too many keys (max 100) | Oversized sample dict | Reduce the number of sample keys | |
| Validation warnings (lattice) | Lattice parameters inconsistent with crystal system | Check that a=b=c for cubic, etc. | |
results.validation_warnings (terms) | Emitted class/property not defined in the chosen ontology (e.g. crystal terms for ASMO) | Use CMSO for crystal/sample annotation; use ASMO only for concept mapping |
Interpretation Guidance
- Confidence scores: 1.0 = exact label match, 0.9 = synonym-table match, 0.7 = substring match, 0.5 = description match. Note: the per-ontology synonym table is consulted before exact-label matching, so a term that is both a synonym key and a class label (e.g.
space group,unit cell,atom) is reported as a 0.9 synonym match even though it coincides exactly with a class label — the matched class and IRI are still correct. - `sample_annotator.py` validation warnings: every emitted class/property is checked against the loaded ontology summary. Terms not defined in that ontology are flagged in
results.validation_warnings(and the corresponding annotation gets avalidation_warningfield withconfidence: 0.0). This is how the annotator signals that a crystal/sample term cannot resolve to an IRI in the chosen ontology (e.g. running--ontology asmoon a crystalline sample — see below). - Validation warnings: indicate potential mistakes (e.g., specifying a!=b for cubic). These are warnings, not errors — the mapping still proceeds.
- Unmapped fields: input keys that the annotator doesn't recognize. These may need manual mapping.
- Suggested properties: additional ontology properties that would make the annotation more complete.
Verification checklist
- [ ] Confirmed
results.validation_warningsis empty (or every entry is explained) — a non-empty list means an emitted class/property is not defined in the chosen ontology and was givenconfidence: 0.0; do not report such terms as valid annotations. - [ ] Recorded the
match_typeandconfidencefor each concept match and confirmed the chosen term is acceptable for its tier (1.0 exact, 0.9 synonym, 0.7 substring, 0.5 description); for anysubstring_*ordescription_classmatch, verified the matched class is actually the intended concept and not an incidental string hit. - [ ] For crystal mappings, recorded
results.effective_systemandresults.bravais_lattice(the resolved Pearson symbol, e.g.cF/cI), and confirmed the input Bravais/space-group/system are mutually consistent (no "space group N implies X but Y was specified" warning invalidation_warnings). - [ ] Checked lattice-parameter constraints against
effective_system— confirmed no warnings such as "Cubic requires a=b" / angle-90 violations, or explicitly justified each one (warnings are advisory, the mapping still proceeds). - [ ] Listed
results.unmatched(concept) andresults.unmapped_fields(sample) and confirmed nothing materially important was silently dropped; ran the emittedclass_browser.pysuggestion for any unmatched term that should have resolved. - [ ] Reviewed
results.suggested_propertiesand recorded which missing fields (elements, space_group, lattice_a, ...) are intentionally omitted vs. should be added before the annotation is considered complete.
Common pitfalls & rationalizations
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ontology/ontology-mapper/SKILL.md
Popularity
- Repository stars
- 54
- Repository forks
- 4
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 5 Jul 2026, 4 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/heshamfs/materials-simulation-skills/ontology-mapper)