Skip to content

Commit 398f16e

Browse files
author
Gemini CLI
committed
docs: record major project kg nl2sql progress
1 parent e580b7e commit 398f16e

1 file changed

Lines changed: 170 additions & 0 deletions

File tree

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Major Project KG + NL2Semantic2SQL Progress
2+
3+
Date: 2026-06-04
4+
Branch: `feat/v12-extensible-platform`
5+
6+
## Current Status
7+
8+
The synthetic major-project knowledge-graph route is implemented and pushed to
9+
GitHub. It uses synthetic data only: table structures, lifecycle stages, graph
10+
labels, relation types, semantic metadata, and benchmark questions are modeled
11+
after the major-project domain, but no production records are included.
12+
13+
The current integration supports this route:
14+
15+
1. Synthetic PostGIS tables in Huawei Cloud PostgreSQL/PostGIS.
16+
2. Synthetic graph data in local Neo4j Desktop database `zdxmdb`.
17+
3. NL2Semantic2SQL grounding with KG hints.
18+
4. Gemma/Ollama direct NL2SQL execution via `DirectNL2SemanticSQLAgent`.
19+
5. End-to-end smoke verification from benchmark questions.
20+
21+
## Local Environment Notes
22+
23+
The local `data_agent/.env` has been configured for this route and is ignored by
24+
git. It contains local Neo4j and NL2SQL runtime settings. Do not commit this
25+
file or copy its secrets into documentation.
26+
27+
Important runtime settings:
28+
29+
- `NL2SQL_AGENT_MODEL=gemma4-26b-host9`
30+
- `MAJOR_PROJECT_KG_BACKEND=neo4j`
31+
- `NEO4J_URI=neo4j://127.0.0.1:7687`
32+
- `NEO4J_DATABASE=zdxmdb`
33+
- `NL2SQL_DISABLE_FEWSHOT=1`
34+
35+
The global standard model tier remains `gemini-2.5-flash`; only the `@NL2SQL`
36+
mention path is routed through `NL2SQL_AGENT_MODEL`.
37+
38+
Windows note: C drive temporary space was full during testing. Use `D:\tmp` for
39+
pytest and smoke temp output:
40+
41+
```powershell
42+
$env:TEMP='D:\tmp'
43+
$env:TMP='D:\tmp'
44+
```
45+
46+
## Completed Implementation
47+
48+
Key commits:
49+
50+
- `4338729 fix: preserve actionable major project kg grounding`
51+
- `eacbaf7 feat: add optional neo4j major project kg backend`
52+
- `2804b08 fix: prioritize graph projection tables for major project kg smoke`
53+
- `25bb58b test: add major project kg nl2sql smoke runner`
54+
- `e580b7e fix: route nl2sql mention through configured direct model`
55+
56+
Important files:
57+
58+
- `scripts/synthetic_major_projects/generate_major_project_data.py`
59+
- `scripts/synthetic_major_projects/smoke_major_project_kg_nl2sql.py`
60+
- `data_agent/major_project_kg_resolver.py`
61+
- `data_agent/nl2sql_grounding.py`
62+
- `data_agent/agent.py`
63+
- `data_agent/nl2semantic2sql_direct_agent.py`
64+
- `data_agent/synthetic/major_projects/README.md`
65+
66+
## Verified Results
67+
68+
Neo4j import:
69+
70+
- Database: `zdxmdb`
71+
- Nodes: 2,422
72+
- Relationships: 4,039
73+
- Important relationship counts:
74+
- `OCCUPIES_PARCEL`: 200
75+
- `SPATIALLY_OVERLAPS`: 25
76+
- `FUZZY_PROJECT_PARCEL_MATCH`: 20
77+
78+
End-to-end smoke runner:
79+
80+
```powershell
81+
$env:TEMP='D:\tmp'
82+
$env:TMP='D:\tmp'
83+
.\.venv\Scripts\python.exe scripts\synthetic_major_projects\smoke_major_project_kg_nl2sql.py
84+
```
85+
86+
Result:
87+
88+
- `mp_bench_sql_type_001`: `ok`, 5 rows
89+
- `mp_bench_graph_missing_001`: `ok`, 28 rows, SQL uses `kg_edges`, `kg_nodes`, `MISSING_STAGE`
90+
- `mp_bench_hybrid_pre_no_conv_001`: `ok`, 0 rows
91+
- `mp_bench_hybrid_spatial_002`: `ok`, 10 rows, SQL uses `mp_spatial_overlap`
92+
- `mp_bench_farmland_001`: `ok`, 38 rows, SQL uses `mp_relation_confidence` and `mp_parcel`
93+
94+
Regression tests run:
95+
96+
- Major-project KG suite: `39 passed, 1 warning`
97+
- Nearby NL2SQL/semantic suite: `44 passed, 1 warning`
98+
- NL2SQL builder/direct path suite: `11 passed, 1 warning`
99+
- Focused builder suite after final edit: `3 passed, 1 warning`
100+
101+
Warnings:
102+
103+
- `ArcPyBridge` startup warning appears during some checks and is non-blocking
104+
for this NL2SQL/KG route.
105+
- Some old pytest temp directories show permission warnings in `git status`;
106+
they were not touched.
107+
108+
## How To Resume
109+
110+
1. Pull or checkout branch:
111+
112+
```powershell
113+
git checkout feat/v12-extensible-platform
114+
git pull origin feat/v12-extensible-platform
115+
```
116+
117+
2. Ensure Neo4j Desktop DBMS/database is running:
118+
119+
- Bolt URI: `neo4j://127.0.0.1:7687`
120+
- Database: `zdxmdb`
121+
122+
3. Ensure Ollama is reachable:
123+
124+
```powershell
125+
Invoke-RestMethod -Uri "http://192.168.43.9:11434/api/tags" -TimeoutSec 10
126+
```
127+
128+
4. Run smoke:
129+
130+
```powershell
131+
$env:TEMP='D:\tmp'
132+
$env:TMP='D:\tmp'
133+
.\.venv\Scripts\python.exe scripts\synthetic_major_projects\smoke_major_project_kg_nl2sql.py
134+
```
135+
136+
5. Test in GIS Data Agent with `@NL2SQL`:
137+
138+
```text
139+
@NL2SQL 找出知识图谱中缺少用地预审阶段的重大项目。
140+
@NL2SQL 列出与地块存在空间叠加关系的重大项目名称、叠加比例和叠加面积。
141+
@NL2SQL 列出占用耕地且关系置信度大于0.9的重大项目名称和地块面积。
142+
```
143+
144+
If the application server was already running before the `.env` or code changes,
145+
restart it before testing `@NL2SQL`.
146+
147+
## Remaining Follow-Ups
148+
149+
- Investigate whether `mp_bench_hybrid_pre_no_conv_001` returning 0 rows is an
150+
acceptable synthetic-data outcome or whether the generator should guarantee at
151+
least one such case.
152+
- Fix or bypass Ollama embedding `/api/embeddings` 404 before re-enabling
153+
few-shot retrieval and auto-curation.
154+
- Consider adding a small UI/admin health check that reports active KG backend,
155+
Neo4j database, selected NL2SQL model, and smoke status without exposing
156+
credentials.
157+
158+
## GitHub Push
159+
160+
The branch was pushed to GitHub:
161+
162+
```text
163+
origin/feat/v12-extensible-platform
164+
```
165+
166+
Latest pushed commit before this progress note:
167+
168+
```text
169+
e580b7e fix: route nl2sql mention through configured direct model
170+
```

0 commit comments

Comments
 (0)