Files
bxh/docs/kg-redesign/README.md

65 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# new2 知识图谱重构设计总览
本目录记录 `new2` 的知识图谱搭建层改造方案。目标不是重新做一个只服务贵阳 POI 的应用,而是把当前城市知识图谱跑通为一个可迁移的 KG 内核。
## 核心目标
1. 数据抽取阶段统一产出 `Entity / Event / Concept / Relation`
2. 高德 POI 作为高可信 `Place Anchor`,不是唯一知识结构。
3. 非结构化来源进入 `Evidence` 层,再抽取候选知识,不直接写死到图谱。
4. Schema 支持自动发现、候选提案、人工确认、版本化发布。
5. 空间能力前置设计H3 组织空间、PostGIS 做半径过滤、路径规划做真实可达距离。
6. 当前业务先聚焦城市知识图谱,后续迁移业务时主要替换 domain schema、提示词和数据源适配器。
## 参考依据
- AutoSchemaKG / ATLAS从文本抽取实体、事件、关系再做概念化和 schema induction。
- Paper: https://arxiv.org/abs/2505.23628
- Code: https://github.com/HKUST-KnowComp/AutoSchemaKG
- OpenSPG强调 schema、实体链接、概念标准化、实体归一化和多源知识构建。
- Code: https://github.com/OpenSPG/openspg
- PostGIS负责空间半径过滤、空间索引和几何/地理距离计算。
- ST_DWithin: https://postgis.net/docs/ST_DWithin.html
- H3负责分层网格索引、邻近召回和空间聚合。
- Docs: https://h3geo.org/docs/
## new2 的分层
```text
Source
-> Evidence
-> Candidate Entity / Event / Concept / Relation / Statement
-> Alignment & Fusion
-> Schema Proposal
-> Review & Publish
-> Graph Store + Spatial Store
```
## 与旧项目的区别
旧项目主要是:
```text
高德 POI -> Place
小红书/抖音 -> ExperienceTag
百科/网页 -> Event
```
new2 要改成:
```text
多源数据 -> Evidence -> 统一抽取 Entity/Event/Concept/Relation
-> 候选知识层 -> 审核发布 -> 正式图谱
```
这意味着旧的 `ExperienceTag` 后续应升级为 `Concept`,旧的 `HAS_TAG` 后续应升级为 `HAS_CONCEPT` 或保留为兼容关系。
## 当前已落地文件
- `app/schemas/kg_extraction_v1.schema.json`:统一抽取输出 Schema。
- `scripts/sql/001_kg_core_spatial_schema.sql`:通用 KG + 空间能力数据层迁移草案。
- `docs/kg-redesign/autoschema_kg_adaptation.md`AutoSchemaKG 思路如何落到本项目。
- `docs/kg-redesign/spatial_kg_design.md`:空间感知 KG 设计。
- `docs/reports/spatial_kg_recommendation_evidence.*`:汇报图和 HTML。
- `docs/reports/spatial_retrieval_benchmark_result.md`:旧项目 POI 可行性测试结果。