返回技能列表

ontology-explorer

HeshamFS
更新于 2 days ago
8 次查看
40
3
40
在 GitHub 上查看
文档处理wordaidata

关于

The ontology-explorer skill parses and queries materials science ontologies (like CMSO/ASMO) to browse class hierarchies, inspect properties, and search for terms. It helps developers find the right ontology terms for concepts like crystal structures or simulation metadata. Use it to explore ontology structures, understand class relationships, or onboard to an unfamiliar materials ontology.

快速安装

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-explorer

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

技能文档

Ontology Explorer

Goal

Enable an agent to understand, navigate, and query the structure of materials science ontologies without loading verbose OWL/XML files directly. Provides fast access to class hierarchies, property definitions, and domain-range relationships through pre-processed JSON summaries.

Requirements

  • Python 3.8+
  • No external dependencies (Python standard library only)
  • Internet access required only for owl_parser.py and ontology_summarizer.py when fetching remote OWL files

Inputs to Gather

InputDescriptionExample
Ontology nameRegistered ontology to querycmso
Class nameA specific class to inspectMaterial, UnitCell
Property nameA specific property to look uphasMaterial, hasSpaceGroupNumber
Search termKeyword to search across labelscrystal, lattice
OWL sourcePath or URL to an OWL/XML file (for parsing/summarizing)https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl

Decision Guidance

What do you need?
├── Understand overall ontology structure
│   └── class_browser.py --ontology cmso --list-roots
├── Inspect a specific class
│   └── class_browser.py --ontology cmso --class <name>
├── Find properties for a class
│   └── property_lookup.py --ontology cmso --class <name>
├── Look up a specific property
│   └── property_lookup.py --ontology cmso --property <name>
├── Search for a concept
│   ├── class_browser.py --ontology cmso --search <term>
│   └── property_lookup.py --ontology cmso --search <term>
├── Parse a new/updated OWL file
│   └── owl_parser.py --source <path-or-url>
└── Generate/refresh a summary JSON
    └── ontology_summarizer.py --source <url> --output <path>

Script Outputs (JSON Fields)

ScriptKey Outputs
scripts/owl_parser.pyresults.metadata, results.classes, results.object_properties, results.data_properties, results.class_hierarchy
scripts/ontology_summarizer.pyresults.output_file, results.statistics
scripts/class_browser.pyresults.class_info, results.subtree, results.properties, results.path_to_root, results.roots, results.search_results
scripts/property_lookup.pyresults.property_info, results.class_properties, results.search_results

Workflow

  1. Identify which ontology the user is working with (default: CMSO).
  2. Use class_browser.py --list-roots to see the top-level concepts.
  3. Drill into specific classes with class_browser.py --class <name> to see hierarchy, children, and applicable properties.
  4. Look up individual properties with property_lookup.py --property <name>.
  5. If the user mentions a concept but not its ontology name, use --search to find matching classes or properties.
  6. For a new or updated ontology, run owl_parser.py to parse the raw OWL, then ontology_summarizer.py to generate a summary JSON.

Conversational Workflow Example

User: I have an FCC copper simulation. What CMSO classes should I use to describe it?

Agent: Let me explore the CMSO ontology to find the relevant classes.

[Runs: class_browser.py --ontology cmso --search "crystal" --json]

For an FCC copper simulation, the relevant CMSO classes are:

- **Computational Sample** → **Atomic Scale Sample**: your simulation is an atomic-scale sample
- **Material** → **Crystalline Material**: copper is crystalline
- **Crystal Structure**: describes the FCC arrangement
- **Unit Cell**: the repeating FCC unit cell (a=b=c=3.615 Å, α=β=γ=90°)
- **Space Group**: FCC copper is space group 225 (Fm-3m)
- **Chemical Element**: Cu

The key relationships:
  AtomicScaleSample → hasMaterial → CrystallineMaterial → hasStructure → CrystalStructure → hasUnitCell → UnitCell

Shall I look up the specific properties for any of these classes?

CLI Examples

# List root classes in CMSO
python3 skills/ontology/ontology-explorer/scripts/class_browser.py \
  --ontology cmso --list-roots --json

# Inspect the Material class hierarchy
python3 skills/ontology/ontology-explorer/scripts/class_browser.py \
  --ontology cmso --class Material --json

# Search for crystal-related classes
python3 skills/ontology/ontology-explorer/scripts/class_browser.py \
  --ontology cmso --search crystal --json

# Find all properties for UnitCell
python3 skills/ontology/ontology-explorer/scripts/property_lookup.py \
  --ontology cmso --class UnitCell --json

# Look up a specific property
python3 skills/ontology/ontology-explorer/scripts/property_lookup.py \
  --ontology cmso --property "has space group" --json

# Parse a remote OWL file
python3 skills/ontology/ontology-explorer/scripts/owl_parser.py \
  --source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl --json

# Generate a summary JSON from an OWL file
python3 skills/ontology/ontology-explorer/scripts/ontology_summarizer.py \
  --source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl \
  --output summary.json --json

Error Handling

ErrorCauseResolution
Ontology 'X' not in registryOntology name not registeredCheck references/ontology_registry.json for available names
Class 'X' not foundClass label doesn't match any entryUse --search to find similar names, or --list-roots to see available classes
Property 'X' not foundProperty label doesn't matchUse --search to find similar properties
Cannot parse OWL sourceInvalid XML or unreachable URLCheck file path or URL; ensure the file is valid OWL/XML
Summary file not foundSummary JSON hasn't been generatedRun ontology_summarizer.py first

Interpretation Guidance

  • Class hierarchy: root classes are the broadest concepts; leaf classes are the most specific. A class inherits all properties from its ancestors.
  • Object properties: show how classes relate to each other (domain → range). A property with domain UnitCell and range Basis means a unit cell has a basis.
  • Data properties: show what literal values a class carries. A property with domain ChemicalElement and range xsd:string means an element has a string-valued attribute.
  • Union domains: some properties apply to multiple classes (e.g., hasVector applies to both SimulationCell and UnitCell), shown as SimulationCell | UnitCell.
  • Search relevance: 1.0 = label match, 0.5 = description match only.

Security

Input Validation

  • --ontology is validated against registered ontology names in ontology_registry.json (fixed allowlist)
  • --class and --property names are validated against a safe-character pattern to prevent injection
  • --search terms are length-limited and used only for substring matching against pre-processed labels (never interpolated into queries or code)
  • --source for owl_parser.py accepts file paths or URLs; URLs are validated against https:// scheme only

File Access

  • class_browser.py and property_lookup.py read pre-processed JSON summary files from the references/ directory (read-only)
  • owl_parser.py reads a single OWL/XML file from a local path or HTTPS URL; remote fetches have a 30-second timeout
  • ontology_summarizer.py writes a single JSON summary file to the path specified by --output
  • No scripts modify or delete existing files

Tool Restrictions

  • Read: Used to inspect script source, reference files, and ontology summaries
  • Bash: Used to execute the four Python scripts (owl_parser.py, ontology_summarizer.py, class_browser.py, property_lookup.py) with explicit argument lists; URL fetching is contained within the Python scripts with timeout limits

Safety Measures

  • No eval(), exec(), or dynamic code generation
  • All subprocess calls use explicit argument lists (no shell=True)
  • OWL/XML parsing uses Python's xml.etree.ElementTree which does not resolve external entities by default, mitigating XXE attacks
  • Remote URL fetching is limited to HTTPS with a 30-second timeout to prevent abuse
  • Search results are capped in count to prevent output flooding

Limitations

  • Only supports OWL/XML format (not Turtle, JSON-LD, or N-Triples)
  • Does not support OWL reasoning or inference (e.g., does not compute transitive closures)
  • Class hierarchy extraction handles simple rdfs:subClassOf only (not complex OWL restrictions)
  • Descriptions may be missing for classes that lack rdfs:comment, skos:definition, or IAO annotations
  • URL fetching requires internet access and may time out (30-second limit)

References

Version History

DateVersionChanges
2026-02-251.0Initial release with CMSO support

GitHub 仓库

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

相关推荐技能

release-standards

文档处理

这个Skill为开发者提供了语义化版本规范和变更日志格式标准。它能在准备软件发布时快速指导版本号更新和变更日志撰写,包含版本号递增规则、预发布标识符等关键信息。适用于需要遵循规范发布流程的开发场景。

查看技能

commit-standards

文档处理

这个Skill帮助开发者遵循Conventional Commits规范格式化Git提交信息。它提供了标准格式模板和常用提交类型的中英文对照表(如feat/新增、fix/修正等),适用于编写提交、执行git commit或审查提交历史的场景。通过确保提交信息的规范性和一致性,它能提升团队协作效率和版本历史可读性。

查看技能

huggingface-tokenizers

文档处理

HuggingFace Tokenizers 提供了基于 Rust 的高性能分词工具,支持 BPE、WordPiece 和 Unigram 算法,能在一分钟内处理 1GB 文本。它适用于需要快速分词或训练自定义词汇表的场景,并能无缝集成到 transformers 库中。开发者可以借助它进行对齐跟踪、填充截断等操作,满足从研究到生产的全流程需求。

查看技能

nano-pdf

文档处理

nano-pdf 让开发者能用自然语言指令直接编辑PDF文件,无需手动操作复杂工具。它通过命令行快速修改指定页面内容,如修正拼写错误或更新标题,适合处理日常文档微调。使用前请注意核对页码和输出结果,确保修改准确无误。

查看技能