File size: 4,308 Bytes
5bafd8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13fe3f5
5bafd8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43639c7
 
 
 
 
 
 
 
5bafd8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
license: other
task_categories:
- text-retrieval
tags:
- legal
- law
- graphrag
- bm25
- research
- not-legal-advice
- pakistan
pretty_name: Pakistan laws IR (CID-keyed GraphRAG)
configs:
- config_name: corpus
  data_files:
  - split: train
    path: data/corpus/*.parquet
- config_name: bm25_documents
  data_files:
  - split: train
    path: data/bm25/documents/*.parquet
- config_name: bm25_postings
  data_files:
  - split: train
    path: data/bm25/postings/*.parquet
- config_name: bm25_keyword_index
  data_files:
  - split: train
    path: indexes/bm25_keyword_shards.parquet
- config_name: vectors
  data_files:
  - split: train
    path: data/vectors/*.parquet
- config_name: vector_meta_index
  data_files:
  - split: train
    path: indexes/vector_chunks.parquet
- config_name: graph_nodes
  data_files:
  - split: train
    path: data/graph/nodes/*.parquet
- config_name: graph_edges
  data_files:
  - split: train
    path: data/graph/edges/*.parquet
- config_name: graph_outgoing_adjacency
  data_files:
  - split: train
    path: data/graph/adjacency/outgoing/*.parquet
- config_name: graph_incoming_adjacency
  data_files:
  - split: train
    path: data/graph/adjacency/incoming/*.parquet
---

# Pakistan legislation IR (CID-keyed sparse GraphRAG)

Research retrieval release of `endomorphosis/ipfs_pakistan_laws` (revision `f64d60c2a99189ca921e6d7fd20254912b0def64`) packaged as
`country-laws-ir-graphrag/v1` (layout family `skillcenter-huggingface-release/v3` / publicus-ir).

**Not legal advice.** This is a research snapshot. The official gazette /
authentic source of Pakistan prevails over this corpus. Retrieved documents
and graph edges are retrieval evidence only. No legal text was invented.

Primary key: `entry_cid` (CIDv1 raw sha2-256 of a canonical identity record).
Integer `document_index` values are compact shard pointers, not identities.

Target Hub id (packaging metadata only): `justicedao/ipfs_pakistan_laws_ir`.

## Counts

| Field | Value |
| --- | --- |
| Laws (corpus units) | 958 |
| Articles (corpus units) | 41754 |
| Canonical docs | 42712 |
| BM25 terms | 47090 |
| BM25 postings | 3493690 |
| Graph nodes | 45587 |
| Graph edges | 298984 |
| Vectors | 42712 × 384-d `thenlper/gte-small` (embedded) |

## Canonical fields

`entry_cid`, `law_cid`, `record_type`, `jurisdiction`, `language`,
`instrument_id`, `instrument_title`, `article_number`, `article_title`,
`title`, `body`, `source_url`, `snapshot_date`, `coverage`, `license`,
`collector`, `source_dataset`, `source_revision`.

Unit policy: prefer article/section rows; fall back to law-level when
`articles.parquet` is empty.

## Index layout

Zstandard parquet shards with at most 4,096 rows.

- `indexes/bm25_keyword_shards.parquet` — lexical term ranges → BM25 posting shards
- `indexes/vector_chunks.parquet` — semantic routing centroids (rows sorted by cosine to shard centroid)
- `indexes/corpus_chunks.parquet` — document ranges → corpus shards
- `data/graph/nodes` / `data/graph/edges` — property graph
- `data/graph/adjacency/{incoming,outgoing}` — score-ordered neighbor pages

BM25: Okapi k1=1.2, b=0.75, title_weight=5, body_weight=1 (FTS5 unicode61-style tokenizer).

Graph: one node per `entry_cid` plus facet nodes (`_facet_cid(kind, value)` for
jurisdiction, language, instrument, source, status). Neighbor edges
`BM25_NEIGHBOR_OF` (k=8) carry score and matched terms. Structural edges:
`ARTICLE_OF` (article → parent law) when articles exist, plus `IDENTIFIED_BY_ELI`
/ `IDENTIFIED_BY` only when those identifiers are present in the source.

## Query

```
python scripts/query_country_laws_hf.py --local-dir . bm25 "constitution" --top-k 10
python scripts/query_country_laws_hf.py --local-dir . vector "money laundering" --top-k 10
python scripts/query_country_laws_hf.py --local-dir . graph neighbors <entry_cid>
```

## Publish later (operator)

```
export HF_TOKEN=...   # never commit
hf upload-large-folder justicedao/ipfs_pakistan_laws_ir . \
  --repo-type dataset --no-private --num-workers 8 \
  --exclude "**/__pycache__/**" --exclude "**/*.pyc"
```

## Provenance

Packaged by country-laws-ir. Upstream collector and official license remain those
of `endomorphosis/ipfs_pakistan_laws`. CIDs identify local content; they do not prove public IPFS pinning.