Skip to content

Lexical Graph with Hierarchical Structure

Context

If the given documents have pre-defined structures, it is useful to persist them into the chunk structure. This pattern is an evolution of the Lexical Graph

Graph Pattern

Graph

Elements

Nodes

Document Node Document nodes contain the document name and its source. They may contain additional metadata. Chunk Node Chunk nodes contain the human readable text of a chunk and its vector embedding. They may contain additional metadata. Chapter Node Section Node Subsection Node Chapter, Section and Subsection nodes contain the name of the Chapter, Section and Subsection, respectively. They may contain additional metadata. These nodes are exemplary for possible hierarchies that can be present in documents.

Relationships

PART_OF Relationship The PART_OF relationships do not require additional properties. However, they may contain additional metadata.

HAS_CHAPTER Relationship HAS_SECTION Relationship HAS_SUBSECTION Relationship The HAS_CHAPTER, HAS_SECTION and HAS_SUBSECTION relationships do not require additional properties. However, they may contain additional metadata. These relationships are exemplary for possible hierarchies that can be present in documents.

Description

When chunking documents, record the hierarchies of the documents.

GraphRAG Pattern