{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/SemanticExplorerRepository.php",
"offset": 687,
"limit": 100
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/SemanticExplorerRepository.php",
"content": " public function getTaxonomyTerm(int $id): ?array\n {\n $stmt = $this->db->prepare('SELECT * FROM taxonomy_terms WHERE id = :id');\n $stmt->execute(['id' => $id]);\n $result = $stmt->fetch();\n\n return $result === false ? null : $result;\n }\n\n public function createTaxonomyTerm(string $name, ?int $parentId = null): int\n {\n \/\/ Calculate depth and path\n $depth = 0;\n $path = $name;\n\n if ($parentId !== null) {\n $parent = $this->getTaxonomyTerm($parentId);\n if ($parent !== null) {\n $depth = (int) $parent['depth'] + 1;\n $path = $parent['path'] . '\/' . $name;\n }\n }\n\n $stmt = $this->db->prepare(\n 'INSERT INTO taxonomy_terms (name, parent_id, depth, path, created_at)\n VALUES (:name, :parent, :depth, :path, NOW())'\n );\n $stmt->execute([\n 'name' => $name,\n 'parent' => $parentId,\n 'depth' => $depth,\n 'path' => $path,\n ]);\n\n return (int) $this->db->lastInsertId();\n }\n\n public function updateTaxonomyTerm(int $id, string $name, ?int $parentId = null): bool\n {\n \/\/ Calculate new depth and path\n $depth = 0;\n $path = $name;\n\n if ($parentId !== null) {\n $parent = $this->getTaxonomyTerm($parentId);\n if ($parent !== null) {\n $depth = (int) $parent['depth'] + 1;\n $path = $parent['path'] . '\/' . $name;\n }\n }\n\n $stmt = $this->db->prepare(\n 'UPDATE taxonomy_terms SET name = :name, parent_id = :parent, depth = :depth, path = :path WHERE id = :id'\n );\n\n return $stmt->execute([\n 'id' => $id,\n 'name' => $name,\n 'parent' => $parentId,\n 'depth' => $depth,\n 'path' => $path,\n ]);\n }\n\n public function deleteTaxonomyTerm(int $id): bool\n {\n \/\/ Check for children\n $stmt = $this->db->prepare('SELECT COUNT(*) FROM taxonomy_terms WHERE parent_id = :id');\n $stmt->execute(['id' => $id]);\n\n if ((int) $stmt->fetchColumn() > 0) {\n return false; \/\/ Has children, cannot delete\n }\n\n \/\/ Delete chunk associations\n $stmt = $this->db->prepare('DELETE FROM chunk_taxonomy WHERE taxonomy_term_id = :id');\n $stmt->execute(['id' => $id]);\n\n \/\/ Delete term\n $stmt = $this->db->prepare('DELETE FROM taxonomy_terms WHERE id = :id');\n\n return $stmt->execute(['id' => $id]);\n }\n\n public function getTaxonomyTermsForSelect(): array\n {\n return $this->db->query(\n 'SELECT id, name, depth, path FROM taxonomy_terms ORDER BY path, name'\n )->fetchAll();\n }\n\n \/\/ =========================================================================\n \/\/ ONTOLOGY - CRUD\n \/\/ =========================================================================\n\n public function getOntologyClass(int $id): ?array\n {\n $stmt = $this->db->prepare('SELECT * FROM ontology_classes WHERE id = :id');\n $stmt->execute(['id' => $id]);\n $result = $stmt->fetch();",
"numLines": 100,
"startLine": 687,
"totalLines": 918
}
}
}