スキル一覧に戻る

ontology-validator

HeshamFS
更新日 2 days ago
6 閲覧
40
3
40
GitHubで表示
デザインaiautomationdesigndata

について

オントロジーバリデータースキルは、材料サンプルのアノテーションがオントロジー準拠であるかをチェックし、用語の存在、ドメイン/範囲の一貫性、必須プロパティの完全性を検証します。このスキルは、CMSOなどのオントロジーに対してアノテーションを監査し、FAIRデータ標準を確保してから公開する前に使用されます。開発者は、ワークフローの早期段階でクラスやプロパティ定義のエラーを検出するために活用すべきです。

クイックインストール

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

デザイン

executing-plansスキルは、完全な実装計画があり、それを管理されたバッチでレビューチェックポイントを設けながら実行する場合に使用します。このスキルは計画を読み込んで批判的にレビューした後、小さなバッチ(デフォルトは3タスク)でタスクを実行し、各バッチの間に進捗状況を報告してアーキテクトのレビューを受けます。これにより、品質管理チェックポイントが組み込まれた体系的な実装が保証されます。

スキルを見る

requesting-code-review

デザイン

このスキルは、コードレビュアーサブエージェントを起動し、処理を進める前に要件に対してコード変更を分析します。タスク完了後、主要な機能の実装後、またはmainブランチへのマージ前などに使用すべきです。このレビューは、現在の実装と元の計画を比較することで、問題を早期に発見するのに役立ちます。

スキルを見る

connect-mcp-server

デザイン

このスキルは、開発者がHTTP、stdio、またはSSEトランスポートを使用してMCPサーバーをClaude Codeに接続するための包括的なガイドを提供します。GitHub、Notion、カスタムAPIなどの外部サービスを統合するためのインストール、設定、認証、セキュリティについて解説しています。MCP統合のセットアップ、外部ツールの設定、またはClaudeのModel Context Protocolを扱う際にご利用ください。

スキルを見る

web-cli-teleport

デザイン

このスキルは、タスク分析に基づいて開発者がClaude Code WebとCLIインターフェースの選択を支援し、これらの環境間でのシームレスなセッションテレポーテーションを可能にします。Web、CLI、モバイル環境を切り替える際のセッション状態とコンテキストを管理することで、ワークフローを最適化します。様々な段階で異なるツールを必要とする複雑なプロジェクトにご活用ください。

スキルを見る