返回技能列表

ontology-validator

HeshamFS
更新于 Yesterday
2 次查看
40
3
40
在 GitHub 上查看
设计aiautomationdesigndata

关于

The ontology-validator skill checks material sample annotations for ontology compliance, verifying term existence, domain/range consistency, and completeness of required properties. It's used to audit annotations against ontologies like CMSO before publishing, ensuring FAIR data standards. Developers should use it to catch errors in class and property definitions early in the workflow.

快速安装

Claude Code

推荐
主要方式
npx skills add HeshamFS/materials-simulation-skills -a claude-code
插件命令备选方式
/plugin add https://github.com/HeshamFS/materials-simulation-skills
Git 克隆备选方式
git clone https://github.com/HeshamFS/materials-simulation-skills.git ~/.claude/skills/ontology-validator

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

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.json and ontology_registry.json

Inputs to Gather

InputDescriptionExample
AnnotationJSON dict or list of annotation dicts{"class":"UnitCell","properties":{"has Bravais lattice":"cF"}}
Class nameClass to check completeness forCrystal Structure
Provided propertiesComma-separated property names"has unit cell,has space group"
RelationshipsJSON 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)

ScriptKey Outputs
scripts/schema_checker.pyresults.valid, results.errors, results.warnings, results.class_valid, results.properties_valid
scripts/completeness_checker.pyresults.completeness_score, results.required_missing, results.recommended_missing, results.optional_missing, results.unrecognized
scripts/relationship_checker.pyresults.valid, results.results, results.errors

Workflow

  1. After mapping a sample with ontology-mapper, pass the annotations to schema_checker.py to verify correctness.
  2. For a specific class, use completeness_checker.py to see what required/recommended properties are missing.
  3. When building relationships between instances, use relationship_checker.py to 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

ErrorCauseResolution
Class 'X' not foundInvalid class nameUse ontology-explorer to find correct name
Property 'X' not foundInvalid property nameUse property_lookup.py to search
Annotation must be a dictWrong input formatProvide valid JSON dict
Relationships must be a non-empty listWrong input formatProvide 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

  • --ontology is validated against registered ontology names in ontology_registry.json (fixed allowlist)
  • --annotation JSON is parsed with json.loads() and validated as a dict with required class and properties keys
  • --class names are validated against known classes in the ontology summary; unknown classes produce clear errors
  • --provided property names are validated as comma-separated strings and matched against known properties
  • --relationships JSON is parsed and validated as a non-empty list of dicts, each requiring subject_class, property, and object_class keys

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

Version History

DateVersionChanges
2026-02-251.0Initial release with CMSO validation support

GitHub 仓库

HeshamFS/materials-simulation-skills
路径: skills/ontology/ontology-validator
0
agent-skillsagentscli-toolscomputational-sciencellmmaterials-science

相关推荐技能

executing-plans

设计

该Skill用于当开发者提供完整实施计划时,以受控批次方式执行代码实现。它会先审阅计划并提出疑问,然后分批次执行任务(默认每批3个任务),并在批次间暂停等待审查。关键特性包括分批次执行、内置检查点和架构师审查机制,确保复杂系统实现的可控性。

查看技能

requesting-code-review

设计

该Skill可在完成任务、实现主要功能或合并代码前自动调度代码审查子代理,确保实现符合需求和计划。它支持通过指定git SHA范围进行精准的代码变更审查,帮助开发者在关键节点及时发现潜在问题。核心原则是"早审查、勤审查",适用于开发流程的各个关键阶段。

查看技能

connect-mcp-server

设计

这个Skill指导开发者如何将MCP服务器连接到Claude Code,支持HTTP、stdio和SSE三种传输协议。它涵盖了从安装配置到认证安全的完整流程,适用于集成GitHub、Notion、数据库等外部服务。当开发者需要添加集成、配置外部工具或提及MCP相关功能时,这个Skill能提供实用的操作指南。

查看技能

web-cli-teleport

设计

该Skill帮助开发者根据任务特性选择Claude Code的Web或CLI界面,并指导如何在两种环境间无缝迁移会话。它能分析任务复杂度、迭代需求等要素,推荐最优工作界面和工作流。关键特性包括会话状态管理、环境切换指导和上下文优化建议。

查看技能