Skip to content

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EU-GraphRAG: European Legal Knowledge Graph with GraphRAG

License: MIT Python 3.11+ Neo4j 5.x

A experimental GraphRAG system for European Union regulations, German legal documents (SGB, BGB, etc.), and cross-border legal knowledge. Built on Neo4j with native support for ELI, ECLI, and EuroVoc ontologies.

🎯 Project Vision

Create the first open-source GraphRAG system for EU regulatory compliance that:

  • βœ… Natively integrates ELI (European Legislation Identifier) and ECLI (European Case Law Identifier)
  • βœ… Enables automated EU-to-national law transposition analysis
  • βœ… Provides temporal tracking of legal amendments
  • βœ… Supports multilingual legal search across 24 EU languages

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Python 3.11+
  • Neo4j AuraDB (free tier) or local Neo4j instance

Installation

# Clone repository
git clone https://github.com/sopra-steria-cassa/EU-GraphRAG.git
cd EU-GraphRAG

# Set up Python environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

# Start Neo4j database
docker-compose up -d

# Initialize graph schema
python scripts/init_database.py

# Ingest sample data (SGB I-III)
python scripts/ingest_sgb.py

Run Demo

# Start Streamlit UI
streamlit run src/ui/streamlit_app.py

# Or use REST API
uvicorn src.api.app:app --reload

Navigate to http://localhost:8501 for the UI or http://localhost:8000/docs for API documentation.

πŸ“Š Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Query    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  GraphRAG Query Engine               β”‚
    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
    β”‚  β”‚ Vector     β”‚ Graph Traversal  β”‚  β”‚
    β”‚  β”‚ Search     β”‚ (Cypher)         β”‚  β”‚
    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Neo4j Knowledge Graph          β”‚
    β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
    β”‚  β”‚ ELI      β”‚ ECLI         β”‚    β”‚
    β”‚  β”‚ Ontology β”‚ Metadata     β”‚    β”‚
    β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€    β”‚
    β”‚  β”‚ EuroVoc  β”‚ SGB Domain   β”‚    β”‚
    β”‚  β”‚ Concepts β”‚ Model        β”‚    β”‚
    β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Node Types

  • LegalDocument: EU directives, regulations, German laws
  • Article/Section: Individual provisions with ELI URIs
  • LegalConcept: EuroVoc thesaurus descriptors
  • TemporalVersion: Historical versions of legal texts
  • CourtDecision: Case law with ECLI identifiers

Key Relationships

  • IMPLEMENTS: EU Directive β†’ German Law
  • REFERENCES: Article β†’ Cited Article
  • SUPERSEDES: New Version β†’ Old Version
  • CONCERNS: Document β†’ Legal Concept (EuroVoc)

πŸ” Use Cases

1. Regulatory Compliance

Query: "What changed in SGB II Β§ 7 since January 2023?"

GraphRAG retrieves:

  • Amendment history via SUPERSEDES relationships
  • BGBl (Federal Law Gazette) references
  • Effective dates and consolidation status

2. EU Transposition Tracking

Query: "Which German laws implement the EU Data Act (2023/2854)?"

GraphRAG analyzes:

  • IMPLEMENTS relationships
  • Implementation gaps and deadlines
  • Cross-references to national legislation

3. Cross-Border Legal Research

Query: "How does SGB VI interact with EU Regulation 883/2004?"

GraphRAG provides:

  • Coordination rules between German pension law and EU social security regulation
  • Relevant articles in both legal frameworks
  • Conflict resolution mechanisms

πŸ“š Data Sources

EU Sources

  • EUR-Lex: Official EU legal database (SPARQL endpoint)
  • CELLAR: Publications Office repository
  • CJEU: Court of Justice case law

German Sources

  • Gesetze im Internet: ~5,000 federal laws
  • Bundesgesetzblatt: Official law gazette (BGBl I & II)
  • Federal Courts: Supreme court decisions (ECLI-compliant)

SGB-Specific

  • SGB I-XII: Complete social law books
  • BA/DRV regulations: Employment and pension insurance

πŸ› οΈ Technology Stack

Component Technology Purpose
Graph Database Neo4j 5.x Knowledge graph storage
Vector Search Neo4j Vector Index Semantic article retrieval
LLM OpenAI GPT-4 / Llama 3 Entity extraction, Q&A
Embeddings E5-multilingual Multilingual embeddings
API FastAPI REST service
UI Streamlit Demo interface
ETL Apache Airflow Data ingestion orchestration

πŸ“– Documentation

πŸ§ͺ Testing

# Run all tests
pytest

# Unit tests only
pytest tests/unit/

# Integration tests (requires Neo4j)
pytest tests/integration/

# Test coverage
pytest --cov=src --cov-report=html

Target: 100% test coverage for core modules.

πŸ—ΊοΈ Roadmap

Phase 1: Foundation βœ…

  • Project setup and repository
  • ELI ontology schema
  • Gesetze im Internet scraper
  • SGB I-III ingestion (500+ articles)
  • Basic Cypher queries

Phase 2: GraphRAG Core πŸ”„

  • LLM entity extraction pipeline
  • Hybrid retrieval (vector + graph)
  • Streamlit Q&A interface
  • 100% test coverage

Phase 3: EU Integration

  • EUR-Lex API integration
  • EuroVoc concept mapping
  • ECLI case law ingestion
  • Multilingual support (DE/EN/FR)

Phase 4: Production

  • FastAPI REST service with authentication
  • Performance optimization (100K+ nodes)
  • BA/DRV pilot deployment
  • EU funding secured (SIMPL, GovTech)

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

# Install development dependencies
pip install -r requirements-dev.txt

# Pre-commit hooks
pre-commit install

# Code formatting
black src/ tests/
isort src/ tests/

# Linting
flake8 src/ tests/
mypy src/

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

🏒 Project Team

Cassa (Law2Logic) - Sopra Steria Product for Regulatory Compliance

  • Product Owner: [Your Name]
  • Tech Lead: [Your Name]
  • Contributors: See CONTRIBUTORS.md

🌟 Acknowledgments

  • EU Publications Office: ELI and ECLI standards
  • EuroVoc Team: Multilingual thesaurus
  • Neo4j Community: Graph database support
  • Gesetze im Internet: German federal law portal

πŸ“« Contact

πŸ”— Links


⭐ Star this repository if you find it useful!

πŸ“’ Follow updates: Watch this repo for the latest developments in EU legal knowledge graphs.

About

GraphRAG system for EU regulations and German legal documents with ELI, ECLI, and EuroVoc ontologies

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages