File size: 3,378 Bytes
25a3f03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# YAGO 4.5 Dataset (English subset for LLM fine-tuning)

## Dataset Description
This datasets contains triples filtered from yago-facts.ttl and
yago-beyond-wikipedia.ttl in the YAGO 4.5 dataset. The SPARQL query
used to filter the triples is in `raw/filter.sparql`. This represents
a subset of the YAGO 4.5 dataset maintaining only English labels. 

I remapped some schema.org URIs to use the
`http://yago-knowledge.org/resource/` which were not present in the
schema.org vocabulary.  I also removed schema:sameAs and owl:sameAs
relations from this dataset, as well as triples with xsd:anyURI object
literals, as my goal is to use this dataset for fine-tuning a large
language model for knowledge graph completion and I do not want
to train the base model to predict these kind of relations.

### Overview

YAGO 4.5 is the latest version of the YAGO knowledge base. It is
based on Wikidata — the largest public general-purpose knowledge
base. YAGO refines the data as follows:

* All entity identifiers and property identifiers are human-readable.
* The top-level classes come from schema.org — a standard repertoire
  of classes and properties maintained by Google and others. The lower
  level classes are a careful selection of the Wikidata taxonomy.
* The properties come from schema.org.
* YAGO 4.5 contains semantic constraints in the form of SHACL. These
  constraints keep the data clean, and allow for logical reasoning on
  YAGO. 


### Dataset Structure
The dataset is structured as follows:

- **raw/yago-taxonomy.ttl:** Contains the `rdfs:subClassOf` relations
  for YAGO and the prefix mappings for the N-Triples.
- **raw/facts.tar.gz:** Compressed file containing chunks of the
  dataset in N-Triples format, representing the factual knowledge in
  YAGO. 

### Features

Each RDF triple in the dataset is represented with the following features:

- **subject:** The subject of the triple, representing the entity.
- **predicate:** The predicate of the triple, representing the
  relationship between the subject and object.
- **object:** The object of the triple, representing the entity or
  value linked by the predicate.

### Splits

The dataset is logically divided into multiple chunks, each containing
a subset of RDF triples. Users can load specific chunks or the entire
dataset based on their requirements.

## Usage

### Loading the Dataset

The dataset can be loaded using the Hugging Face `datasets` library as follows:

```python
from datasets import load_dataset

dataset = load_dataset('wikipunk/yago-4.5-en', num_proc=4)
```

### Accessing the YAGO Taxonomy File

The `yago-taxonomy.ttl` file can be accessed and loaded in every process as follows:

```python
from rdflib import Graph

taxonomy_graph = Graph()
taxonomy_graph.parse('raw/yago-taxonomy.ttl', format='turtle') 
```

## Additional Information

### Licensing

The YAGO 4.5 dataset is available under the [Creative Commons Attribution-ShareAlike 3.0 license](https://creativecommons.org/licenses/by-sa/3.0/).

### Citation

If you use the YAGO 4.5 dataset in your work, please cite the
following publication:

```bibtex
@article{suchanek2023integrating,
  title={Integrating the Wikidata Taxonomy into YAGO},
  author={Suchanek, Fabian M and Alam, Mehwish and Bonald, Thomas and Paris, Pierre-Henri and Soria, Jules},
  journal={arXiv preprint arXiv:2308.11884},
  year={2023}
}
```