← 返回 Skills 市场
fisa712

Knowledge Graph - Schema Migration Diff

作者 Muhammad Asif · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
41
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install schema-migration-diff
功能描述
Analyze differences between knowledge graph schema versions and generate migration plans and scripts for safe schema evolution.
使用说明 (SKILL.md)

Graph Schema Migration Diff

Detect schema differences and generate migration plans for graph evolution.

This skill compares two knowledge graph schema versions and generates safe migration strategies.

Quick Start

Use When

  • Upgrading graph schemas
  • Analyzing schema changes between versions
  • Planning schema evolution
  • Generating migration scripts
  • Migrating existing data
  • Refactoring graph models

Inputs

  • Schema Version 1 (RDF, OWL, or property graph)
  • Schema Version 2 (RDF, OWL, or property graph)
  • Migration scope (full or partial)

Outputs

  • Schema diff report
  • Change categories (added, removed, modified)
  • Migration plan
  • Migration scripts (Cypher, SPARQL, or Python)
  • Risk assessment

Example

Schema v1:

Student: student_id, name, email
Course: course_code, title
(Student)-[:ENROLLED_IN]->(Course)

Schema v2:

Student: student_id, full_name, email
Course: course_code, title, credits
Department: dept_id, name
(Student)-[:ENROLLED_IN]->(Course)
(Course)-[:BELONGS_TO]->(Department)

Diff Report:

ADDED:
  + Department label
  + Course.credits property
  + (Course)-[:BELONGS_TO]->(Department) relationship

MODIFIED:
  ~ Student.name → Student.full_name (rename)

REMOVED:
  (none)

Risk: Medium | Complexity: Medium

Change Detection

Entity Changes

  • Added entities (new node labels/classes)
  • Removed entities (deleted labels/classes)
  • Renamed entities

Property Changes

  • Added properties (new attributes)
  • Removed properties (deleted attributes)
  • Renamed properties (property name changes)
  • Type changes (property type modifications)

Relationship Changes

  • Added relationships (new relationship types)
  • Removed relationships (deleted relationship types)
  • Direction changes
  • Cardinality changes

Constraint Changes

  • Added constraints (new unique, required)
  • Removed constraints (deleted constraints)
  • Modified constraints

Execution Steps

  1. Parse Schemas – Load both schema versions
  2. Extract Structure – Build schema graphs
  3. Compare – Detect differences systematically
  4. Categorize Changes – Classify by type
  5. Assess Risk – Evaluate migration impact
  6. Generate Plan – Create migration strategy
  7. Generate Scripts – Output executable migrations

Output Formats

Migration Plan (Text)

Schema Migration: v1 → v2
========================

ENTITY CHANGES:
  + Department

PROPERTY CHANGES:
  Student.name → Student.full_name

RELATIONSHIP CHANGES:
  + (Course)-[:BELONGS_TO]->(Department)

Migration Steps: 3
Risk Level: Medium
Estimated Time: 30 minutes

Cypher Migration

-- 1. Add constraint for new entity
CREATE CONSTRAINT department_id_unique 
FOR (d:Department) REQUIRE d.department_id IS UNIQUE

-- 2. Rename property
MATCH (s:Student)
WHERE s.name IS NOT NULL
SET s.full_name = s.name
REMOVE s.name

-- 3. Add new relationship
CREATE (c:Course)-[:BELONGS_TO]->(d:Department)

Recommended Libraries

  • Graph Analysis: networkx, rdflib
  • Schema Comparison: deepdiff, dictdiffer
  • RDF/OWL: owlready2, pyshacl
  • Neo4j: neo4j, py2neo

Best Practices

✓ Test migrations on staging data first
✓ Create backups before migration
✓ Maintain backward compatibility
✓ Document all schema changes
✓ Version all schemas
✓ Review migration scripts carefully
✓ Perform migrations incrementally
✓ Validate data after migration

References

See migration-patterns.md for migration strategies and example-migrations.md for domain migration examples.


Version: 1.0.0

安全使用建议
Install is reasonable for schema migration planning. Before using any generated Cypher, SPARQL, or Python migration against production data, run it in staging, keep backups, validate copied fields before removing old ones, and prepare a rollback path.
能力评估
Purpose & Capability
The skill’s stated purpose is to compare graph schema versions and produce migration plans, examples, and scripts; the included Python script only models schema elements in memory and prints diff/risk reports.
Instruction Scope
The instructions are user-directed and migration-focused, with backup, staging, validation, rollback, and review guidance; some examples include destructive operations such as property removal and constraint rollback that require care.
Install Mechanism
The artifact consists of markdown documentation and one standalone Python utility with no declared dependencies, install hooks, package scripts, or automatic execution behavior.
Credentials
No network access, credential handling, broad filesystem reads, local indexing, or external service integration is present; database mutations appear only as example Cypher/SPARQL snippets for the user to apply deliberately.
Persistence & Privilege
There is no persistence mechanism, background worker, privilege escalation, shell execution, or session/profile access in the artifact.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install schema-migration-diff
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /schema-migration-diff 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of Graph Schema Migration Diff. - Detects differences between knowledge graph schema versions (RDF, OWL, or property graphs). - Generates comprehensive diff reports, migration plans, and risk assessments. - Outputs executable migration scripts (Cypher, SPARQL, or Python). - Supports entity, property, relationship, and constraint change detection.
元数据
Slug schema-migration-diff
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Knowledge Graph - Schema Migration Diff 是什么?

Analyze differences between knowledge graph schema versions and generate migration plans and scripts for safe schema evolution. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。

如何安装 Knowledge Graph - Schema Migration Diff?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install schema-migration-diff」即可一键安装,无需额外配置。

Knowledge Graph - Schema Migration Diff 是免费的吗?

是的,Knowledge Graph - Schema Migration Diff 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Knowledge Graph - Schema Migration Diff 支持哪些平台?

Knowledge Graph - Schema Migration Diff 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Knowledge Graph - Schema Migration Diff?

由 Muhammad Asif(@fisa712)开发并维护,当前版本 v1.0.0。

💬 留言讨论