File size: 3,906 Bytes
994bf99
 
 
69c4dca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---

license: cc0-1.0
---


# Wikidata Extraction

This dataset contains all RDF triples extracted from the latest Wikidata, converted from the N-Triples format to Parquet.

The data originates from [Wikidata](https://www.wikidata.org/), a free and open knowledge base that acts as central storage for structured data used by Wikipedia and other Wikimedia projects. The source file is the "truthy" N-Triples dump (`latest-truthy.nt.bz2`), which contains only the current, non-deprecated statements.

The code to extract this data is available at [github.com/piebro/wikidata-extraction](https://github.com/piebro/wikidata-extraction).

## Schema

Each row represents a single RDF triple with four columns:

| Column      | Type   | Description                                                        |
|-------------|--------|--------------------------------------------------------------------|
| `subject`   | string | The entity being described (typically a Wikidata Q-ID URL)         |
| `predicate` | string | The property or relationship (typically a Wikidata P-ID URL)       |
| `object`    | string | The value, which can be another entity, literal, or external ID    |
| `language`  | string | Language tag for literals (e.g., "en", "de"), null otherwise       |

### Example Values

```

subject:   http://www.wikidata.org/entity/Q42

predicate: http://www.w3.org/2000/01/rdf-schema#label

object:    Douglas Adams

language:  en

```

This triple means: "Q42 (Douglas Adams) has the English label 'Douglas Adams'".

```

subject:   http://www.wikidata.org/entity/Q42

predicate: http://www.wikidata.org/prop/direct/P31

object:    http://www.wikidata.org/entity/Q5

language:  null

```

This triple means: "Q42 (Douglas Adams) is an instance of (P31) Q5 (human)". The language is null because the object is a URI, not a language-tagged literal.

## Data Organization

### Triplets

The `triplets/` folder contains the raw RDF triples partitioned into Parquet files (`triplets/*.parquet`).

### Extractions

The `extractions/` folder contains extracted lookup tables and themed datasets:

| File | Description |
|------|-------------|
| `entity_labels.parquet` | Maps entities to their labels |
| `predicate_labels.parquet` | Maps predicates to their labels and descriptions |
| `music/spotify_artist.parquet` | Spotify artist data |
| `music/spotify_album.parquet` | Spotify album data |
| `music/spotify_track.parquet` | Spotify track data |
| `video/youtube_channel.parquet` | YouTube channel data |
| `video/youtube_video.parquet` | YouTube video data |
| `video/letterboxd_film.parquet` | Letterboxd film data |
| `social/bluesky.parquet` | Bluesky account data |
| `social/subreddit.parquet` | Subreddit data |
| `social/patreon.parquet` | Patreon creator data |
| `book/goodread_book.parquet` | Goodreads book data |
| `book/gutenberg_book.parquet` | Project Gutenberg book data |
| `other/github.parquet` | GitHub repository data |
| `other/website.parquet` | Website data |
| `other/non_profit_organization.parquet` | Non-profit organization data |

## Usage

Query the dataset using any Parquet-compatible tool (DuckDB, Pandas, Polars, etc.):

### Find All Properties of an Entity

```python

import duckdb



df = duckdb.sql("""

    SELECT *

    FROM 'triplets/*.parquet'

    WHERE subject = 'http://www.wikidata.org/entity/Q42'

""").df()

print(df)

```

### Look Up Entity Labels

```python

import duckdb



entity_ids = ["Q42", "Q5", "Q64"]

entity_uris = [f"http://www.wikidata.org/entity/{e}" for e in entity_ids]



df = duckdb.sql(f"""

    SELECT entity, label

    FROM 'extractions/entity_labels.parquet'

    WHERE entity IN {tuple(entity_uris)}

""").df()

print(df)

```

## License

Wikidata content is available under [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/).