How We Transformed Greek Volatile Legal PDFs into an Actionable Legal Brain
In highly regulated fields like tax advisory and corporate law, accuracy is non-negotiable. Greek tax law changes constantly, with a steady stream of new statutes, presidential decrees, and administrative circulars (such as ΠΟΛ).

The Challenge of Accuracy
In highly regulated fields like tax advisory and corporate law, accuracy is non-negotiable. Greek tax law changes constantly, with a steady stream of new statutes, presidential decrees, and administrative circulars (such as ΠΟΛ).
Why Standard RAG Fails
Standard AI models and typical Retrieval-Augmented Generation (RAG) systems fail because they search based on semantic similarity. They cannot determine if a specific tax exemption was modified last month, suspended, or repealed entirely.
The Deterministic Graph
To solve this, we designed an ingestion pipeline that digitizes raw legal documents (FEK gazettes) and structures them into a temporal Knowledge Graph in Neo4j, combining strict schema validation with graph-based lookups.
Our Technical Approach is Divided into Five Phases:
Preflight & Layout Detection
Before any text is sent to an LLM, the pipeline performs a structural preflight analysis. It identifies the overall layout, extracts metadata (such as publication dates and law numbers), and establishes a "stop line" to prevent the parser from processing non-legal appendix material.
Context-Aware Segmentation
Large documents are sliced into segments of roughly 420 lines. To prevent articles from being cut in half, the system analyzes boundaries and splits text only at logical paragraph or list boundaries.
Sliding Context Window
For every segment processed, we inject the active parent hierarchy (e.g., Book I -> Part A -> Chapter II) into the prompt. This prevents the LLM from losing its structural orientation during long ingestion runs.
Strict Schema & Extraction Constraints
To prevent model hallucination, the extracted text is forced through strict Pydantic schemas. Structural Parsing: The system maps the law down to atomic units: Law, Article, and Paragraph. Relationship Extraction: The LLM extracts references, text amendments, and temporal overrides, with short summaries.
Data Normalization & Reconciliation
The raw outputs of LLMs are too inconsistent for direct database injection. The pipeline runs a post-processing normalization pass: Alphanumeric Standardization (e.g. converting Greek/Roman numerals to Arabic) and Dynamic Acronym Lookup (e.g. resolving "ΚΦΕ" using a chronological registry of codes).
Temporal Graph Architecture
To represent how laws change over time, the graph architecture separates abstract concepts from concrete text:
Logical vs. Versioned Nodes: The graph maintains a permanent "Logical Node" for a provision (e.g., Article 12). The actual text of the article at a given point in time is stored in a separate "Version Node."
Timeline Stitching: Version nodes are linked chronologically using NEXT_VERSION edges. A vertical navigation layer (BELONGS_TO_VERSION) connects paragraph versions directly to parent articles using date-range matching.
Ghost Node Population: References to external laws that have not yet been ingested are modeled as "Ghost Nodes." These act as logical anchors and are promoted to active nodes when imported later.
Validated Graph Node Schema
{
"eli_uri": "/eli/gr/law/2016/4412",
"document_type": "law",
"structure": {
"node_type": "logical",
"article": "Article 12",
"timeline": {
"active_version": "v3",
"history": ["v1", "v2", "v3"]
}
},
"temporal": {
"valid_from": "2024-01-01",
"valid_to": null,
"status": "active"
}
}Queued Amendments & Human-in-the-Loop Review
Pending Queue
Instead of automatically altering the database upon import, text amendments and temporal suspensions are queued.
Local Review Interface
A local review interface surfaces these pending changes directly from Neo4j, allowing human-in-the-loop validation.
Deterministic Diff Proposal
The system uses reasoning models to generate deterministic text-replacement proposals, showing side-by-side diffs. Once approved, changes are committed to the graph.
Clear, Auditable Structures.
By combining LLMs with a deterministic graph database, we created an environment where answers are backed by clear, auditable structures. We learned that structuring and validating data before it enters the graph is much more valuable than attempting to resolve messy data during retrieval.
The Operational Impact:
Previously, keeping track of how a single amendment changed a tax law required legal teams to spend thousands of manual hours stitching together past and present legislation just to figure out what the law currently says.
Through this graph, the LLMs are now able to write a fully codified version of the laws automatically, with temporally aware time changes mapped for every single article. What used to be a massive, labor-intensive operational bottleneck is now a dynamic, instantly updated digital brain.
Didn’t find the exact solution your business needs?
We will design a custom pipeline that fits your current setup perfectly.