JLaw-CiteGraph 🇯🇵⚖️
An open, deterministic citation graph and search index for Japanese statutory law.
Every Japanese law in force is parsed from official e-Gov XML down
to article (条), paragraph (項) and item (号), and citations in the text are resolved to the provision
they point at: 92.9% of same-law and 82.2% of cross-law citations, with the unresolved ones listed.
The result ships as data files, a single-file explorer, a jlawcite command-line tool
that looks up and searches provisions without embeddings, and an MCP server for LLMs.
explorer.html: pick a law and see what it cites (green) and what cites it (yellow).
At a glance (v2.0, e-Gov snapshot 2026-09-27)
| Laws | 8,998, each at the version in force on 2026-09-29, plus 1,649 upcoming amendments (施行日 + amending law) |
| Graph | 1.89M nodes (条・項・号・附則・別表) · 1.42M citation edges · 67,666 delegation edges (政令で定める) · 37,377 別表/様式 references |
| Law → law network | 70,577 distinct pairs · 453,390 distinct article-level links between laws |
| Citation resolution | same-law 92.9% · cross-law 82.2% · relative refs (前条/同項/…) 92.2% |
| Precision | ≈98% on hand-checked samples of the rules covering 86% of edges (preliminary, see below) |
| Search | jlawcite get 民法第七百九条 · BM25 search · on 1,170 real tax questions the citation graph lifts Recall@10 from 0.24 to 0.46 |
| Method | 100% deterministic (rules + dictionaries + document context), no LLM, reproducible from the public e-Gov bulk download |
| Updates | Rebuilt monthly from e-Gov; each snapshot is tagged on Hugging Face (jlawcite download --list, --snapshot YYYY-MM-DD to pin one) |
What's new in v2
| v1.0 (2026-06) | v2.0 (2026-09) | |
|---|---|---|
| Unit | law → law (article strings) | article / paragraph / item nodes, incl. 附則 and attachments |
| Edges | cross-law citations | + same-law citations, 前条/同項/前号, delegation, 別表 references |
| Distinct article-level cross-law links | 173,844 | 453,390 |
| Law → law pairs | 55,651 | 70,577 |
| Versions | latest file per law | version in force on a date + upcoming amendments |
| Search | – | jlawcite CLI (lookup, BM25, graph walk) + retrieval benchmark |
| Precision | 0 errors / 400 (LLM-proposed labels) | per-rule samples with confidence intervals; 5 error classes found and fixed |
v1 wrote one line per citation mention, so its 1.21M lines hold 173,844 distinct links; v2 counts each (source, target) link once. Full list in CHANGELOG.md.
Who is this for?
| You are… | You use it to… |
|---|---|
| a legal-NLP researcher | add citation neighbours to statute retrieval / RAG (the benchmark below shows the gain), or reuse the deterministic resolver on your own corpus |
| a legal-tech developer | answer "what cites X?" (amending 個人情報保護法 touches 111 laws) and "what changes when?" (pending_versions.csv) |
| a network / comparative-law researcher | study hubs (地方自治法 is cited by 1,250 laws), delegation chains and dependency clusters |
| building an LLM legal assistant | ground citations deterministically via the MCP server: 会社法第737条 → the exact article text |
Quick start
pip install jlawcite # CLI + library from PyPI
jlawcite download # prebuilt search DB (~680 MB, latest monthly snapshot)
jlawcite get 民法第七百九条
# or, to rebuild the graph:
git clone https://github.com/yabooung/jp-law-citation-graph && cd jp-law-citation-graph
pip install -e . # Python 3.11+
jlawcite fetch # e-Gov bulk XML (~320 MB) → data/raw/law_xml
jlawcite build --input data/raw/law_xml \
--csv data/raw/law_xml/all_law_list.csv --output data/parsed # ~5 min, deterministic
jlawcite validate --data data/parsed # 11 integrity checks
jlawcite index # search index (~1.5 min, 2.6 GB)
jlawcite get 民法第七百九条 # also: 労働基準法20条1項, 激甚法第三条, node ids
jlawcite search 解雇 予告 # BM25; --nl for a question sentence
jlawcite refs 労働基準法第二十条 # what it cites / what cites it
jlawcite pending --until 20261231 # amendments coming into force
$ jlawcite get 民法第七百九条
民法 [129AC0000000089, act, 明治二十九年法律第八十九号] 現行 2026-06-24 施行中, 次回改正 2027-06-23
[129AC0000000089_a709] Article
第七百九条
故意又は過失によって他人の権利又は法律上保護される利益を侵害した者は、これによって生じた損害を賠償する責任を負う。
改正予定:
2027-06-23 民法 ← 民法等の一部を改正する法律 令和八年法律第四十五号 (公布の日から起算して一年を超えない範囲内において政令で定める日)
…
Every command takes --json. The same functions are available in Python (jlawcite.search.SearchDB).
What's inside (/data)
| File | Content |
|---|---|
laws.csv |
law_id, name, type, url (v1) + enforcement_date, next_enforcement_date, pending_versions |
cites_law_to_law.csv |
aggregated src_law → tgt_law counts (v1 columns) |
cites_edges.jsonl.gz |
every resolved citation of a named law: v1 fields (src_article, tgt_article, via, confidence) + src_node, tgt_node, fallback_level |
cites_all_edges.jsonl.gz |
every edge of the graph: CITES (incl. same-law and 前条/同項), DELEGATES_TO, REFERS_TO_ATTACHMENT, AMENDS, each with extracted_from |
pending_versions.csv |
upcoming amendments: 施行日, 施行日備考, amending law, e-Gov URL |
release_stats.json |
the counts quoted here |
The full node file (1.89M nodes, article and paragraph text included) is attached to the GitHub release, or you can rebuild it with the Quick start commands.
import pandas as pd
edges = pd.read_csv("data/cites_law_to_law.csv")
hubs = edges.groupby("tgt_law")["src_law_id"].nunique().sort_values(ascending=False).head(10)
Use it from an LLM: MCP server (mcp/)
resolve_citation, what_cites, what_law_cites, citation_path, get_law, and in v2
get_provision (citation → text), search_statutes and pending_amendments.
See mcp/README.md.
Retrieval benchmark
Each of 1,170 National Tax Agency Q&A cases (質疑応答事例) is a real tax question whose answer cites
specific articles. The question is the query, and hits are counted at the article level
(jlawcite eval).
| method | R@1 | R@5 | R@10 | R@20 | R@50 | MRR@50 | s/query |
|---|---|---|---|---|---|---|---|
| BM25 (character-trigram OR) | 0.086 | 0.192 | 0.244 | 0.326 | 0.437 | 0.140 | 0.11 |
| BM25 + 1-hop citation graph | 0.256 | 0.403 | 0.459 | 0.500 | 0.550 | 0.325 | 0.11 |
1,170 queries · e-Gov snapshot 2026-09-27 · eval/v2/nta_retrieval_results.json
The one-hop expansion adds the articles that the top hits cite. A retrieved 施行令 paragraph pulls up the parent-act article it implements. Both rows use no embeddings; they are a baseline for dense or hybrid retrievers.
Quality, honestly
- Coverage. No law is left without body text, the 11 integrity checks pass (no dangling edges), and the same input produces the same output.
- Resolution rates leave out citations whose target is not in a current-law corpus: pre-amendment
text (旧法), amending acts (改正法), and citations inside amending-law 附則 blocks. These are counted
separately in
jp_cites_stats.json. - Precision is preliminary. 180 random edges (10–20 per resolution rule) were checked by hand
against their source text during development. Five error classes turned up and were fixed. The rules covering 86% of edges now
measure ≈98%. Samples are small (10/10 still has a 72% lower bound) and were not blind, so treat it
as indicative. Citations inside amending-law 附則 are about 40% right and are flagged with
confidence 0.4. Citations of pre-amendment text (「旧○○法第N条」) point at the current version and
carry
version: "pre_amendment". Details: docs/METHODOLOGY.md. - Scope. National statutes in force only: no case law, 通達, local ordinances, or text of repealed and amending acts. イ/ロ/ハ subitems are folded into their item.
Reproduce
jlawcite fetch --zip all_xml.zip # re-extract an archived snapshot for an exact rebuild
jlawcite build … --as-of 20260929 # same snapshot + same as-of date → same graph
jlawcite export --out data # regenerate the files in /data
python tools/build_explorer.py # regenerate explorer.html
python -m pytest # 177 tests
Related work
- 弁護士ドットコム (DDS 2026) built a citation graph over e-Gov statutes (条・項・号) together with books, guidelines and court decisions. It reports P 98.8 / R 92.1 for law-to-law citations; same-law references are outside its evaluation, and the graph is not public. paper
- DaisukeHori/japan-law publishes about 112k article-level cross-references for about 8,000 laws (CC0), without an accuracy evaluation.
- Reference resolution in Japanese statutes goes back to Tran, Nguyen & Shimazu (ICAIL 2013). Using citation structure for statute retrieval has been shown on the Japanese Civil Code (Mizuno & Kano, COLIEE 2025; Vuong et al., Applied Intelligence 2025) and on Belgian law (Louis et al., EACL 2023).
JLaw-CiteGraph adds same-law and relative references (前条・同条・同項・前号・同法), version selection with upcoming amendments, per-rule precision, and a retrieval evaluation over the whole corpus, all as open data.
Documentation
CHANGELOG · DATA_CARD · METHODOLOGY · eval protocol · detailed Korean docs: dataset, schema & resolution rules, search, improvement handbook
Contributing
Issues and PRs are welcome: CONTRIBUTING.md. A blind annotation round
(eval/) would turn the preliminary precision into a validated number, and it is the most useful
single contribution.
License
Code: Apache-2.0. Data: CC BY 4.0 (source: e-Gov 法令データ; NTA 質疑応答事例 for eval/v2/nta_gold.jsonl).
See DATA_LICENSE.md. This is not legal advice; check e-Gov / 官報 for legal decisions.
Citation
@misc{jlaw_citegraph_2026,
title = {JLaw-CiteGraph: An open citation graph of Japanese statutory law},
version = {2.1.0},
year = {2026},
note = {e-Gov 2026-09-27 snapshot},
url = {https://github.com/yabooung/jp-law-citation-graph}
}
Metadata
Release files for jlawcite 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jlawcite-2.1.0.tar.gz | 109.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jlawcite-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 206.0 kB
Release files / jlawcite-2.1.0.tar.gz
| Download URL | jlawcite-2.1.0.tar.gz |
|---|---|
| Size | 109.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63819f5aea6a6ebb633fc9fdd2f1039c75e74619ef73216d34af865b1cd5e9ef
|
|
BLAKE2b-256 checksum How to use checksums |
156579d4109e2f562142851b4746e69ff0827efe1662dad2a1ecbf35369b7ed0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / jlawcite-2.1.0-py3-none-any.whl
| Download URL | jlawcite-2.1.0-py3-none-any.whl |
|---|---|
| Size | 96.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4f89df4943af840a30f49e8b0f2c9a9317933f113e74d6e25e1dc5fe182c449
|
|
BLAKE2b-256 checksum How to use checksums |
73927b77703ea09d91fa1620121b84e96b54eccf5c14fde3bc40ff1909399328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|