← 返回 Skills 市场
fisa712

Knowledge Graph - Graph Constraint Generator

作者 Muhammad Asif · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
39
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install graph-constraint-generator
功能描述
Generate structural, semantic, and property constraints for knowledge graph schemas including RDF/OWL ontologies and property graph models.
使用说明 (SKILL.md)

Knowledge Graph Constraint Generator

Generate constraints for knowledge graph schemas to enforce data integrity.

This skill automatically creates structural, semantic, and property constraints suitable for RDF/OWL ontologies and Neo4j property graphs.

Quick Start

Use When

  • Designing constraints for graph schemas
  • Enforcing graph integrity rules
  • Generating SHACL validation rules
  • Creating Neo4j database constraints
  • Defining property requirements
  • Establishing data governance

Inputs

  • Graph schema definitions
  • Entity models
  • Relationship types
  • Property specifications
  • Cardinality requirements
  • Integrity rules

Outputs

  • Unique constraints
  • Required property constraints
  • Relationship constraints
  • Cardinality rules
  • SHACL shapes
  • Cypher constraint statements

Example

Input Schema:

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

Generated Constraints:

Unique:
  Student.student_id UNIQUE
  Course.course_code UNIQUE

Required:
  Student.name (min 1)
  Course.title (min 1)

Relationships:
  (Student)-[:ENROLLED_IN]->(Course) [min 1]

Constraint Types

1. Unique Constraints

Ensure properties uniquely identify nodes

CREATE CONSTRAINT student_id_unique ON (s:Student) REQUIRE s.student_id IS UNIQUE

2. Required Property Constraints

Define mandatory properties

Student.name IS REQUIRED
Course.title IS REQUIRED

3. Relationship Constraints

Define allowed graph connections

(Student)-[:ENROLLED_IN]->(Course)
(Professor)-[:TEACHES]->(Course)

4. Cardinality Constraints

Define relationship occurrence limits

Student → ENROLLED_IN → Course (minimum: 1)
Professor → TEACHES → Course (maximum: 10)

5. Domain/Range Constraints (RDF/OWL)

Define semantic relationship constraints

:writes rdfs:domain :Researcher ;
        rdfs:range :Paper .

6. Data Type Constraints

Ensure property values match types

student_id: String
credits: Integer
gpa: Float

Execution Steps

  1. Analyze Schema – Extract entities, relationships, properties
  2. Identify Keys – Find unique identifiers
  3. Determine Required – Identify mandatory properties
  4. Analyze Relationships – Extract connection patterns
  5. Calculate Cardinality – Determine relationship bounds
  6. Generate Constraints – Create constraint definitions
  7. Format Output – Output as SHACL, Cypher, or RDF

Output Formats

Neo4j Cypher

CREATE CONSTRAINT student_id_unique ON (s:Student) REQUIRE s.student_id IS UNIQUE
CREATE INDEX ON (s:Student)(name)

SHACL Shapes

:StudentShape a sh:NodeShape ;
  sh:targetClass :Student ;
  sh:property [
    sh:path :student_id ;
    sh:minCount 1 ;
    sh:maxCount 1
  ] .

RDF/OWL

:writes rdfs:domain :Researcher ;
        rdfs:range :Paper ;
        rdf:type owl:ObjectProperty .

Recommended Libraries

  • RDF/OWL: rdflib, pyshacl, owlready2
  • Property Graph: neo4j, py2neo, networkx
  • Data Validation: pydantic, jsonschema

Best Practices

✓ Define unique identifiers early
✓ Avoid overly restrictive constraints
✓ Keep domain/range rules clear
✓ Validate data frequently
✓ Combine database and semantic constraints
✓ Document constraint reasoning
✓ Test constraints before production

References

See constraint-patterns.md for constraint design patterns and example-constraints.md for domain constraint examples.


Version: 1.0.0

安全使用建议
This looks safe to install for generating graph schema constraints. Review generated Cypher or SHACL before applying it to a real database, because constraint and index statements can change database schema or affect existing data validation.
能力评估
Purpose & Capability
The stated purpose is to generate Neo4j, SHACL, RDF/OWL, and related graph constraint examples; the documentation and Python helper match that purpose. Generated database DDL could affect a graph database if a user chooses to run it, but the skill itself only generates or displays those statements.
Instruction Scope
Runtime instructions are scoped to schema analysis and constraint generation. I found no prompt-injection text, role overrides, hidden directives, or instructions to access unrelated data.
Install Mechanism
The package contains markdown documentation and one Python script, with no declared dependencies, install hooks, package-manager commands, or startup behavior.
Credentials
The Python script uses only standard library dataclasses, enums, and typing, keeps data in memory, and prints output. Static review found no file writes, subprocess execution, network calls, credential access, or local profile/session use.
Persistence & Privilege
There is no persistence mechanism beyond normal skill files, no background worker, no privilege escalation, and no automatic mutation of user systems.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install graph-constraint-generator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /graph-constraint-generator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of Knowledge Graph Constraint Generator. - Generates structural, semantic, and property constraints for knowledge graph schemas (RDF/OWL and Neo4j property graphs). - Supports output as SHACL shapes, Cypher constraint statements, and RDF/OWL triples. - Provides quick start guide, example usage, and best practices for constraint definition. - Useful for enforcing data integrity and governance in knowledge graph modeling.
元数据
Slug graph-constraint-generator
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Knowledge Graph - Graph Constraint Generator 是什么?

Generate structural, semantic, and property constraints for knowledge graph schemas including RDF/OWL ontologies and property graph models. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 39 次。

如何安装 Knowledge Graph - Graph Constraint Generator?

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

Knowledge Graph - Graph Constraint Generator 是免费的吗?

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

Knowledge Graph - Graph Constraint Generator 支持哪些平台?

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

谁开发了 Knowledge Graph - Graph Constraint Generator?

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

💬 留言讨论