Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,89 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Below is a sample README you can adapt for your Hugging Face repository. Feel free to modify the text or structure to suit your needs!
|
2 |
+
|
3 |
+
---
|
4 |
+
|
5 |
+
# Wikidata 2018-12-17 JSON Dump
|
6 |
+
|
7 |
+
This repository hosts a 2018 snapshot of the Wikidata JSON dump. The dataset was originally found on [Zenodo (Record #4436356)](https://zenodo.org/record/4436356).
|
8 |
+
|
9 |
+
## Dataset Description
|
10 |
+
|
11 |
+
- **Source**: [Wikidata](https://www.wikidata.org/) — Wikidata is a free and open knowledge base that can be read and edited by both humans and machines.
|
12 |
+
- **Date of Dump**: 2018-12-17
|
13 |
+
- **Size**: ~ (size in GB)
|
14 |
+
- **File Format**: `.json.gz` (gzipped JSON).
|
15 |
+
- This file contains a top-level JSON array, with each element representing a single Wikidata entity.
|
16 |
+
|
17 |
+
### License
|
18 |
+
|
19 |
+
Wikidata’s data is published under the [Creative Commons CC0 1.0 Universal Public Domain Dedication (CC0)](https://creativecommons.org/publicdomain/zero/1.0/). You can use this dataset freely for any purpose without copyright restriction. However, attribution to [Wikidata](https://www.wikidata.org/) is strongly encouraged as a best practice.
|
20 |
+
|
21 |
+
**Important**: Some associated media, such as images referenced within Wikidata items, may be under different licenses. The JSON data itself is CC0.
|
22 |
+
|
23 |
+
## How to Cite
|
24 |
+
|
25 |
+
If you use this dataset in your work, please cite:
|
26 |
+
|
27 |
+
- **Wikidata**:
|
28 |
+
```
|
29 |
+
Wikidata contributors. (2018). Wikidata (CC0 1.0 Universal).
|
30 |
+
Retrieved from https://www.wikidata.org/
|
31 |
+
```
|
32 |
+
- **Original Zenodo Record** (optional):
|
33 |
+
```
|
34 |
+
Wikidata JSON dumps. Zenodo.
|
35 |
+
https://zenodo.org/record/4436356
|
36 |
+
```
|
37 |
+
|
38 |
+
## How to Use
|
39 |
+
|
40 |
+
This dump is ready to use. It’s stored as a gzipped JSON array where each array element is a single Wikidata entity.
|
41 |
+
|
42 |
+
### Example: Python Code to Stream the JSON
|
43 |
+
|
44 |
+
Below is a sample script showing how to read the dump without fully decompressing it on disk. This uses the [ijson](https://pypi.org/project/ijson/) library for iterative JSON parsing.
|
45 |
+
|
46 |
+
```python
|
47 |
+
import gzip
|
48 |
+
import ijson
|
49 |
+
|
50 |
+
def stream_wikidata_array(gz_file_path):
|
51 |
+
"""
|
52 |
+
Streams each element from a top-level array in the gzipped JSON.
|
53 |
+
Yields Python dicts (or lists), one for each array element.
|
54 |
+
"""
|
55 |
+
with gzip.open(gz_file_path, 'rb') as f:
|
56 |
+
# 'item' means "each element of the array"
|
57 |
+
for element in ijson.items(f, 'item'):
|
58 |
+
yield element
|
59 |
+
|
60 |
+
if __name__ == "__main__":
|
61 |
+
# Replace with the path to your Wikidata dump
|
62 |
+
wikidata_path = r"E:\wikidata\20181217.json.gz"
|
63 |
+
|
64 |
+
# Just print the first few records
|
65 |
+
max_to_print = 5
|
66 |
+
for i, record in enumerate(stream_wikidata_array(wikidata_path), start=1):
|
67 |
+
print(f"Record #{i}:")
|
68 |
+
print(record)
|
69 |
+
|
70 |
+
if i >= max_to_print:
|
71 |
+
print("...stopping here.")
|
72 |
+
break
|
73 |
+
```
|
74 |
+
|
75 |
+
You can adapt this approach to load the data into your own workflow, whether that’s local analysis, a database import, or a big data pipeline.
|
76 |
+
|
77 |
+
## Disclaimer
|
78 |
+
|
79 |
+
- This snapshot is from 2018 and **will not** be up-to-date with the current Wikidata database.
|
80 |
+
- This repository and uploader are not affiliated with the Wikimedia Foundation or the official Wikidata project beyond using their data.
|
81 |
+
- Please ensure you comply with any relevant data protection or privacy regulations when using this dataset in production.
|
82 |
+
|
83 |
+
---
|
84 |
+
|
85 |
+
*Thank you for your interest in Wikidata and open knowledge!*
|
86 |
+
|
87 |
+
---
|
88 |
+
license: cc-by-4.0
|
89 |
+
---
|