Datasets:
update readme
Browse files- .gitattributes +1 -0
- README.md +99 -3
- {datasets → raw}/facts.tar.gz +0 -0
- raw/filter.sparql +90 -0
- raw/yago-taxonomy.ttl +3 -0
.gitattributes
CHANGED
@@ -53,3 +53,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
raw/yago-taxonomy.ttl filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,99 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# YAGO 4.5 Dataset (English subset for LLM fine-tuning)
|
2 |
+
|
3 |
+
## Dataset Description
|
4 |
+
This datasets contains triples filtered from yago-facts.ttl and
|
5 |
+
yago-beyond-wikipedia.ttl in the YAGO 4.5 dataset. The SPARQL query
|
6 |
+
used to filter the triples is in `raw/filter.sparql`. This represents
|
7 |
+
a subset of the YAGO 4.5 dataset maintaining only English labels.
|
8 |
+
|
9 |
+
I remapped some schema.org URIs to use the
|
10 |
+
`http://yago-knowledge.org/resource/` which were not present in the
|
11 |
+
schema.org vocabulary. I also removed schema:sameAs and owl:sameAs
|
12 |
+
relations from this dataset, as well as triples with xsd:anyURI object
|
13 |
+
literals, as my goal is to use this dataset for fine-tuning a large
|
14 |
+
language model for knowledge graph completion and I do not want
|
15 |
+
to train the base model to predict these kind of relations.
|
16 |
+
|
17 |
+
### Overview
|
18 |
+
|
19 |
+
YAGO 4.5 is the latest version of the YAGO knowledge base. It is
|
20 |
+
based on Wikidata — the largest public general-purpose knowledge
|
21 |
+
base. YAGO refines the data as follows:
|
22 |
+
|
23 |
+
* All entity identifiers and property identifiers are human-readable.
|
24 |
+
* The top-level classes come from schema.org — a standard repertoire
|
25 |
+
of classes and properties maintained by Google and others. The lower
|
26 |
+
level classes are a careful selection of the Wikidata taxonomy.
|
27 |
+
* The properties come from schema.org.
|
28 |
+
* YAGO 4.5 contains semantic constraints in the form of SHACL. These
|
29 |
+
constraints keep the data clean, and allow for logical reasoning on
|
30 |
+
YAGO.
|
31 |
+
|
32 |
+
|
33 |
+
### Dataset Structure
|
34 |
+
The dataset is structured as follows:
|
35 |
+
|
36 |
+
- **raw/yago-taxonomy.ttl:** Contains the `rdfs:subClassOf` relations
|
37 |
+
for YAGO and the prefix mappings for the N-Triples.
|
38 |
+
- **raw/facts.tar.gz:** Compressed file containing chunks of the
|
39 |
+
dataset in N-Triples format, representing the factual knowledge in
|
40 |
+
YAGO.
|
41 |
+
|
42 |
+
### Features
|
43 |
+
|
44 |
+
Each RDF triple in the dataset is represented with the following features:
|
45 |
+
|
46 |
+
- **subject:** The subject of the triple, representing the entity.
|
47 |
+
- **predicate:** The predicate of the triple, representing the
|
48 |
+
relationship between the subject and object.
|
49 |
+
- **object:** The object of the triple, representing the entity or
|
50 |
+
value linked by the predicate.
|
51 |
+
|
52 |
+
### Splits
|
53 |
+
|
54 |
+
The dataset is logically divided into multiple chunks, each containing
|
55 |
+
a subset of RDF triples. Users can load specific chunks or the entire
|
56 |
+
dataset based on their requirements.
|
57 |
+
|
58 |
+
## Usage
|
59 |
+
|
60 |
+
### Loading the Dataset
|
61 |
+
|
62 |
+
The dataset can be loaded using the Hugging Face `datasets` library as follows:
|
63 |
+
|
64 |
+
```python
|
65 |
+
from datasets import load_dataset
|
66 |
+
|
67 |
+
dataset = load_dataset('wikipunk/yago-4.5-en', num_proc=4)
|
68 |
+
```
|
69 |
+
|
70 |
+
### Accessing the YAGO Taxonomy File
|
71 |
+
|
72 |
+
The `yago-taxonomy.ttl` file can be accessed and loaded in every process as follows:
|
73 |
+
|
74 |
+
```python
|
75 |
+
from rdflib import Graph
|
76 |
+
|
77 |
+
taxonomy_graph = Graph()
|
78 |
+
taxonomy_graph.parse('raw/yago-taxonomy.ttl', format='turtle')
|
79 |
+
```
|
80 |
+
|
81 |
+
## Additional Information
|
82 |
+
|
83 |
+
### Licensing
|
84 |
+
|
85 |
+
The YAGO 4.5 dataset is available under the [Creative Commons Attribution-ShareAlike 3.0 license](https://creativecommons.org/licenses/by-sa/3.0/).
|
86 |
+
|
87 |
+
### Citation
|
88 |
+
|
89 |
+
If you use the YAGO 4.5 dataset in your work, please cite the
|
90 |
+
following publication:
|
91 |
+
|
92 |
+
```bibtex
|
93 |
+
@article{suchanek2023integrating,
|
94 |
+
title={Integrating the Wikidata Taxonomy into YAGO},
|
95 |
+
author={Suchanek, Fabian M and Alam, Mehwish and Bonald, Thomas and Paris, Pierre-Henri and Soria, Jules},
|
96 |
+
journal={arXiv preprint arXiv:2308.11884},
|
97 |
+
year={2023}
|
98 |
+
}
|
99 |
+
```
|
{datasets → raw}/facts.tar.gz
RENAMED
File without changes
|
raw/filter.sparql
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PREFIX yago: <http://yago-knowledge.org/resource/>
|
2 |
+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
3 |
+
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
4 |
+
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
|
5 |
+
PREFIX dct: <http://purl.org/dc/terms/>
|
6 |
+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
7 |
+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
|
8 |
+
PREFIX wikibase: <http://wikiba.se/ontology#>
|
9 |
+
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
10 |
+
PREFIX schema: <http://schema.org/>
|
11 |
+
PREFIX cc: <http://creativecommons.org/ns#>
|
12 |
+
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
|
13 |
+
PREFIX prov: <http://www.w3.org/ns/prov#>
|
14 |
+
PREFIX wd: <http://www.wikidata.org/entity/>
|
15 |
+
PREFIX data: <https://www.wikidata.org/wiki/Special:EntityData/>
|
16 |
+
PREFIX sh: <http://www.w3.org/ns/shacl#>
|
17 |
+
PREFIX s: <http://www.wikidata.org/entity/statement/>
|
18 |
+
PREFIX ref: <http://www.wikidata.org/reference/>
|
19 |
+
PREFIX v: <http://www.wikidata.org/value/>
|
20 |
+
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
|
21 |
+
PREFIX wpq: <http://www.wikidata.org/prop/quant/>
|
22 |
+
PREFIX wdtn: <http://www.wikidata.org/prop/direct-normalized/>
|
23 |
+
PREFIX p: <http://www.wikidata.org/prop/>
|
24 |
+
PREFIX ps: <http://www.wikidata.org/prop/statement/>
|
25 |
+
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
|
26 |
+
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
|
27 |
+
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
|
28 |
+
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
|
29 |
+
PREFIX pqn: <http://www.wikidata.org/prop/qualifier/value-normalized/>
|
30 |
+
PREFIX pr: <http://www.wikidata.org/prop/reference/>
|
31 |
+
PREFIX prv: <http://www.wikidata.org/prop/reference/value/>
|
32 |
+
PREFIX prn: <http://www.wikidata.org/prop/reference/value-normalized/>
|
33 |
+
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
|
34 |
+
PREFIX ys: <http://yago-knowledge.org/schema#>
|
35 |
+
|
36 |
+
CONSTRUCT {
|
37 |
+
?s ?newp ?o .
|
38 |
+
}
|
39 |
+
WHERE {
|
40 |
+
?s ?p ?originalO .
|
41 |
+
|
42 |
+
# Transforming the predicates to a new namespace where applicable
|
43 |
+
BIND(
|
44 |
+
IF(?p IN (
|
45 |
+
schema:administrates,
|
46 |
+
schema:demonym,
|
47 |
+
schema:highestPoint,
|
48 |
+
schema:humanDevelopmentIndex,
|
49 |
+
schema:influencedBy,
|
50 |
+
schema:leader,
|
51 |
+
schema:lowestPoint,
|
52 |
+
schema:motto,
|
53 |
+
schema:neighbors,
|
54 |
+
schema:officialLanguage,
|
55 |
+
schema:ownedBy,
|
56 |
+
schema:populationNumber,
|
57 |
+
schema:unemploymentRate
|
58 |
+
), URI(REPLACE(STR(?p), "http://schema.org/", "http://yago-knowledge.org/resource/")), ?p)
|
59 |
+
AS ?newp
|
60 |
+
)
|
61 |
+
|
62 |
+
# Transforming negative xsd:dateTime to xsd:dateTimeStamp
|
63 |
+
BIND(
|
64 |
+
IF(datatype(?originalO) = xsd:dateTime && STRSTARTS(STR(?originalO), "-"),
|
65 |
+
STRDT(STR(?originalO), xsd:dateTimeStamp),
|
66 |
+
?originalO)
|
67 |
+
AS ?o
|
68 |
+
)
|
69 |
+
|
70 |
+
# Filtering out non-English literals and xsd:anyURI literals
|
71 |
+
FILTER (
|
72 |
+
!(
|
73 |
+
isLiteral(?o) &&
|
74 |
+
(
|
75 |
+
lang(?o) != "" &&
|
76 |
+
!(
|
77 |
+
langMatches(lang(?o), "en") &&
|
78 |
+
lang(?o) != "en-gb" &&
|
79 |
+
lang(?o) != "en-ca"
|
80 |
+
) ||
|
81 |
+
datatype(?o) = xsd:anyURI ||
|
82 |
+
(?p = rdfs:label && str(?o) = "Generic instance")
|
83 |
+
)
|
84 |
+
)
|
85 |
+
)
|
86 |
+
|
87 |
+
# Excluding specific predicates
|
88 |
+
FILTER (?p != schema:sameAs)
|
89 |
+
FILTER (?p != owl:sameAs)
|
90 |
+
}
|
raw/yago-taxonomy.ttl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5515105ca9d414968aa53046428b16203577f00b24795fbce1b3deba7c3bfd8a
|
3 |
+
size 13200375
|