Token导航 LogoToken导航TokenDH.com
运维和基础设施只读github未标认证来源可访问许可证需确认审计通过

ontology-semantic-modeler本体语义建模器

Agent Skill

ontology-semantic-modeler 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

724

周安装

29

GitHub Stars

1

下载量

234
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ontology-semantic-modeler(本体语义建模器)
来源仓库:https://github.com/sfc-gh-tjia/coco_skill_ontology
仓库路径:skills/ontology-semantic-modeler
安装命令:
npx skills add https://github.com/sfc-gh-tjia/coco_skill_ontology --skill ontology-semantic-modeler
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/sfc-gh-tjia/coco_skill_ontology --skill ontology-semantic-modeler

简介

本体语义建模器用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前需确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 建议结合原始 README 和仓库内容核验具体用法和功能边界。

SKILL.md

Ontology Semantic Modeler

Generate Cortex Analyst semantic models that bridge OWL ontologies with Snowflake data tables.

When to Use

  • You have an OWL/RDF ontology file defining a domain (classes, subClassOf, properties)
  • You have Snowflake tables containing domain data (or an existing semantic model YAML describing them)
  • You want Cortex Analyst to understand ontological relationships (hierarchy traversal, cohort expansion, entity unification)

Workflow Overview

This skill follows a 6-step sequential workflow. Confirm each step's output before proceeding.

Step 1: Gather Inputs

Collect from the user:

  1. OWL file path - Local .owl, .rdf, or .ttl file
  2. Target Snowflake location - DATABASE.SCHEMA where objects will be created
  3. Data source - One or both of:

- Snowflake table names (will introspect columns via DESCRIBE TABLE) - Existing semantic model YAML file path

  1. Ontology name - Short identifier (e.g., BIOMED, GENE, PHARMA)

Store these in variables for later steps. If the user provides only some inputs, ask for the rest.

Step 2: Parse OWL Ontology

Run the OWL parser script to extract ontology structure:

uv run --script scripts/parse_owl.py \
  --owl-file "<owl_path>" \
  --output-dir "/tmp/ontology_parsed"

This produces JSON files in /tmp/ontology_parsed/:

  • classes.json - All OWL classes with hierarchy (class name, parent, description, is_abstract)
  • relations.json - Object properties with domain/range, transitivity, inverse
  • individuals.json - Named individuals if present

Review the output with the user. Show class count, relationship types, hierarchy depth. Ask if any classes should be excluded or if mappings need adjustment.

Step 3: Map Ontology to Physical Tables

For each OWL class, determine which Snowflake table contains its instances:

  1. If tables were provided, run DESCRIBE TABLE on each to get column metadata
  2. If a semantic model YAML was provided, read it to extract table/column info
  3. Use the mapping logic:

- Match OWL class names to table names (fuzzy match on name similarity) - For each matched class, identify: ID column, name column, description column - For unmatched abstract classes, mark as IS_ABSTRACT = TRUE (no physical table)

Present the proposed mapping table to the user:

OWL ClassPhysical TableID ColumnName ColumnFilter

Ask the user to confirm or adjust mappings.

For relationships, map OWL object properties to edge sources:

  • subClassOf typically maps to a knowledge graph edge table
  • Domain-specific relations map to join tables or foreign keys

Step 4: Generate SQL Artifacts

Save the confirmed mappings to a JSON file (use assets/mappings_template.json as the starting structure), then run the generator:

uv run --script scripts/generate_artifacts.py \
  --classes-json "/tmp/ontology_parsed/classes.json" \
  --relations-json "/tmp/ontology_parsed/relations.json" \
  --mappings-json "<mappings_json_path>" \
  --database "<DATABASE>" \
  --schema "<SCHEMA>" \
  --ontology-name "<ONTOLOGY_NAME>" \
  --output-dir "/tmp/generated"

This produces three files. Alternatively, generate them manually using the confirmed mappings:

4a. Metadata Tables SQL (01_metadata_tables.sql)

Generate CREATE TABLE + INSERT statements for:

  • ONT_CLASS - Class hierarchy from OWL
  • ONT_RELATION_DEF - Relationship definitions from OWL properties
  • ONT_CLASS_MAPPING - Class-to-table mappings from Step 3
  • ONT_RELATION_MAPPING - Relationship-to-table mappings from Step 3

Use the template at references/metadata_tables_template.sql as the pattern.

4b. Abstract Views SQL (02_abstract_views.sql)

For each hierarchical relationship (IS_HIERARCHICAL=TRUE), generate:

  • A resolved relationship view (e.g., VW_ONT_SUBCLASS_OF)
  • Descendant/ancestor helper views

For each abstract class with concrete subclasses, generate:

  • A UNION ALL view unifying all concrete instances (e.g., VW_ONT_{CLASS_NAME})

For statistical summaries:

  • Hierarchy stats view (direct children/parent counts)
  • Coverage views (which data entities have ontology mappings)

Use the template at references/abstract_views_template.sql as the pattern.

4c. Semantic Model YAML (03_ontology_semantic_model.yaml)

Generate a Cortex Analyst semantic model YAML containing:

  • One table entry per abstract view created in 4b
  • Dimensions for all columns in each view
  • Verified queries for common ontology patterns:

- "What are the direct children of X?" (direct subclass lookup) - "What are all descendants of X?" (recursive CTE) - "What types of X exist?" (entity type listing) - "How many entities of each type?" (hierarchy stats)

Use the template at references/semantic_model_template.yaml as the pattern.

Present all generated SQL and YAML to the user for review before execution.

Step 5: Deploy to Snowflake

After user approval, execute the SQL in order:

# 1. Create metadata tables
snowflake_sql_execute(sql=metadata_sql)

# 2. Create abstract views
snowflake_sql_execute(sql=views_sql)

# 3. Create semantic view
create_semantic_view_sql = f"""
CREATE OR REPLACE SEMANTIC VIEW {database}.{schema}.{ontology_name}_ONTOLOGY_SEMANTIC_VIEW
  AS SEMANTIC MODEL '{yaml_content}'
"""
snowflake_sql_execute(sql=create_semantic_view_sql)

Run verification queries to confirm row counts and data integrity.

Step 6: Visualize (Optional)

If the user wants visualization, launch the Streamlit app:

uv run --script scripts/visualize_ontology.py -- \
  --classes-json "/tmp/ontology_parsed/classes.json" \
  --relations-json "/tmp/ontology_parsed/relations.json" \
  --semantic-model "<path_to_generated_yaml>" \
  --port 8501

This shows:

  • Interactive ontology class hierarchy (tree view)
  • Relationship graph (nodes = classes, edges = properties)
  • Generated semantic model summary (tables, dimensions, verified queries)
  • Coverage matrix (which OWL classes mapped to which tables)

Degrees of Freedom

The user can customize:

  • Which OWL classes to include - Filter by namespace, depth, or explicit list
  • Table mapping strategy - Auto-detect vs. manual specification
  • View naming convention - Default VW_ONT_ prefix, customizable
  • Verified query patterns - Add domain-specific query templates
  • Hierarchy depth limit - Default 10 levels for recursive CTEs
  • Semantic model name - Default {ONTOLOGY_NAME}_ONTOLOGY_SEMANTIC_VIEW

Error Handling

  • OWL parse failure: Check file format (OWL/XML, Turtle, RDF/XML). The parser supports all three.
  • No table matches: Ask user to provide explicit mappings. Not all OWL classes need physical tables.
  • SQL execution errors: Check permissions (CREATE TABLE, CREATE VIEW on target schema). Show exact error and suggest grants.
  • Empty views: Verify filter conditions in ONT_CLASS_MAPPING match actual data values.

Reference Files

  • references/metadata_tables_template.sql - Template for ONT_CLASS, ONT_RELATION_DEF, ONT_CLASS_MAPPING, ONT_RELATION_MAPPING
  • references/abstract_views_template.sql - Template for hierarchy views, entity union views, stats views
  • references/semantic_model_template.yaml - Template for Cortex Analyst semantic model YAML
  • references/example_biomed_output/ - Complete example from the BIOMED approach 2 solution

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.06%
按下载量换算89

Claude

29.81%
按下载量换算70

Cursor

20.41%
按下载量换算48

Gemini CLI

8.46%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills