docling-studio/document-parser/infra/neo4j
Pier-Jean Malandrino 157a779e20 fix(graph): collapse Docling InlineGroup and Picture children (#197)
Two patterns in Docling's serialization were mirrored 1:1 by the graph
projection and produced node explosions on real documents:

- An InlineGroup (paragraph of mixed style runs) emits one `groups[]`
  entry plus N `texts[]` runs. Naive iteration created one Paragraph
  node per run.
- A Picture's `children` carry internal text labels extracted by the
  layout model (flowchart boxes, chart axis labels, diagram callouts).
  Each child became its own Paragraph node, drowning the figure.

`build_collapse_index` (in the shared `infra.docling_tree` helper) now
returns the `skip_refs` set + `inline_meta` overrides for both cases.
The Neo4j `tree_writer` and the in-memory `docling_graph` consume the
same index, so both projections stay in sync.

InlineGroups are projected as a single :Paragraph carrying the
concatenated text and the union of children's provs (re-indexed).
Pictures keep their :Figure node and prov; their descendants are
dropped. Captions live in the picture's separate `captions` field, not
in `children`, so they are unaffected.
2026-04-29 14:00:00 +02:00
..
__init__.py feat(neo4j): Day 3 — ChunkWriter, graph API, GraphView, README 2026-04-29 14:00:00 +02:00
chunk_writer.py chore(lint): fix ruff violations on Neo4j files 2026-04-29 14:00:00 +02:00
driver.py feat(neo4j): Day 1 — compose service, driver, schema bootstrap 2026-04-29 14:00:00 +02:00
queries.py feat(reasoning): reasoning-trace viewer v1 with SQLite-backed graph 2026-04-29 14:00:00 +02:00
schema.py feat(reasoning): reasoning-trace viewer v1 with SQLite-backed graph 2026-04-29 14:00:00 +02:00
tree_reader.py chore(lint): fix ruff violations on Neo4j files 2026-04-29 14:00:00 +02:00
tree_writer.py fix(graph): collapse Docling InlineGroup and Picture children (#197) 2026-04-29 14:00:00 +02:00