POC/thought experiment for a JSON-based intermediate representation for the logical structure of legislation. It captures statutory text, the rules embedded in that text, and known points of ambiguity in a single machine-readable document. The format is jurisdiction-agnostic, tool-agnostic, and designed so that every derived annotation can be traced back to the source language.
A .lawgraph.json file for 17 U.S.C. § 107 (fair use) shows all three layers:
{
"id": "17-usc-107",
"citation": "17 U.S.C. § 107",
"title": "Limitations on exclusive rights: Fair use",
"jurisdiction": "us-federal",
"text": "Notwithstanding the provisions of sections 106 and 106A, the fair use of a copyrighted work ...",
"sections": [
{ "id": "17-usc-107-1", "label": "(1)", "text": "the purpose and character of the use ..." },
{ "id": "17-usc-107-2", "label": "(2)", "text": "the nature of the copyrighted work;" }
],
"effective_date": "1992-10-24",
"provisions": [
{
"id": "17-usc-107-p1",
"type": "defense",
"text": "the fair use of a copyrighted work ... is not an infringement of copyright.",
"conditions": [
{ "id": "17-usc-107-p1-c1", "text": "the use qualifies as 'fair use' under the four-factor balancing test", "type": "factual" }
]
}
],
"ambiguities": [
{
"id": "17-usc-107-amb-1",
"type": "undefined_standard",
"location": "17-usc-107-p1",
"text": "for purposes such as criticism, comment, news reporting, teaching ...",
"description": "The word 'such as' makes the listed purposes illustrative, not exhaustive.",
"source": "human"
}
]
}Layer 0 (top) is the statutory text and structure. Layer 1 (provisions) decomposes the text into individual rules with conditions and logic. Layer 2 (ambiguities) captures interpretive questions and competing readings.
- Layer 0 — Structure. The statutory text and its formal organization: section IDs, headings, sub-sections, defined terms, cross-references, effective dates. Everything here can be extracted automatically from official sources like U.S. Code XML.
- Layer 1 — Logic. Individual provisions (obligations, prohibitions, permissions, defenses, exceptions) with their conditional logic. Semi-automatable with NLP; typically needs human review.
- Layer 2 — Analysis. Ambiguities in the text, competing interpretations, and how courts have addressed them. Primarily human-authored. Every annotation carries provenance and, for machine-generated entries, a confidence score.
Each layer builds on the previous one, and a valid LawGraph document can contain any subset of layers.
Browse parsed statutes in the web viewer: dvelton.github.io/lawgraph
| Statute | Citation | Layers |
|---|---|---|
| Fair Use | 17 U.S.C. § 107 | L0 + L1 + L2 |
| Section 230 | 47 U.S.C. § 230 | L0 + L1 + L2 |
| DMCA Safe Harbors | 17 U.S.C. § 512 | L0 + L1 + L2 |
| CFAA | 18 U.S.C. § 1030 | L0 + L1 + L2 |
| Copyright Definitions | 17 U.S.C. § 101 | L0 + L1 |
| Exclusive Rights | 17 U.S.C. § 106 | L0 + L1 |
| DMCA Anti-Circumvention | 17 U.S.C. § 1201 | L0 + L1 |
| Sherman Act § 1 | 15 U.S.C. § 1 | L0 + L1 |
| Sherman Act § 2 | 15 U.S.C. § 2 | L0 + L1 |
| FTC Act § 5 | 15 U.S.C. § 45 | L0 + L1 |
| Patent Infringement | 35 U.S.C. § 271 | L0 + L1 |
| Stored Communications Act | 18 U.S.C. § 2701 | L0 + L1 |
The reference parser converts U.S. Code XML into LawGraph JSON.
cd parser && pip install -e .
lawgraph parse "17 USC 107" --output fair-use.lawgraph.jsonOptions:
lawgraph parse CITATION [--output FILE] [--layer 0|1|2]
--layer controls parsing depth: 0 for structure only, 1 (default) for structure + logic, 2 for structure + logic + analysis (not yet implemented).
The parser also includes lawgraph fetch (download U.S. Code XML by title) and lawgraph validate (check a .lawgraph.json file against the schema).
The full schema is at spec/schema.json (JSON Schema draft 2020-12). The specification document at spec/SPEC.md covers the field reference, design principles, and a complete annotated example.
LawGraph is designed to be extended. A few directions where contributions would be useful:
- Parsers for other jurisdictions. The format is jurisdiction-agnostic; the reference parser targets U.S. federal statutes, but the same schema works for state codes, EU directives, or other statutory systems.
- Renderers and analyzers. The web viewer is one way to consume LawGraph data. Others might include diff tools for statutory amendments, cross-reference graphs, or compliance checkers.
- Layer 2 annotations. The example statutes have Layer 0 and Layer 1 coverage. Adding ambiguity analysis and judicial treatment data to more statutes would make the corpus more useful for legal research.
See spec/layers.md for detailed implementation guidance on each layer.