ontology-explorer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOntology 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.
让Agent能够理解、浏览和查询材料科学本体的结构,无需直接加载冗长的OWL/XML文件。通过预处理的JSON摘要提供对类层级、属性定义以及定义域-值域关系的快速访问。
Requirements
要求
- Python 3.10+
- No external dependencies (Python standard library only)
- Internet access required only for and
owl_parser.pywhen fetching remote OWL filesontology_summarizer.py
- Python 3.10+
- 无外部依赖(仅使用Python标准库)
- 仅当和
owl_parser.py获取远程OWL文件时需要互联网访问ontology_summarizer.py
Inputs to Gather
需要收集的输入
| Input | Description | Example |
|---|---|---|
| Ontology name | Registered ontology to query | |
| Class name | A specific class to inspect | |
| Property name | A specific property to look up | |
| Search term | Keyword to search across labels | |
| OWL source | Path or URL to an OWL/XML file (for parsing/summarizing) | |
| 输入项 | 描述 | 示例 |
|---|---|---|
| 本体名称 | 要查询的已注册本体 | |
| 类名称 | 要查看的特定类 | |
| 属性名称 | 要查找的特定属性 | |
| 搜索术语 | 用于跨标签搜索的关键词 | |
| OWL源 | OWL/XML文件的路径或URL(用于解析/总结) | |
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>你需要什么?
├── 理解本体整体结构
│ └── class_browser.py --ontology cmso --list-roots
├── 查看特定类
│ └── class_browser.py --ontology cmso --class <名称>
├── 查找类的属性
│ └── property_lookup.py --ontology cmso --class <名称>
├── 查找特定属性
│ └── property_lookup.py --ontology cmso --property <名称>
├── 搜索概念
│ ├── class_browser.py --ontology cmso --search <术语>
│ └── property_lookup.py --ontology cmso --search <术语>
├── 解析新的/更新的OWL文件
│ └── owl_parser.py --source <路径或URL>
└── 生成/刷新摘要JSON
└── ontology_summarizer.py --source <URL> --output <路径>Script Outputs (JSON Fields)
脚本输出(JSON字段)
| Script | Key Outputs |
|---|---|
| |
| |
| |
| |
| 脚本 | 关键输出 |
|---|---|
| |
| |
| |
| |
Workflow
工作流程
- Identify which ontology the user is working with (default: CMSO).
- Use to see the top-level concepts.
class_browser.py --list-roots - Drill into specific classes with to see hierarchy, children, and applicable properties.
class_browser.py --class <name> - Look up individual properties with .
property_lookup.py --property <name> - If the user mentions a concept but not its ontology name, use to find matching classes or properties.
--search - For a new or updated ontology, run to parse the raw OWL, then
owl_parser.pyto generate a summary JSON.ontology_summarizer.py
- 确定用户正在使用的本体(默认:CMSO)。
- 使用查看顶层概念。
class_browser.py --list-roots - 使用深入查看特定类,了解其层级、子类和适用属性。
class_browser.py --class <名称> - 使用查找单个属性。
property_lookup.py --property <名称> - 如果用户提到某个概念但未指明本体名称,使用查找匹配的类或属性。
--search - 对于新的或更新的本体,先运行解析原始OWL文件,再运行
owl_parser.py生成摘要JSON。ontology_summarizer.py
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. I'll run
a few targeted searches and property lookups (the answer below is synthesized
from several commands, per the Workflow section).
[Runs: class_browser.py --ontology cmso --search "crystal" --json]
→ Crystalline Material, Crystal Structure (among others)
[Runs: class_browser.py --ontology cmso --search "sample" --json]
→ Computational Sample, Atomic Scale Sample
[Runs: class_browser.py --ontology cmso --search "unit cell" --json]
→ Unit Cell
[Runs: class_browser.py --ontology cmso --search "space group" --json]
→ Space Group
[Runs: class_browser.py --ontology cmso --search "element" --json]
→ Chemical Element
[Runs: property_lookup.py --ontology cmso --property "has material" --json]
→ domain Computational Sample → range Material
[Runs: property_lookup.py --ontology cmso --property "has structure" --json]
→ domain Material → range Structure
[Runs: property_lookup.py --ontology cmso --property "has unit cell" --json]
→ domain Crystal Structure → range Unit Cell
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 relationship chain (from the property domains/ranges above):
Computational Sample → has material → Material → has structure → Structure
→ (Crystal Structure) → has unit cell → Unit Cell
Shall I look up the specific properties for any of these classes?用户:我做了一个FCC铜仿真,应该用哪些CMSO类来描述它?
Agent:让我探索CMSO本体找到相关类。我会运行几个针对性的搜索和属性查询(以下答案是根据工作流程部分的多个命令综合得出的)。
[执行:class_browser.py --ontology cmso --search "crystal" --json]
→ Crystalline Material, Crystal Structure(以及其他类)
[执行:class_browser.py --ontology cmso --search "sample" --json]
→ Computational Sample, Atomic Scale Sample
[执行:class_browser.py --ontology cmso --search "unit cell" --json]
→ Unit Cell
[执行:class_browser.py --ontology cmso --search "space group" --json]
→ Space Group
[执行:class_browser.py --ontology cmso --search "element" --json]
→ Chemical Element
[执行:property_lookup.py --ontology cmso --property "has material" --json]
→ 定义域 Computational Sample → 值域 Material
[执行:property_lookup.py --ontology cmso --property "has structure" --json]
→ 定义域 Material → 值域 Structure
[执行:property_lookup.py --ontology cmso --property "has unit cell" --json]
→ 定义域 Crystal Structure → 值域 Unit Cell
对于FCC铜仿真,相关的CMSO类包括:
- **Computational Sample** → **Atomic Scale Sample**:你的仿真是一个原子尺度样本
- **Material** → **Crystalline Material**:铜是晶体材料
- **Crystal Structure**:描述FCC排列
- **Unit Cell**:重复的FCC晶胞(a=b=c=3.615 Å,α=β=γ=90°)
- **Space Group**:FCC铜的空间群是225(Fm-3m)
- **Chemical Element**:Cu
关键关系链(来自上述属性的定义域/值域):
Computational Sample → has material → Material → has structure → Structure
→ (Crystal Structure) → has unit cell → Unit Cell
需要我查看这些类的具体属性吗?CLI Examples
CLI示例
bash
undefinedbash
undefinedList root classes in CMSO
列出CMSO中的根类
python3 skills/ontology/ontology-explorer/scripts/class_browser.py
--ontology cmso --list-roots --json
--ontology cmso --list-roots --json
python3 skills/ontology/ontology-explorer/scripts/class_browser.py
--ontology cmso --list-roots --json
--ontology cmso --list-roots --json
Inspect the Material class hierarchy
查看Material类的层级
python3 skills/ontology/ontology-explorer/scripts/class_browser.py
--ontology cmso --class Material --json
--ontology cmso --class Material --json
python3 skills/ontology/ontology-explorer/scripts/class_browser.py
--ontology cmso --class Material --json
--ontology cmso --class Material --json
Search for crystal-related classes
搜索与晶体相关的类
python3 skills/ontology/ontology-explorer/scripts/class_browser.py
--ontology cmso --search crystal --json
--ontology cmso --search crystal --json
python3 skills/ontology/ontology-explorer/scripts/class_browser.py
--ontology cmso --search crystal --json
--ontology cmso --search crystal --json
Find all properties for UnitCell
查找UnitCell的所有属性
python3 skills/ontology/ontology-explorer/scripts/property_lookup.py
--ontology cmso --class UnitCell --json
--ontology cmso --class UnitCell --json
python3 skills/ontology/ontology-explorer/scripts/property_lookup.py
--ontology cmso --class UnitCell --json
--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
--ontology cmso --property "has space group" --json
python3 skills/ontology/ontology-explorer/scripts/property_lookup.py
--ontology cmso --property "has space group" --json
--ontology cmso --property "has space group" --json
Parse a remote OWL file
解析远程OWL文件
python3 skills/ontology/ontology-explorer/scripts/owl_parser.py
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl --json
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl --json
python3 skills/ontology/ontology-explorer/scripts/owl_parser.py
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl --json
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl --json
Generate a summary JSON from an OWL file
从OWL文件生成摘要JSON
python3 skills/ontology/ontology-explorer/scripts/ontology_summarizer.py
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl
--output summary.json --json
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl
--output summary.json --json
undefinedpython3 skills/ontology/ontology-explorer/scripts/ontology_summarizer.py
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl
--output summary.json --json
--source https://raw.githubusercontent.com/OCDO/cmso/main/cmso.owl
--output summary.json --json
undefinedError Handling
错误处理
| Error | Cause | Resolution |
|---|---|---|
| Ontology name not registered | Check |
| Class label doesn't match any entry | Use |
| Property label doesn't match | Use |
| Invalid XML or unreachable URL | Check file path or URL; ensure the file is valid OWL/XML |
| Summary JSON hasn't been generated | Run |
| 错误 | 原因 | 解决方法 |
|---|---|---|
| 本体名称未注册 | 查看 |
| 类标签与任何条目不匹配 | 使用 |
| 属性标签不匹配 | 使用 |
| XML无效或URL无法访问 | 检查文件路径或URL;确保文件是有效的OWL/XML格式 |
| 摘要JSON未生成 | 先运行 |
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 and range
UnitCellmeans a unit cell has a basis.Basis - Data properties: show what literal values a class carries. A property with domain and range
ChemicalElementmeans an element has a string-valued attribute.xsd:string - Union domains: a property can apply to more than one class. When it does, the domain is shown as the classes joined with a pipe, e.g. . (The bundled CMSO/ASMO summaries currently contain no union-domain properties.)
A | B - Search relevance: 1.0 = label match, 0.5 = description match only.
- 类层级:根类是最宽泛的概念;叶类是最具体的。子类继承其所有父类的属性。
- 对象属性:展示类之间的关联(定义域 → 值域)。如果某个属性的定义域是、值域是
UnitCell,表示晶胞包含一个基元。Basis - 数据属性:展示类携带的字面量值。如果某个属性的定义域是、值域是
ChemicalElement,表示元素有一个字符串类型的属性。xsd:string - 联合定义域:一个属性可适用于多个类。此时定义域会显示为用竖线分隔的类,例如。(当前提供的CMSO/ASMO摘要中暂无联合定义域属性。)
A | B - 搜索相关性:1.0 = 标签匹配,0.5 = 仅描述匹配。
Verification checklist
验证清单
Before presenting any class, property, or relationship as fact, confirm and record:
- Resolved the target via (or
class_browser.py --class <name>) and recorded the exact canonicalproperty_lookup.pyreturned inlabel/results.class_info.label— do not quote a name the agent typed; quote the label the tool resolved (e.g.results.property_info.name→UnitCell).Unit Cell - For every relationship chain stated, cited the actual and
domainfrom arangecall (recordedproperty_lookup.py --property <name>andresults.property_info.domain), rather than inferring the link from class names..range - When a property's contains a pipe (
domain), reported it as a union (applies to each listed class) and confirmed the class in question matches one normalized member — did not silently assume single-class domain.A | B - For results, recorded each match's
--searchand stated whether it was a label match (1.0) or description-only match (0.5); did not present a 0.5 description hit as a confirmed term match.relevance - Identified the ontology by its registry key (or
cmso) and confirmed it exists inasmo; did not query an unregistered ontology or conflate CMSO and ASMO terms.references/ontology_registry.json - When relying on a generated/refreshed summary, recorded its and
metadata.source_urland themetadata.generated_at(statistics,num_classes,num_object_properties) so the result is traceable to a specific OWL source.num_data_properties - Treated absent parents, descriptions, or domain/range as missing data (not as "no such relationship"), since the parser extracts only simple and declared domains/ranges and does no reasoning.
rdfs:subClassOf
在将任何类、属性或关系作为事实呈现之前,请确认并记录:
- 通过(或
class_browser.py --class <名称>)找到目标,并记录property_lookup.py/results.class_info.label返回的准确标准results.property_info.name——不要引用Agent输入的名称;引用工具解析后的标签(例如label→UnitCell)。Unit Cell - 对于所有陈述的关系链,引用调用返回的实际
property_lookup.py --property <名称>和domain(记录range和results.property_info.domain),而非从类名称推断关联。.range - 当属性的包含竖线(
domain)时,将其报告为联合定义域(适用于每个列出的类),并确认相关类与其中一个规范化成员匹配——不要默认假设是单类定义域。A | B - 对于结果,记录每个匹配项的
--search,并说明是标签匹配(1.0)还是仅描述匹配(0.5);不要将0.5的描述匹配项作为已确认的术语匹配呈现。relevance - 通过其注册表键(或
cmso)识别本体,并确认其存在于asmo中;不要查询未注册的本体,也不要混淆CMSO和ASMO术语。references/ontology_registry.json - 当依赖生成/刷新的摘要时,记录其和
metadata.source_url以及metadata.generated_at(statistics,num_classes,num_object_properties),以便结果可追溯到特定的OWL源。num_data_properties - 将缺失的父类、描述或定义域/值域视为缺失数据(而非“不存在此类关系”),因为解析器仅提取简单的和已声明的定义域/值域,不进行推理。
rdfs:subClassOf
Common pitfalls & rationalizations
常见误区与合理化纠正
| Tempting shortcut | Why it's wrong / what to do |
|---|---|
"The class name | Labels carry spaces ( |
| "These two classes are obviously related, so I'll state the link." | Relationships exist only where an object property declares them. Verify with |
| "The script ran and printed results, so the answer is complete." | Run success ≠ completeness. A missing |
" | A match may be relevance 0.5 (description-only), not a label match. Check the |
| "A property has one domain class." | Domains can be unions (`A |
| "Any OCDO ontology will work / CMSO and ASMO are interchangeable." | Only |
"I'll point the parser at this | |
| 诱人的捷径 | 错误原因/正确做法 |
|---|---|
“类名 | 标签包含空格( |
| “这两个类显然相关,所以我可以陈述它们的关联。” | 仅当存在对象属性声明时,关系才存在。使用 |
| “脚本运行并输出了结果,所以答案是完整的。” | 运行成功≠内容完整。缺失的 |
“ | 匹配项的相关性可能为0.5(仅描述匹配),而非标签匹配。检查 |
| “属性只有一个定义域类。” | 定义域可以是联合的(`A |
| “任何OCDO本体都可以使用 / CMSO和ASMO可以互换。” | 仅 |
“我将解析器指向这个 | |
Security
安全
Input Validation
输入验证
- is validated against registered ontology names in
--ontology(fixed allowlist)ontology_registry.json - and
--classnames are validated against a safe-character pattern to prevent injection--property - terms are length-limited and used only for substring matching against pre-processed labels (never interpolated into queries or code)
--search - for
--sourceaccepts file paths or URLs; URLs are validated againstowl_parser.pyscheme onlyhttps://
- 会根据
--ontology中的已注册本体名称进行验证(固定允许列表)ontology_registry.json - 和
--class名称会根据安全字符模式验证,防止注入攻击--property - 术语有长度限制,仅用于对预处理标签进行子串匹配(绝不会插入到查询或代码中)
--search - 的
owl_parser.py接受文件路径或URL;URL仅允许--source协议https://
File Access
文件访问
- and
class_browser.pyread pre-processed JSON summary files from theproperty_lookup.pydirectory (read-only)references/ - reads a single OWL/XML file from a local path or HTTPS URL; remote fetches have a 30-second timeout
owl_parser.py - writes a single JSON summary file to the path specified by
ontology_summarizer.py--output - No scripts modify or delete existing files
- 和
class_browser.py从property_lookup.py目录读取预处理的JSON摘要文件(只读)references/ - 从本地路径或HTTPS URL读取单个OWL/XML文件;远程获取有30秒超时限制
owl_parser.py - 将单个JSON摘要文件写入
ontology_summarizer.py指定的路径--output - 所有脚本都不会修改或删除现有文件
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) with explicit argument lists; URL fetching is contained within the Python scripts with timeout limitsproperty_lookup.py
- 读取:用于检查脚本源文件、参考文件和本体摘要
- Bash:用于执行四个Python脚本(,
owl_parser.py,ontology_summarizer.py,class_browser.py),参数列表明确;URL获取被限制在Python脚本内,并设有超时限制property_lookup.py
Safety Measures
安全措施
- No ,
eval(), or dynamic code generationexec() - All subprocess calls use explicit argument lists (no )
shell=True - OWL/XML parsing uses Python's which does not resolve external entities by default, mitigating XXE attacks
xml.etree.ElementTree - 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
- 不使用、
eval()或动态代码生成exec() - 所有子进程调用使用明确的参数列表(不使用)
shell=True - OWL/XML解析使用Python的,默认不解析外部实体,可缓解XXE攻击
xml.etree.ElementTree - 远程URL获取仅允许HTTPS协议,并设置30秒超时限制,防止滥用
- 搜索结果有数量上限,防止输出泛滥
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 only (not complex OWL restrictions)
rdfs:subClassOf - Descriptions may be missing for classes that lack ,
rdfs:comment, or IAO annotationsskos:definition - URL fetching requires internet access and may time out (30-second limit)
- 仅支持OWL/XML格式(不支持Turtle、JSON-LD或N-Triples)
- 不支持OWL推理或推断(例如,不计算传递闭包)
- 类层级提取仅处理简单的(不处理复杂的OWL约束)
rdfs:subClassOf - 对于缺少、
rdfs:comment或IAO注释的类,其描述可能缺失skos:definition - URL获取需要互联网访问,且可能超时(30秒限制)
References
参考资料
- OWL/RDF Primer — brief introduction to OWL concepts
- CMSO Guide — narrative guide to the CMSO ontology
- Ontology Registry — registered ontologies and their metadata
- CMSO Summary — pre-processed CMSO structure
- CMSO Documentation — official CMSO docs
- CMSO Repository — source OWL file and development
Version History
版本历史
| Date | Version | Changes |
|---|---|---|
| 2026-06-24 | 1.2.2 | Added a Verification checklist (evidence-based, tied to canonical-label resolution, recorded domain/range, union domains, search relevance, registry keys, and summary provenance) and a Common pitfalls & rationalizations table. |
| 2026-06-23 | 1.2.0 | Fixed property_lookup |
| 2026-02-25 | 1.0 | Initial release with CMSO support |
| 日期 | 版本 | 变更 |
|---|---|---|
| 2026-06-24 | 1.2.2 | 添加了验证清单(基于证据,关联标准标签解析、记录的定义域/值域、联合定义域、搜索相关性、注册表键和摘要来源)以及常见误区与合理化纠正表格。 |
| 2026-06-23 | 1.2.0 | 修复了property_lookup的 |
| 2026-02-25 | 1.0 | 初始版本,支持CMSO |