Large language models (LLMs) can help translate legal norms into machine-readable ontologies, but their outputs require validation to ensure structural and semantic consistency. We present a modular pipeline that encodes natural-language norms as OWL class restrictions distinguishing compliant from non-compliant behavior, and iteratively validates generated ontologies using syntax checks, SHACL structural checks, competency-question tests, and ontology-pitfall analysis. We assess the pipeline across six LLM configurations using three exemplar rules from the UK Highway Code's Road Junctions section. The results show that the validation layers detect distinct errors, feedback can help correct structural issues, and competency questions can reveal semantic differences. These findings demonstrate the pipeline's feasibility, and the possibility for future development and broader quantitative evaluation.

Modeling legal ontologies with a validation based LLM pipeline

Enrico Francesconi;
2026

Abstract

Large language models (LLMs) can help translate legal norms into machine-readable ontologies, but their outputs require validation to ensure structural and semantic consistency. We present a modular pipeline that encodes natural-language norms as OWL class restrictions distinguishing compliant from non-compliant behavior, and iteratively validates generated ontologies using syntax checks, SHACL structural checks, competency-question tests, and ontology-pitfall analysis. We assess the pipeline across six LLM configurations using three exemplar rules from the UK Highway Code's Road Junctions section. The results show that the validation layers detect distinct errors, feedback can help correct structural issues, and competency questions can reveal semantic differences. These findings demonstrate the pipeline's feasibility, and the possibility for future development and broader quantitative evaluation.
2026
Istituto di Informatica Giuridica e Sistemi Giudiziari - IGSG
Ontology learning, Legal compliance checking, Large language models, Law as code
File in questo prodotto:
File Dimensione Formato  
frai-9-1931148.pdf

accesso aperto

Tipologia: Versione Editoriale (PDF)
Licenza: Creative commons
Dimensione 756.08 kB
Formato Adobe PDF
756.08 kB Adobe PDF Visualizza/Apri

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/20.500.14243/609261
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus ND
  • ???jsp.display-item.citation.isi??? ND
social impact