Spaces:
Sleeping
Sleeping
| // Bug Triage Knowledge Graph Schema | |
| // Nodes: Bug, Developer, Component, Team, Resolution | |
| // Create Constraints | |
| CREATE CONSTRAINT bug_id IF NOT EXISTS FOR (b:Bug) REQUIRE b.id IS UNIQUE; | |
| CREATE CONSTRAINT dev_id IF NOT EXISTS FOR (d:Developer) REQUIRE d.id IS UNIQUE; | |
| CREATE CONSTRAINT component_id IF NOT EXISTS FOR (c:Component) REQUIRE c.name IS UNIQUE; | |
| CREATE CONSTRAINT team_id IF NOT EXISTS FOR (t:Team) REQUIRE t.name IS UNIQUE; | |
| // Create Indexes | |
| CREATE INDEX bug_priority IF NOT EXISTS FOR (b:Bug) ON (b.priority); | |
| CREATE INDEX bug_status IF NOT EXISTS FOR (b:Bug) ON (b.status); | |
| CREATE INDEX bug_category IF NOT EXISTS FOR (b:Bug) ON (b.category); | |
| CREATE INDEX dev_expertise IF NOT EXISTS FOR (d:Developer) ON (d.expertise); | |
| // Sample Node Creation | |
| CREATE (b:Bug { | |
| id: 'BUG-001', | |
| title: 'Sample Bug', | |
| description: 'This is a sample bug for testing', | |
| priority: 'P2', | |
| severity: 'Medium', | |
| category: 'UI', | |
| status: 'Open', | |
| created_at: datetime(), | |
| reporter: 'user@example.com' | |
| }); | |
| CREATE (d:Developer { | |
| id: 'DEV-001', | |
| name: 'John Doe', | |
| email: 'john@example.com', | |
| expertise: ['Python', 'FastAPI', 'React'], | |
| current_workload: 3, | |
| max_capacity: 5 | |
| }); | |
| CREATE (c:Component { | |
| name: 'Authentication', | |
| description: 'User authentication module', | |
| language: 'Python', | |
| repository: 'backend' | |
| }); | |
| CREATE (t:Team { | |
| name: 'Backend Team', | |
| description: 'Handles backend services', | |
| size: 5 | |
| }); | |
| // Sample Relationships | |
| MATCH (d:Developer {id: 'DEV-001'}), (t:Team {name: 'Backend Team'}) | |
| CREATE (d)-[:BELONGS_TO]->(t); | |
| MATCH (d:Developer {id: 'DEV-001'}), (c:Component {name: 'Authentication'}) | |
| CREATE (d)-[:EXPERT_IN {proficiency: 0.9}]->(c); | |