jblarson3 commited on
Commit
a5f6536
·
verified ·
1 Parent(s): c7cc846

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +204 -3
README.md CHANGED
@@ -1,3 +1,204 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - knowledge-graph
5
+ - wiki-data
6
+ - wikipedia
7
+ language:
8
+ - en
9
+
10
+ pretty_name: GetNID — Neurofold Identity Registry v1.0
11
+ size_categories:
12
+ - 1M<n<10M
13
+ ---
14
+ ```
15
+ # GetNID — Neurofold Identity Registry v1.0
16
+
17
+ **A deterministic, cryptographically-immutable identifier registry for 6.7 million Wikipedia concepts.**
18
+
19
+ GetNID mints a canonical **Neurofold ID (NID)** for every resolved Wikipedia article, bridging human-readable titles and Wikidata QIDs through a trustless, serverless resolution protocol. The registry is designed to function as foundational namespace infrastructure for decentralized knowledge systems.
20
+
21
+ ---
22
+
23
+ ## What is a NID?
24
+
25
+ A Neurofold ID is a deterministic 13-character identifier derived directly from the SHA-256 hash of a concept's Wikidata QID.
26
+
27
+ ```
28
+ "Mathematics" → Q395 → N5336CE94E17E
29
+ "Albert Einstein" → Q937 → N6F2A8C14B301
30
+ ```
31
+
32
+ NIDs are **permanent**, **content-addressed**, and **collision-resistant**. They require no central authority to issue or resolve.
33
+
34
+ ---
35
+
36
+ ## Resolution Architecture
37
+
38
+ The registry implements a **double-sharding scheme** for O(1) lookup with no index scans, no search, and no server-side compute.
39
+
40
+ ```
41
+ Title lookup (double-hop):
42
+ sha256(normalize(title))[:2] % 256 → router shard → NID
43
+ NID[1:5] % 8192 → data shard → record
44
+
45
+ QID / NID lookup (single-hop):
46
+ sha256(QID)[:4] % 8192 → data shard → record
47
+ NID[1:5] % 8192 → data shard → record
48
+ ```
49
+
50
+ | Layer | Shards | Purpose |
51
+ |---|---|---|
52
+ | Data shards | 8,192 | `ledger(nid, qid, title, lang)` |
53
+ | Router shards | 256 | `routes(key_hash, target_nid)` |
54
+
55
+ All shards are static SQLite files (~100KB each). The full registry is ~1.5GB. Every shard is independently verifiable against a cryptographic `manifest.json` generated at genesis time.
56
+
57
+ ---
58
+
59
+ ## Live Demo
60
+
61
+ **[getnid.org](https://getnid.org)** — resolve any Wikipedia title, QID, or NID in the browser.
62
+
63
+ Resolution runs entirely client-side via a Web Worker using sql.js (SQLite compiled to WebAssembly). Resolved shards are cached locally via the browser's **Origin Private File System (OPFS)**, enabling zero-latency offline resolution after first access. Users can opt into a full global sync to permanently mirror the entire registry locally.
64
+
65
+ ---
66
+
67
+ ## Dataset Structure
68
+
69
+ ```
70
+ v1/
71
+ ├── manifest.json # SHA-256 hash of every shard (trustless verification)
72
+ ├── meta.json # Version, genesis timestamp, master checksum, metrics
73
+ ├── shards/
74
+ │ ├── shard_0000.db # SQLite — ledger table
75
+ │ ├── shard_0001.db
76
+ │ └── ... (8,192 total)
77
+ └── routers/
78
+ ├── router_000.db # SQLite — routes table
79
+ ├── router_001.db
80
+ └── ... (256 total)
81
+ ```
82
+
83
+ ### `ledger` schema (data shards)
84
+ ```sql
85
+ CREATE TABLE ledger (
86
+ nid TEXT PRIMARY KEY, -- e.g. N5336CE94E17E
87
+ qid TEXT UNIQUE, -- e.g. Q395
88
+ title TEXT, -- e.g. Mathematics
89
+ lang TEXT -- e.g. en
90
+ );
91
+ ```
92
+
93
+ ### `routes` schema (router shards)
94
+ ```sql
95
+ CREATE TABLE routes (
96
+ key_hash TEXT PRIMARY KEY, -- sha256(norm_title)[:16]
97
+ shard_id INTEGER,
98
+ norm_title TEXT,
99
+ target_nid TEXT
100
+ );
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Usage
106
+
107
+ ### Python (local resolution)
108
+
109
+ ```python
110
+ from getnid.registry import LocalRegistryClient
111
+ from pathlib import Path
112
+
113
+ client = LocalRegistryClient(Path("./v1"))
114
+
115
+ # Resolve by title
116
+ client.get_by_title("Mathematics")
117
+ # → {"nid": "N5336CE94E17E", "qid": "Q395", "title": "Mathematics", "lang": "en"}
118
+
119
+ # Resolve by QID
120
+ client.get_by_qid("Q42")
121
+ # → {"nid": "N...", "qid": "Q42", "title": "Douglas Adams", "lang": "en"}
122
+
123
+ # Resolve by NID
124
+ client.get_by_nid("N5336CE94E17E")
125
+ # → {"nid": "N5336CE94E17E", "qid": "Q395", "title": "Mathematics", "lang": "en"}
126
+ ```
127
+
128
+ ### Direct shard query (any language)
129
+
130
+ ```python
131
+ import hashlib, sqlite3
132
+
133
+ def resolve_qid(qid: str, shard_dir: str) -> dict:
134
+ h = hashlib.sha256(qid.upper().encode()).hexdigest().upper()
135
+ shard_id = int(h[:4], 16) % 8192
136
+ db_path = f"{shard_dir}/shard_{shard_id:04d}.db"
137
+ with sqlite3.connect(db_path) as conn:
138
+ row = conn.execute(
139
+ "SELECT nid, qid, title, lang FROM ledger WHERE qid = ?",
140
+ (qid.upper(),)
141
+ ).fetchone()
142
+ return dict(zip(["nid", "qid", "title", "lang"], row)) if row else None
143
+ ```
144
+
145
+ ### JavaScript / Browser
146
+
147
+ ```javascript
148
+ const sha256 = async (text) => {
149
+ const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text));
150
+ return Array.from(new Uint8Array(buf)).map(b => b.toString(16).padStart(2,'0')).join('').toUpperCase();
151
+ };
152
+
153
+ async function resolveQID(qid) {
154
+ const hash = await sha256(qid.toUpperCase());
155
+ const shardId = parseInt(hash.slice(0, 4), 16) % 8192;
156
+ const fileName = `shard_${String(shardId).padStart(4,'0')}.db`;
157
+ // Fetch shard, query with sql.js
158
+ }
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Metrics
164
+
165
+ | Metric | Value |
166
+ |---|---|
167
+ | Minted NIDs | ~6.7M |
168
+ | Languages | en (v1.0) |
169
+ | Data shards | 8,192 |
170
+ | Router shards | 256 |
171
+ | Avg shard size | ~100 KB |
172
+ | Total payload | ~1.5 GB |
173
+ | Lookup complexity | O(1) |
174
+
175
+ ---
176
+
177
+ ## Licensing
178
+
179
+ | Component | License |
180
+ |---|---|
181
+ | Registry code & protocol | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) |
182
+ | Ledger data (derived from Wikidata) | [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) |
183
+
184
+ Wikidata content is made available by the Wikimedia Foundation under CC BY-SA 4.0. Use of the registry data is subject to those upstream terms.
185
+
186
+ ---
187
+
188
+ ## Repository
189
+
190
+ [github.com/neurofold/getnid](https://github.com/neurofold/getnid)
191
+
192
+ ---
193
+
194
+ ## Citation
195
+
196
+ ```bibtex
197
+ @misc{getnid2026,
198
+ author = {Larson, JB},
199
+ title = {GetNID: Neurofold Identity Registry v1.0},
200
+ year = {2026},
201
+ url = {https://huggingface.co/datasets/Neurofold/getnid},
202
+ note = {Deterministic identifier registry for 6.7M Wikipedia concepts}
203
+ }
204
+ ```