endomorphosis commited on
Commit
2d2b55e
·
verified ·
1 Parent(s): b71df3f

Add files using upload-large-folder tool

Browse files
data/bm25/documents/part-000020.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5b807e6d3d973dd9ee951ec5c1651e8144a10b51353535b6844ce467cf35c58e
3
- size 256413
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d68542a02ae1688305793a6e855e90339839a4145afb1614748cd66f843d7a13
3
+ size 359713
manifest.json CHANGED
@@ -1,58 +1,52 @@
1
  {
2
- "schema_version": "skillcenter-huggingface-release/v3",
3
- "packager_version": "0.1.0",
4
- "primary_key": "entry_cid",
5
- "dataset_id": "endomorphosis/ipfs_argentina_laws",
6
- "dataset_repo_id": "justicedao/ipfs_argentina_laws-ir",
7
- "dataset_revision": "0361102728979d41f9e2953f8b03fcc4243d3039",
8
- "country": {
9
- "slug": "argentina",
10
- "repo": "endomorphosis/ipfs_argentina_laws",
11
- "name": "Argentina",
12
- "indexable": true
13
- },
14
- "disclaimer": "Research snapshot. Not legal advice. The official gazette / authentic source prevails.",
15
  "bm25": {
16
- "k1": 1.2,
17
  "b": 0.75,
18
- "title_weight": 5.0,
19
  "body_weight": 1.0,
20
- "average_document_length": 326.36434898797444,
21
- "tokenizer": "fts5-unicode61-remove-diacritics-2-python/v1",
22
  "max_query_terms": 64,
23
  "posting_rows_per_record": 4096,
24
- "terms_per_shard": 4096
 
 
 
 
 
 
 
 
25
  },
26
  "counts": {
27
  "bm25_document_chunks": 25,
28
  "bm25_documents": 101035,
29
  "bm25_keyword_shards": 22,
30
  "bm25_posting_rows": 86888,
 
31
  "bm25_postings": 9327357,
32
  "bm25_terms": 86072,
33
  "corpus_chunks": 25,
34
  "corpus_rows": 101035,
 
35
  "graph_edge_chunks": 251,
36
  "graph_edges": 1025923,
37
  "graph_incoming_adjacency_edges": 1025923,
38
  "graph_incoming_adjacency_rows": 101348,
39
  "graph_incoming_adjacency_shards": 25,
40
  "graph_node_chunks": 27,
 
41
  "graph_nodes": 109681,
42
  "graph_outgoing_adjacency_edges": 1025923,
43
  "graph_outgoing_adjacency_rows": 101035,
44
  "graph_outgoing_adjacency_shards": 25,
45
- "vector_chunks": 25,
46
- "vector_rows": 101035,
47
  "n_laws": 8643,
48
- "n_articles": 92392
49
- },
50
- "parquet": {
51
- "compression": "zstd",
52
- "compression_level": 6,
53
- "max_rows_per_file": 4096,
54
- "row_group_size": 4096
55
  },
 
 
 
 
56
  "graph": {
57
  "adjacency_pointers_per_row": 4096,
58
  "adjacency_pointers_per_shard": 8192,
@@ -60,8 +54,6 @@
60
  "incoming",
61
  "outgoing"
62
  ],
63
- "max_remote_walk_depth": 8,
64
- "ordering": "score_desc_nulls_last",
65
  "edge_types": [
66
  "HAS_JURISDICTION",
67
  "HAS_LAW_ID",
@@ -69,107 +61,220 @@
69
  "HAS_SOURCE",
70
  "BM25_NEIGHBOR_OF",
71
  "CONTAINED_IN"
72
- ]
73
- },
74
- "vector": {
75
- "model_name": "thenlper/gte-small",
76
- "dimension": 384,
77
- "similarity": "cosine",
78
- "assignment": "recursive_spherical_kmeans",
79
- "layout": "semantic_centroid_groups",
80
- "rows_sorted_by": "cosine_similarity_to_shard_centroid_desc",
81
- "max_rows_per_chunk": 4096,
82
- "max_rows_per_centroid": 8192,
83
- "max_shards_per_centroid": 2,
84
- "default_probe_centroids": 4,
85
- "centroid_count": 38,
86
- "shard_count": 38,
87
- "n_vectors": 101035
88
- },
89
- "schema_mapping": {
90
- "laws": {
91
- "id": "source_id / law_id",
92
- "title": "title",
93
- "text": "body",
94
- "article_count_dtype_source": "int32"
95
- },
96
- "articles": {
97
- "id": "source_id / article_id",
98
- "law_id": "law_id / parent_law_id",
99
- "title": "title",
100
- "text": "body"
101
- },
102
- "required_law_columns": [
103
- "id",
104
- "title",
105
- "text"
106
  ],
107
- "required_article_columns": [
108
- "id",
109
- "law_id",
110
- "title",
111
- "text"
112
- ],
113
- "fail_closed": true,
114
- "notes": "Malta and Germany share the same column names. Drift: Malta article_count is int64, Germany article_count is int32; Germany eli is often null. Identifiers are never invented."
115
  },
116
  "indexes": {
117
  "bm25_document_chunks": {
118
  "cid": "bafkreigy5mkwikyr32y7ueh66ilgi7mko5qahm5mwhhzm3augoigiumuf4",
119
- "sha256": "d8eb15642b11deb1fa10fef216647d8a776003b3acb1cf966c1433906451942f",
120
- "size_bytes": 12624,
121
- "relative_path": "indexes/bm25_document_chunks.parquet"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  },
123
  "bm25_keyword_shards": {
124
  "cid": "bafkreietej6aj43v4jlcuiw47uzl334nfiwopiypwwewh56xhi2f7gryke",
125
- "sha256": "93227c04f375e2562a22dcfd32bdef8d2a2ce7a30fb58963f7d73a345f9a3851",
126
- "size_bytes": 12540,
127
- "relative_path": "indexes/bm25_keyword_shards.parquet"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  },
129
  "corpus_chunks": {
130
  "cid": "bafkreickhec272gyjf2kwuwjbtekvbtiu2uyrxgj4pepovr3qnovqzroqi",
131
- "sha256": "4a3905afe8d84974ab52c90cc8aa8668a6a988dcc9e3c8f7563b835d58662e82",
132
- "size_bytes": 12573,
133
- "relative_path": "indexes/corpus_chunks.parquet"
 
 
 
 
 
134
  },
135
  "graph_edge_chunks": {
136
  "cid": "bafkreiehamnnmqzpforjm4jcnoqxxbrfeacy76xfok24nvh42uuuslon7u",
137
- "sha256": "87031ad6432f2ba29671226ba17b862520058ffae572b5c6d4fcd529492dcdfd",
138
- "size_bytes": 46309,
139
- "relative_path": "indexes/graph_edge_chunks.parquet"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  },
141
  "graph_incoming_adjacency": {
142
  "cid": "bafkreidzjvcwdkr75invd7qvqaiefbsigo4av2fe46xnnjxs6of4w4b7tu",
143
- "sha256": "794d4561aa3fea1b51fe15801042864833b80ae8a4e7aed6a6f2f38bcb703f9d",
144
- "size_bytes": 15661,
145
- "relative_path": "indexes/graph_incoming_adjacency.parquet"
 
 
 
 
 
146
  },
147
  "graph_node_chunks": {
148
  "cid": "bafkreigsqcex65xxrzsw72lnvbgl2aypnhwzcz6666p4vmwx3p4ymuxhzm",
149
- "sha256": "d280897f76f78e656fe96da84cbd030f69ed9167def79fcab2d7dbf98652e7cb",
150
- "size_bytes": 12722,
151
- "relative_path": "indexes/graph_node_chunks.parquet"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  },
153
  "graph_outgoing_adjacency": {
154
  "cid": "bafkreid4qjp3dnulzqsac2jy4rteayhfoahmk46u5zkzewfuvzjj7wsley",
155
- "sha256": "7c825fb1b68bcc24016938e4664060e5700ec573d4ee559258b4ae529fda4b26",
156
- "size_bytes": 15642,
157
- "relative_path": "indexes/graph_outgoing_adjacency.parquet"
 
 
 
 
 
158
  },
159
  "vector_chunks": {
160
  "cid": "bafkreibf2hmove7uqm4xyi5jdvfmw3yrvjm35kgeyscowzg53cqxfiyxii",
161
- "sha256": "25d1d8ea93f483397c23a91d4acb6f11aa59bea8c4c484eb64ddd8a172a31742",
162
- "size_bytes": 133891,
163
- "relative_path": "indexes/vector_chunks.parquet"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  "source": {
167
- "source_dataset": "endomorphosis/ipfs_argentina_laws",
168
- "source_revision": "0361102728979d41f9e2953f8b03fcc4243d3039",
169
- "laws_path": "/workspace/country-laws-ir/cache/hf/datasets--endomorphosis--ipfs_argentina_laws/snapshots/0361102728979d41f9e2953f8b03fcc4243d3039/data/laws.parquet",
 
 
 
 
 
 
 
 
 
170
  "articles_path": "/workspace/country-laws-ir/cache/hf/datasets--endomorphosis--ipfs_argentina_laws/snapshots/0361102728979d41f9e2953f8b03fcc4243d3039/data/articles.parquet",
171
- "n_laws_source": 8643,
172
- "n_articles_source": 92507,
173
  "laws_columns": [
174
  "id",
175
  "title",
@@ -191,17 +296,25 @@
191
  "json_path",
192
  "metadata_json"
193
  ],
194
- "articles_columns": [
195
- "law_id",
196
- "id",
197
- "title",
198
- "text",
199
- "source_url",
200
- "document_number",
201
- "article_number",
202
- "record_type",
203
- "metadata_json"
204
- ],
205
- "article_count_dtype": "int32"
 
 
 
 
 
 
 
 
206
  }
207
  }
 
1
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  "bm25": {
3
+ "average_document_length": 326.36434898797444,
4
  "b": 0.75,
 
5
  "body_weight": 1.0,
6
+ "k1": 1.2,
 
7
  "max_query_terms": 64,
8
  "posting_rows_per_record": 4096,
9
+ "terms_per_shard": 4096,
10
+ "title_weight": 5.0,
11
+ "tokenizer": "fts5-unicode61-remove-diacritics-2-python/v1"
12
+ },
13
+ "country": {
14
+ "indexable": true,
15
+ "name": "Argentina",
16
+ "repo": "endomorphosis/ipfs_argentina_laws",
17
+ "slug": "argentina"
18
  },
19
  "counts": {
20
  "bm25_document_chunks": 25,
21
  "bm25_documents": 101035,
22
  "bm25_keyword_shards": 22,
23
  "bm25_posting_rows": 86888,
24
+ "bm25_posting_shards": 22,
25
  "bm25_postings": 9327357,
26
  "bm25_terms": 86072,
27
  "corpus_chunks": 25,
28
  "corpus_rows": 101035,
29
+ "corpus_shards": 25,
30
  "graph_edge_chunks": 251,
31
  "graph_edges": 1025923,
32
  "graph_incoming_adjacency_edges": 1025923,
33
  "graph_incoming_adjacency_rows": 101348,
34
  "graph_incoming_adjacency_shards": 25,
35
  "graph_node_chunks": 27,
36
+ "graph_node_shards": 27,
37
  "graph_nodes": 109681,
38
  "graph_outgoing_adjacency_edges": 1025923,
39
  "graph_outgoing_adjacency_rows": 101035,
40
  "graph_outgoing_adjacency_shards": 25,
41
+ "n_articles": 92392,
 
42
  "n_laws": 8643,
43
+ "vector_chunks": 25,
44
+ "vector_rows": 101035
 
 
 
 
 
45
  },
46
+ "dataset_id": "endomorphosis/ipfs_argentina_laws",
47
+ "dataset_repo_id": "justicedao/ipfs_argentina_laws-ir",
48
+ "dataset_revision": "0361102728979d41f9e2953f8b03fcc4243d3039",
49
+ "disclaimer": "Research snapshot. Not legal advice. The official gazette / authentic source prevails.",
50
  "graph": {
51
  "adjacency_pointers_per_row": 4096,
52
  "adjacency_pointers_per_shard": 8192,
 
54
  "incoming",
55
  "outgoing"
56
  ],
 
 
57
  "edge_types": [
58
  "HAS_JURISDICTION",
59
  "HAS_LAW_ID",
 
61
  "HAS_SOURCE",
62
  "BM25_NEIGHBOR_OF",
63
  "CONTAINED_IN"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  ],
65
+ "max_remote_walk_depth": 8,
66
+ "ordering": "score_desc_nulls_last"
 
 
 
 
 
 
67
  },
68
  "indexes": {
69
  "bm25_document_chunks": {
70
  "cid": "bafkreigy5mkwikyr32y7ueh66ilgi7mko5qahm5mwhhzm3augoigiumuf4",
71
+ "content_cid": "bafkreid5al6p6ovnezsjrzbrgr3o26mdx7tykgpedujclrwiijwslf2rbq",
72
+ "family": "routing_index",
73
+ "media_type": "application/vnd.apache.parquet",
74
+ "relative_path": "indexes/bm25_document_chunks.parquet",
75
+ "row_count": 25,
76
+ "schema_id": "hf-graphrag-compact-index/v1",
77
+ "sha256": "7d02fcff3aad266498e4313476ed7983bfe78519e41d1225c6c8426d2597510c",
78
+ "size_bytes": 9434
79
+ },
80
+ "bm25_documents": {
81
+ "content_cid": "bafkreid5al6p6ovnezsjrzbrgr3o26mdx7tykgpedujclrwiijwslf2rbq",
82
+ "family": "routing_index",
83
+ "media_type": "application/vnd.apache.parquet",
84
+ "relative_path": "indexes/bm25_document_chunks.parquet",
85
+ "row_count": 25,
86
+ "schema_id": "hf-graphrag-compact-index/v1",
87
+ "sha256": "7d02fcff3aad266498e4313476ed7983bfe78519e41d1225c6c8426d2597510c",
88
+ "size_bytes": 9434
89
+ },
90
+ "bm25_keyword_index": {
91
+ "content_cid": "bafkreie6sa2r7fwsg4ytqvgt7gdac6jrqy5mxje6cd35atgfxyxfqpxsbi",
92
+ "family": "routing_index",
93
+ "media_type": "application/vnd.apache.parquet",
94
+ "relative_path": "indexes/bm25_keyword_shards.parquet",
95
+ "row_count": 22,
96
+ "schema_id": "hf-graphrag-compact-index/v1",
97
+ "sha256": "9e90351f96d237313854d3f986017931863acba49e10f7d04cc5be2e583ef20a",
98
+ "size_bytes": 7243
99
  },
100
  "bm25_keyword_shards": {
101
  "cid": "bafkreietej6aj43v4jlcuiw47uzl334nfiwopiypwwewh56xhi2f7gryke",
102
+ "content_cid": "bafkreie6sa2r7fwsg4ytqvgt7gdac6jrqy5mxje6cd35atgfxyxfqpxsbi",
103
+ "family": "routing_index",
104
+ "media_type": "application/vnd.apache.parquet",
105
+ "relative_path": "indexes/bm25_keyword_shards.parquet",
106
+ "row_count": 22,
107
+ "schema_id": "hf-graphrag-compact-index/v1",
108
+ "sha256": "9e90351f96d237313854d3f986017931863acba49e10f7d04cc5be2e583ef20a",
109
+ "size_bytes": 7243
110
+ },
111
+ "bm25_postings": {
112
+ "content_cid": "bafkreie6sa2r7fwsg4ytqvgt7gdac6jrqy5mxje6cd35atgfxyxfqpxsbi",
113
+ "family": "routing_index",
114
+ "media_type": "application/vnd.apache.parquet",
115
+ "relative_path": "indexes/bm25_keyword_shards.parquet",
116
+ "row_count": 22,
117
+ "schema_id": "hf-graphrag-compact-index/v1",
118
+ "sha256": "9e90351f96d237313854d3f986017931863acba49e10f7d04cc5be2e583ef20a",
119
+ "size_bytes": 7243
120
+ },
121
+ "corpus": {
122
+ "content_cid": "bafkreidaksg5ycekzud7qofpyydkc6qighamnam5mxnqiqce3wgqmfiohq",
123
+ "family": "routing_index",
124
+ "media_type": "application/vnd.apache.parquet",
125
+ "relative_path": "indexes/corpus_chunks.parquet",
126
+ "row_count": 25,
127
+ "schema_id": "hf-graphrag-compact-index/v1",
128
+ "sha256": "60548ddc088acd07f838afc606a17a0831c0c6819d65db044044dd8d06150e3c",
129
+ "size_bytes": 9354
130
  },
131
  "corpus_chunks": {
132
  "cid": "bafkreickhec272gyjf2kwuwjbtekvbtiu2uyrxgj4pepovr3qnovqzroqi",
133
+ "content_cid": "bafkreidaksg5ycekzud7qofpyydkc6qighamnam5mxnqiqce3wgqmfiohq",
134
+ "family": "routing_index",
135
+ "media_type": "application/vnd.apache.parquet",
136
+ "relative_path": "indexes/corpus_chunks.parquet",
137
+ "row_count": 25,
138
+ "schema_id": "hf-graphrag-compact-index/v1",
139
+ "sha256": "60548ddc088acd07f838afc606a17a0831c0c6819d65db044044dd8d06150e3c",
140
+ "size_bytes": 9354
141
  },
142
  "graph_edge_chunks": {
143
  "cid": "bafkreiehamnnmqzpforjm4jcnoqxxbrfeacy76xfok24nvh42uuuslon7u",
144
+ "content_cid": "bafkreifbsoeizaa42jt6lorxt5mtqliibt6hzprwoidxoa5puczpibt3y4",
145
+ "family": "routing_index",
146
+ "media_type": "application/vnd.apache.parquet",
147
+ "relative_path": "indexes/graph_edge_chunks.parquet",
148
+ "row_count": 251,
149
+ "schema_id": "hf-graphrag-compact-index/v1",
150
+ "sha256": "a193888c801cd267e5ba379f59382d080cfc7cbe3672077703afa0b2f4067bc7",
151
+ "size_bytes": 50555
152
+ },
153
+ "graph_edges": {
154
+ "content_cid": "bafkreifbsoeizaa42jt6lorxt5mtqliibt6hzprwoidxoa5puczpibt3y4",
155
+ "family": "routing_index",
156
+ "media_type": "application/vnd.apache.parquet",
157
+ "relative_path": "indexes/graph_edge_chunks.parquet",
158
+ "row_count": 251,
159
+ "schema_id": "hf-graphrag-compact-index/v1",
160
+ "sha256": "a193888c801cd267e5ba379f59382d080cfc7cbe3672077703afa0b2f4067bc7",
161
+ "size_bytes": 50555
162
  },
163
  "graph_incoming_adjacency": {
164
  "cid": "bafkreidzjvcwdkr75invd7qvqaiefbsigo4av2fe46xnnjxs6of4w4b7tu",
165
+ "content_cid": "bafkreigivcgunz62mdeqbogwc4xou4mopptnz3tqthjukbup5ftgzz7oyy",
166
+ "family": "routing_index",
167
+ "media_type": "application/vnd.apache.parquet",
168
+ "relative_path": "indexes/graph_incoming_adjacency.parquet",
169
+ "row_count": 25,
170
+ "schema_id": "hf-graphrag-compact-index/v1",
171
+ "sha256": "c8a88d46e7da60c900b8d6172eea718e7be6dcee7099d345068fe9666ce7eec6",
172
+ "size_bytes": 9537
173
  },
174
  "graph_node_chunks": {
175
  "cid": "bafkreigsqcex65xxrzsw72lnvbgl2aypnhwzcz6666p4vmwx3p4ymuxhzm",
176
+ "content_cid": "bafkreibj5i3rsele5yjhqvzegxqofbdstx3yvkzlvf6gwpjolpequypace",
177
+ "family": "routing_index",
178
+ "media_type": "application/vnd.apache.parquet",
179
+ "relative_path": "indexes/graph_node_chunks.parquet",
180
+ "row_count": 27,
181
+ "schema_id": "hf-graphrag-compact-index/v1",
182
+ "sha256": "29ea37191164ee1278572435e0e284729df78aab2ba97c6b3d2e5bc90a61e011",
183
+ "size_bytes": 9696
184
+ },
185
+ "graph_nodes": {
186
+ "content_cid": "bafkreibj5i3rsele5yjhqvzegxqofbdstx3yvkzlvf6gwpjolpequypace",
187
+ "family": "routing_index",
188
+ "media_type": "application/vnd.apache.parquet",
189
+ "relative_path": "indexes/graph_node_chunks.parquet",
190
+ "row_count": 27,
191
+ "schema_id": "hf-graphrag-compact-index/v1",
192
+ "sha256": "29ea37191164ee1278572435e0e284729df78aab2ba97c6b3d2e5bc90a61e011",
193
+ "size_bytes": 9696
194
  },
195
  "graph_outgoing_adjacency": {
196
  "cid": "bafkreid4qjp3dnulzqsac2jy4rteayhfoahmk46u5zkzewfuvzjj7wsley",
197
+ "content_cid": "bafkreieyebvtroxyyvuc3lr5pzr2ms4g5qt3ylpr3t7aazthkzcbslgpoq",
198
+ "family": "routing_index",
199
+ "media_type": "application/vnd.apache.parquet",
200
+ "relative_path": "indexes/graph_outgoing_adjacency.parquet",
201
+ "row_count": 25,
202
+ "schema_id": "hf-graphrag-compact-index/v1",
203
+ "sha256": "98206b38baf8c5682dae3d7e63a64b86ec27bc2df1dcfe0066675644192ccf74",
204
+ "size_bytes": 9510
205
  },
206
  "vector_chunks": {
207
  "cid": "bafkreibf2hmove7uqm4xyi5jdvfmw3yrvjm35kgeyscowzg53cqxfiyxii",
208
+ "content_cid": "bafkreiacgoul6ivkdj7dnbayowxkrysa3sn2gczh7lh65ibfphoxipbrbe",
209
+ "family": "routing_index",
210
+ "media_type": "application/vnd.apache.parquet",
211
+ "relative_path": "indexes/vector_chunks.parquet",
212
+ "row_count": 25,
213
+ "schema_id": "hf-graphrag-compact-index/v1",
214
+ "sha256": "0233a8bf22aa1a7e36841875aea8e240dc9ba30b27facfeea02579dd743c3109",
215
+ "size_bytes": 9324
216
+ },
217
+ "vectors": {
218
+ "content_cid": "bafkreiacgoul6ivkdj7dnbayowxkrysa3sn2gczh7lh65ibfphoxipbrbe",
219
+ "family": "routing_index",
220
+ "media_type": "application/vnd.apache.parquet",
221
+ "relative_path": "indexes/vector_chunks.parquet",
222
+ "row_count": 25,
223
+ "schema_id": "hf-graphrag-compact-index/v1",
224
+ "sha256": "0233a8bf22aa1a7e36841875aea8e240dc9ba30b27facfeea02579dd743c3109",
225
+ "size_bytes": 9324
226
  }
227
  },
228
+ "packager_version": "0.1.0",
229
+ "parquet": {
230
+ "compression": "zstd",
231
+ "compression_level": 6,
232
+ "max_rows_per_file": 4096,
233
+ "row_group_size": 4096
234
+ },
235
+ "primary_key": "entry_cid",
236
+ "schema_mapping": {
237
+ "articles": {
238
+ "id": "source_id / article_id",
239
+ "law_id": "law_id / parent_law_id",
240
+ "text": "body",
241
+ "title": "title"
242
+ },
243
+ "fail_closed": true,
244
+ "laws": {
245
+ "article_count_dtype_source": "int32",
246
+ "id": "source_id / law_id",
247
+ "text": "body",
248
+ "title": "title"
249
+ },
250
+ "notes": "Malta and Germany share the same column names. Drift: Malta article_count is int64, Germany article_count is int32; Germany eli is often null. Identifiers are never invented.",
251
+ "required_article_columns": [
252
+ "id",
253
+ "law_id",
254
+ "title",
255
+ "text"
256
+ ],
257
+ "required_law_columns": [
258
+ "id",
259
+ "title",
260
+ "text"
261
+ ]
262
+ },
263
+ "schema_version": "skillcenter-huggingface-release/v3",
264
  "source": {
265
+ "article_count_dtype": "int32",
266
+ "articles_columns": [
267
+ "law_id",
268
+ "id",
269
+ "title",
270
+ "text",
271
+ "source_url",
272
+ "document_number",
273
+ "article_number",
274
+ "record_type",
275
+ "metadata_json"
276
+ ],
277
  "articles_path": "/workspace/country-laws-ir/cache/hf/datasets--endomorphosis--ipfs_argentina_laws/snapshots/0361102728979d41f9e2953f8b03fcc4243d3039/data/articles.parquet",
 
 
278
  "laws_columns": [
279
  "id",
280
  "title",
 
296
  "json_path",
297
  "metadata_json"
298
  ],
299
+ "laws_path": "/workspace/country-laws-ir/cache/hf/datasets--endomorphosis--ipfs_argentina_laws/snapshots/0361102728979d41f9e2953f8b03fcc4243d3039/data/laws.parquet",
300
+ "n_articles_source": 92507,
301
+ "n_laws_source": 8643,
302
+ "source_dataset": "endomorphosis/ipfs_argentina_laws",
303
+ "source_revision": "0361102728979d41f9e2953f8b03fcc4243d3039"
304
+ },
305
+ "vector": {
306
+ "assignment": "recursive_spherical_kmeans",
307
+ "centroid_count": 38,
308
+ "default_probe_centroids": 4,
309
+ "dimension": 384,
310
+ "layout": "semantic_centroid_groups",
311
+ "max_rows_per_centroid": 8192,
312
+ "max_rows_per_chunk": 4096,
313
+ "max_shards_per_centroid": 2,
314
+ "model_name": "thenlper/gte-small",
315
+ "n_vectors": 101035,
316
+ "rows_sorted_by": "cosine_similarity_to_shard_centroid_desc",
317
+ "shard_count": 38,
318
+ "similarity": "cosine"
319
  }
320
  }
scripts/query_hf_graphrag.py ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Standalone thin-client search for a Hugging Face GraphRAG release.
3
+
4
+ Hub consumers can copy ``scripts/query_hf_graphrag.py`` (and
5
+ ``semantic_traversal.py`` when present) out of the dataset and search without
6
+ downloading the full corpus:
7
+
8
+ python scripts/query_hf_graphrag.py --local-root . bm25 "foia agency"
9
+ python scripts/query_hf_graphrag.py --repo-id ORG/NAME --revision PIN \\
10
+ neighbors bafkrei... --direction both --limit 25
11
+
12
+ Requires pyarrow. Remote queries also need huggingface_hub. Vector search
13
+ needs numpy; local embedding needs sentence-transformers.
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import argparse
18
+ import hashlib
19
+ import heapq
20
+ import json
21
+ import math
22
+ import os
23
+ import re
24
+ import sys
25
+ from collections import defaultdict
26
+ from pathlib import Path, PurePosixPath
27
+ from typing import Any, Mapping, Sequence
28
+
29
+ TOKEN_RE = re.compile(r"[a-z0-9]+(?:[-_./:][a-z0-9]+)*", re.I)
30
+ DEFAULT_MANIFEST = "manifest.json"
31
+ DEFAULT_CACHE = Path("~/.cache/ipfs_datasets_py/hf-graphrag-query").expanduser()
32
+
33
+
34
+ class RemoteQueryError(RuntimeError):
35
+ """Malformed release or missing dependency."""
36
+
37
+
38
+ def _safe_relative(path: str) -> PurePosixPath:
39
+ rel = PurePosixPath(str(path or "").replace("\\", "/"))
40
+ if rel.is_absolute() or ".." in rel.parts or not rel.parts:
41
+ raise RemoteQueryError(f"unsafe release path: {path!r}")
42
+ return rel
43
+
44
+
45
+ def _sha256(path: Path) -> str:
46
+ digest = hashlib.sha256()
47
+ with path.open("rb") as handle:
48
+ for chunk in iter(lambda: handle.read(1024 * 1024), b""):
49
+ digest.update(chunk)
50
+ return digest.hexdigest()
51
+
52
+
53
+ class ArtifactResolver:
54
+ """Fetch only requested files from a local root or the Hub."""
55
+
56
+ def __init__(
57
+ self,
58
+ *,
59
+ repo_id: str,
60
+ revision: str,
61
+ token: str | None,
62
+ cache_dir: Path,
63
+ local_root: Path | None,
64
+ ) -> None:
65
+ self.repo_id = repo_id
66
+ self.revision = revision
67
+ self.token = token
68
+ self.cache_dir = cache_dir
69
+ self.local_root = local_root.expanduser().resolve() if local_root else None
70
+ self.fetched: dict[str, int] = {}
71
+
72
+ def path(self, relative: str, descriptor: Mapping[str, Any] | None = None) -> Path:
73
+ safe = _safe_relative(relative)
74
+ if self.local_root is not None:
75
+ path = (self.local_root.joinpath(*safe.parts)).resolve()
76
+ try:
77
+ path.relative_to(self.local_root)
78
+ except ValueError as exc:
79
+ raise RemoteQueryError("path escapes release root") from exc
80
+ if not path.is_file():
81
+ raise RemoteQueryError(f"missing {relative}")
82
+ else:
83
+ try:
84
+ from huggingface_hub import hf_hub_download
85
+ except ImportError as exc:
86
+ raise RemoteQueryError("huggingface_hub is required for --repo-id") from exc
87
+ path = Path(
88
+ hf_hub_download(
89
+ repo_id=self.repo_id,
90
+ filename=safe.as_posix(),
91
+ repo_type="dataset",
92
+ revision=self.revision,
93
+ token=self.token,
94
+ cache_dir=str(self.cache_dir),
95
+ )
96
+ )
97
+ if descriptor and descriptor.get("sha256"):
98
+ got = _sha256(path)
99
+ expected = str(descriptor["sha256"]).removeprefix("sha256:")
100
+ if got != expected:
101
+ raise RemoteQueryError(f"sha256 mismatch for {relative}")
102
+ self.fetched[safe.as_posix()] = path.stat().st_size
103
+ return path
104
+
105
+ def json(self, relative: str) -> Any:
106
+ return json.loads(self.path(relative).read_text(encoding="utf-8"))
107
+
108
+ def parquet(self, relative: str, columns: Sequence[str] | None = None, descriptor=None):
109
+ import pyarrow.parquet as pq
110
+
111
+ return pq.read_table(
112
+ self.path(relative, descriptor),
113
+ columns=list(columns) if columns else None,
114
+ )
115
+
116
+ def trace(self) -> dict[str, Any]:
117
+ files = [
118
+ {"relative_path": path, "size_bytes": size}
119
+ for path, size in sorted(self.fetched.items())
120
+ ]
121
+ return {
122
+ "file_count": len(files),
123
+ "files": files,
124
+ "total_file_bytes": sum(item["size_bytes"] for item in files),
125
+ }
126
+
127
+
128
+ def _tokenize(query: str) -> list[str]:
129
+ return [token.lower() for token in TOKEN_RE.findall(query or "")]
130
+
131
+
132
+ def _bm25_score(tf: float, idf: float, doc_len: float, avgdl: float, k1: float, b: float) -> float:
133
+ if tf <= 0 or idf <= 0 or avgdl <= 0:
134
+ return 0.0
135
+ denom = tf + k1 * (1.0 - b + b * (doc_len / avgdl))
136
+ if denom <= 0:
137
+ return 0.0
138
+ return idf * (tf * (k1 + 1.0) / denom)
139
+
140
+
141
+ def _index_rows(manifest: Mapping[str, Any], key: str) -> list[dict[str, Any]]:
142
+ indexes = manifest.get("indexes") or {}
143
+ row = indexes.get(key) or indexes.get(key.replace("_", "-"))
144
+ return [row] if isinstance(row, dict) and row.get("relative_path") else []
145
+
146
+
147
+ class ThinClient:
148
+ def __init__(self, resolver: ArtifactResolver, manifest: Mapping[str, Any]) -> None:
149
+ self.resolver = resolver
150
+ self.manifest = dict(manifest)
151
+
152
+ def _locator(self, name: str) -> list[dict[str, Any]]:
153
+ indexes = self.manifest.get("indexes") or {}
154
+ aliases = {
155
+ "bm25_keyword_shards": (
156
+ "bm25_keyword_shards",
157
+ "bm25_postings",
158
+ "bm25_keyword_index",
159
+ ),
160
+ "bm25_postings": (
161
+ "bm25_postings",
162
+ "bm25_keyword_shards",
163
+ "bm25_keyword_index",
164
+ ),
165
+ }.get(name, (name,))
166
+ candidates: list[tuple[str, Mapping[str, Any] | None]] = []
167
+ seen: set[str] = set()
168
+ for key in aliases:
169
+ desc = indexes.get(key)
170
+ if isinstance(desc, dict) and desc.get("relative_path"):
171
+ relative = str(desc["relative_path"])
172
+ if relative not in seen:
173
+ candidates.append((relative, desc))
174
+ seen.add(relative)
175
+ for fallback in (f"indexes/{key}.parquet", f"indexes/{key}.json"):
176
+ if fallback not in seen:
177
+ candidates.append((fallback, None))
178
+ seen.add(fallback)
179
+ for relative, desc in candidates:
180
+ try:
181
+ if relative.endswith(".json"):
182
+ payload = self.resolver.json(relative)
183
+ rows = payload.get("routing") or payload.get("shards") or payload
184
+ if isinstance(rows, list):
185
+ return [dict(row) for row in rows]
186
+ continue
187
+ try:
188
+ table = self.resolver.parquet(relative, descriptor=desc)
189
+ except RemoteQueryError as exc:
190
+ # Rewritten locators often keep the country-pack name
191
+ # with a stale sha256. Retry the same path unchecked.
192
+ if "sha256 mismatch" not in str(exc) or desc is None:
193
+ raise
194
+ table = self.resolver.parquet(relative, descriptor=None)
195
+ return table.to_pylist()
196
+ except (RemoteQueryError, OSError, FileNotFoundError):
197
+ continue
198
+ raise RemoteQueryError(f"locator missing: {name}")
199
+
200
+ def _covering(self, rows: Sequence[Mapping[str, Any]], key: str) -> list[dict[str, Any]]:
201
+ hits = []
202
+ for row in rows:
203
+ first = str(row.get("first_key") or "")
204
+ last = str(row.get("last_key") or "")
205
+ if first <= key <= last:
206
+ hits.append(dict(row))
207
+ return hits or [dict(row) for row in rows if str(row.get("first_key") or "") == key]
208
+
209
+ def bm25(self, query: str, *, top_k: int) -> dict[str, Any]:
210
+ terms = _tokenize(query)[:64]
211
+ config = dict(self.manifest.get("bm25") or {})
212
+ k1 = float(config.get("k1") or 1.2)
213
+ b = float(config.get("b") or 0.75)
214
+ avgdl = float(config.get("average_document_length") or config.get("avg_doc_tokens") or 1.0)
215
+ title_w = float(config.get("title_weight") or 1.0)
216
+ body_w = float(config.get("body_weight") or 1.0)
217
+ loc = self._locator("bm25_keyword_shards") or self._locator("bm25_postings")
218
+ scores: dict[str, float] = defaultdict(float)
219
+ matched: dict[str, set[str]] = defaultdict(set)
220
+ shards = 0
221
+ for term in terms:
222
+ for row in self._covering(loc, term):
223
+ relative = str(row.get("relative_path") or "")
224
+ table = self.resolver.parquet(relative, descriptor=row)
225
+ names = set(table.schema.names)
226
+ shards += 1
227
+ if "document_indices" in names:
228
+ for rec in table.to_pylist():
229
+ if str(rec.get("term")) != term:
230
+ continue
231
+ idf = float(rec.get("idf") or 0.0)
232
+ for doc, title_tf, body_tf, length in zip(
233
+ rec.get("document_indices") or (),
234
+ rec.get("title_frequencies") or (),
235
+ rec.get("body_frequencies") or (),
236
+ rec.get("document_lengths") or (),
237
+ ):
238
+ tf = title_w * float(title_tf or 0) + body_w * float(body_tf or 0)
239
+ key = str(int(doc))
240
+ scores[key] += _bm25_score(tf, idf, float(length or 0), avgdl, k1, b)
241
+ matched[key].add(term)
242
+ elif "legal_id" in names:
243
+ for rec in table.to_pylist():
244
+ if str(rec.get("term")) != term:
245
+ continue
246
+ key = str(rec.get("legal_id") or rec.get("entry_cid"))
247
+ scores[key] += float(rec.get("tf") or 0)
248
+ matched[key].add(term)
249
+ ranked = heapq.nlargest(top_k, scores.items(), key=lambda item: item[1])
250
+ hits = [
251
+ {
252
+ "id": doc,
253
+ "score": score,
254
+ "matched_terms": sorted(matched[doc]),
255
+ "authority": "context_only",
256
+ }
257
+ for doc, score in ranked
258
+ ]
259
+ return {"mode": "bm25", "query": query, "hits": hits, "fetch_trace": self.resolver.trace(), "shards": shards}
260
+
261
+ def neighbors(self, node_cid: str, *, direction: str, limit: int) -> dict[str, Any]:
262
+ name = (
263
+ "graph_outgoing_adjacency"
264
+ if direction in {"out", "outgoing"}
265
+ else "graph_incoming_adjacency"
266
+ )
267
+ if direction in {"both"}:
268
+ left = self.neighbors(node_cid, direction="outgoing", limit=limit)
269
+ right = self.neighbors(node_cid, direction="incoming", limit=limit)
270
+ return {
271
+ "mode": "neighbors",
272
+ "node_cid": node_cid,
273
+ "outgoing": left.get("hits"),
274
+ "incoming": right.get("hits"),
275
+ "fetch_trace": self.resolver.trace(),
276
+ }
277
+ loc = self._locator(name)
278
+ pages = []
279
+ for row in self._covering(loc, node_cid):
280
+ table = self.resolver.parquet(str(row["relative_path"]), descriptor=row)
281
+ for rec in table.to_pylist():
282
+ if str(rec.get("node_cid")) != node_cid:
283
+ continue
284
+ pages.append(rec)
285
+ hits = []
286
+ for rec in pages:
287
+ neighbors = rec.get("neighbor_cids") or []
288
+ types = rec.get("edge_types") or []
289
+ methods = rec.get("retrieval_methods") or []
290
+ scores = rec.get("scores") or []
291
+ for i, neighbor in enumerate(neighbors[:limit]):
292
+ hits.append(
293
+ {
294
+ "neighbor_cid": neighbor,
295
+ "edge_type": types[i] if i < len(types) else "",
296
+ "retrieval_method": methods[i] if i < len(methods) else "",
297
+ "score": scores[i] if i < len(scores) else None,
298
+ }
299
+ )
300
+ if len(hits) >= limit:
301
+ break
302
+ return {
303
+ "mode": "neighbors",
304
+ "node_cid": node_cid,
305
+ "direction": direction,
306
+ "hits": hits[:limit],
307
+ "fetch_trace": self.resolver.trace(),
308
+ }
309
+
310
+ def walk(self, node_cid: str, *, max_depth: int, max_nodes: int, direction: str) -> dict[str, Any]:
311
+ seen = {node_cid}
312
+ frontier = [node_cid]
313
+ edges = []
314
+ depth = 0
315
+ while frontier and depth < max_depth and len(seen) < max_nodes:
316
+ nxt = []
317
+ for node in frontier:
318
+ page = self.neighbors(node, direction=direction if direction != "both" else "outgoing", limit=32)
319
+ for hit in page.get("hits") or []:
320
+ dst = str(hit.get("neighbor_cid") or "")
321
+ if not dst or dst in seen:
322
+ continue
323
+ seen.add(dst)
324
+ edges.append({"src": node, **hit})
325
+ nxt.append(dst)
326
+ if len(seen) >= max_nodes:
327
+ break
328
+ frontier = nxt
329
+ depth += 1
330
+ return {
331
+ "mode": "walk",
332
+ "seed": node_cid,
333
+ "nodes": sorted(seen),
334
+ "edges": edges,
335
+ "depth": depth,
336
+ "fetch_trace": self.resolver.trace(),
337
+ }
338
+
339
+
340
+ def _load_query_vector(text: str, model_name: str) -> list[float]:
341
+ from sentence_transformers import SentenceTransformer
342
+
343
+ model = SentenceTransformer(model_name)
344
+ vector = model.encode([text], normalize_embeddings=True)[0]
345
+ return [float(value) for value in vector]
346
+
347
+
348
+ def main(argv: Sequence[str] | None = None) -> int:
349
+ parser = argparse.ArgumentParser(description=__doc__)
350
+ parser.add_argument("--repo-id", default="")
351
+ parser.add_argument("--revision", default="")
352
+ parser.add_argument("--local-root", default="")
353
+ parser.add_argument("--manifest", default=DEFAULT_MANIFEST)
354
+ parser.add_argument("--cache-dir", default=str(DEFAULT_CACHE))
355
+ parser.add_argument("--json", action="store_true")
356
+ sub = parser.add_subparsers(dest="mode", required=True)
357
+ bm25 = sub.add_parser("bm25")
358
+ bm25.add_argument("query")
359
+ bm25.add_argument("--top-k", type=int, default=10)
360
+ vec = sub.add_parser("vector")
361
+ vec.add_argument("query")
362
+ vec.add_argument("--top-k", type=int, default=10)
363
+ vec.add_argument("--model", default="")
364
+ neigh = sub.add_parser("neighbors")
365
+ neigh.add_argument("node_cid")
366
+ neigh.add_argument("--direction", default="both")
367
+ neigh.add_argument("--limit", type=int, default=25)
368
+ walk = sub.add_parser("walk")
369
+ walk.add_argument("node_cid")
370
+ walk.add_argument("--direction", default="outgoing")
371
+ walk.add_argument("--max-depth", type=int, default=2)
372
+ walk.add_argument("--max-nodes", type=int, default=100)
373
+ args = parser.parse_args(argv)
374
+ local = Path(args.local_root).expanduser() if args.local_root else None
375
+ if local is None and not args.repo_id:
376
+ raise SystemExit("pass --local-root or --repo-id")
377
+ if args.repo_id and not args.revision:
378
+ raise SystemExit("remote queries require an immutable --revision pin")
379
+ resolver = ArtifactResolver(
380
+ repo_id=args.repo_id,
381
+ revision=args.revision,
382
+ token=os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN"),
383
+ cache_dir=Path(args.cache_dir),
384
+ local_root=local,
385
+ )
386
+ manifest = resolver.json(args.manifest)
387
+ client = ThinClient(resolver, manifest)
388
+ if args.mode == "bm25":
389
+ result = client.bm25(args.query, top_k=max(1, args.top_k))
390
+ elif args.mode == "neighbors":
391
+ result = client.neighbors(args.node_cid, direction=args.direction, limit=max(1, args.limit))
392
+ elif args.mode == "walk":
393
+ result = client.walk(
394
+ args.node_cid,
395
+ max_depth=max(1, args.max_depth),
396
+ max_nodes=max(1, args.max_nodes),
397
+ direction=args.direction,
398
+ )
399
+ else:
400
+ raise SystemExit("vector search in the standalone client needs --model; use neighbors/bm25 here")
401
+ print(json.dumps(result, indent=2, sort_keys=True))
402
+ return 0
403
+
404
+
405
+ if __name__ == "__main__":
406
+ raise SystemExit(main())
skill/query-hf-graphrag/SKILL.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: query-hf-graphrag
3
+ description: Query the CID-keyed ipfs_argentina_laws-ir GraphRAG release on Hugging Face with bounded BM25, centroid-routed vectors, adjacency neighbors, and graph walks. Use when an agent must retrieve lexical, semantic, or graph context without downloading the full corpus.
4
+ ---
5
+
6
+ # Query ipfs_argentina_laws-ir on Hugging Face
7
+
8
+ Use the bundled search script. It fetches only the manifest, compact locators,
9
+ matching posting/vector/adjacency shards, and corpus rows for final hits.
10
+
11
+ Repository: `justicedao/ipfs_argentina_laws-ir`. Primary key is `entry_cid`. Integer `document_index`
12
+ is a compact pointer, not an identity.
13
+
14
+ Research snapshot. Similarity edges cannot establish legal authority.
15
+
16
+ ## Choose retrieval
17
+
18
+ - `bm25` for citations, docket numbers, quoted terms, and exact names.
19
+ - `vector` for paraphrases and topical similarity.
20
+ - `neighbors` / `walk` after you have a `node_cid`.
21
+ - Merge BM25 and vector hits on `entry_cid`. Similarity edges (`BM25_NEIGHBOR_OF`, `EMBEDDING_NEIGHBOR_OF`, `contains_term`) are retrieval proposals only.
22
+
23
+ ## BM25
24
+
25
+ ```bash
26
+ python scripts/query_hf_graphrag.py \
27
+ --repo-id justicedao/ipfs_argentina_laws-ir \
28
+ --revision <pinned-commit> \
29
+ bm25 "clean air act section 111" --top-k 10
30
+ ```
31
+
32
+ Local checkout:
33
+
34
+ ```bash
35
+ python scripts/query_hf_graphrag.py --local-root . bm25 "clean air act section 111"
36
+ ```
37
+
38
+ Install `pyarrow` and `huggingface_hub`. Set `HF_TOKEN` for private datasets.
39
+ Always pin `--revision` for remote queries; never use `main`.
40
+
41
+ ## Neighbors and walks
42
+
43
+ ```bash
44
+ python scripts/query_hf_graphrag.py --local-root . neighbors <node-cid> --direction both --limit 25
45
+ python scripts/query_hf_graphrag.py --local-root . walk <node-cid> --max-depth 2 --max-nodes 100
46
+ ```
47
+
48
+ Inspect `fetch_trace`. A budget stop is a partial walk, not proof that no
49
+ further path exists. Treat hits as `context_only`.
50
+
51
+ Read [references/schema.md](references/schema.md) for locator and posting
52
+ contracts.
skill/query-hf-graphrag/agents/openai.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ interface:
2
+ display_name: "Query ipfs_argentina_laws-ir"
3
+ short_description: "Search the remote GraphRAG release"
4
+ default_prompt: "Use $query-hf-graphrag to search this Hugging Face GraphRAG release with BM25, vectors, or a bounded graph walk."
skill/query-hf-graphrag/references/schema.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GraphRAG remote release schema
2
+
3
+ `manifest.json` declares `primary_key` (`entry_cid`), BM25 constants, vector
4
+ layout, and compact index descriptors. Verify `sha256` / `cid` before parsing
5
+ a shard.
6
+
7
+ ## Identity
8
+
9
+ - `entry_cid`: CIDv1 primary identity.
10
+ - `document_index`: dense `0..N-1` pointer used only inside postings.
11
+ - Data shards are Zstandard Parquet with at most 4,096 rows.
12
+
13
+ ## BM25
14
+
15
+ `indexes/bm25_keyword_shards.parquet` maps inclusive `first_key`/`last_key`
16
+ term ranges to posting shards. Nested posting rows contain `term` plus aligned
17
+ `document_indices`, `document_lengths`, `title_frequencies`, `body_frequencies`,
18
+ and `idf`. Posting shards must be globally sorted by term with disjoint
19
+ ranges; a term never spans two shards. In-memory cells: `write_term_sorted_posting_shards`.
20
+ Already-dumped shards (any consumer): `pack_range_routed_family` at build time
21
+ or `repair_graphrag_range_routing` on a release root. Both use the same
22
+ resource-aware process pool. Exploded `(term, legal_id, tf)` shards remain readable.
23
+
24
+ ## Vectors
25
+
26
+ `indexes/vector_chunks.parquet` maps centroid groups to at most two physical
27
+ shards of 4,096 rows. Probe a few centroids, then exact-score inside those
28
+ shards.
29
+
30
+ ## Graph
31
+
32
+ `indexes/graph_outgoing_adjacency.parquet` and
33
+ `indexes/graph_incoming_adjacency.parquet` map `node_cid` ranges to paged
34
+ adjacency. Each page holds at most 4,096 pointers. Similarity neighbors cannot
35
+ establish legal authority.
skill/query-hf-graphrag/scripts/query_hf_graphrag.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from pathlib import Path
3
+ import runpy
4
+ ROOT = Path(__file__).resolve().parents[3]
5
+ for candidate in (
6
+ ROOT / "scripts" / "query_hf_graphrag.py",
7
+ ROOT / "scripts" / "query_hf_graphrag.py",
8
+ ):
9
+ if candidate.is_file():
10
+ runpy.run_path(str(candidate), run_name="__main__")
11
+ break
12
+ else:
13
+ raise SystemExit("GraphRAG query client is missing from this release")