# 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} } ```