logo Netzschleuder network catalog, repository, and centrifuge

History of tkgl_smallpedia

The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.

[entries] Add the date when each entry was added, and remove icon_hash by Tiago de Paula Peixoto beff7c9
The dates are those of the commits that first added the entries' files
(2020-08-11 for the entries of the initial commit); renamed entries keep
the date of their first name.

Changed: none
diff --git a/entries/tkgl_smallpedia/__init__.py b/entries/tkgl_smallpedia/__init__.py
index 67f174c..3fc738e 100644
--- a/entries/tkgl_smallpedia/__init__.py
+++ b/entries/tkgl_smallpedia/__init__.py
@@ -41,7 +41,7 @@ url = ['https://tgb.complexdatalab.com/docs/tkg/',
        'https://github.com/shenyangHuang/TGB']
 citation = [('J. Gastinger, S. Huang, M. Galkin, E. Loghmani, A. Parviz, F. Poursafaei, J. Danovitch, E. Rossi, I. Koutis, H. Stuckenschmidt, R. Rabbany, G. Rabusseau, "TGB 2.0: A Benchmark for Learning on Temporal Knowledge Graphs and Heterogeneous Graphs." Advances in Neural Information Processing Systems 37 (Datasets and Benchmarks Track) (2024)', 'https://doi.org/10.48550/arXiv.2406.09639'),
             ('D. Vrandečić, M. Krötzsch, "Wikidata: a free collaborative knowledgebase." Communications of the ACM 57(10), 78-85 (2014)', 'https://doi.org/10.1145/2629489')]
-icon_hash = None
+date_added = '2026-10-27'
 upstream_license = ('CC0 1.0 (Wikidata)', 'https://www.wikidata.org/wiki/Wikidata:Licensing')
 upstream_prefix = 'https://object-arbutus.alliancecan.ca/swift/v1/14c95234f6cd4a21a47deafe20cce2a7/tgb'
 files = [('tkgl-smallpedia.zip:tkgl-smallpedia_edgelist.csv', 'temporal', None),
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto bc3dbbd
The lists of properties at the end of the descriptions marked edge
properties with "Edge" but left node properties unmarked, or grouped
them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property
was often unclear. Every item now starts with (Node), (Edge) or (Graph),
followed by the property names, a colon and the explanation, one item
per property or group of properties; qualifications (kinds of nodes,
networks) follow the names in parentheses. Properties that were only
named got a short explanation, and a few items that named the wrong
kind of property were corrected.
diff --git a/entries/tkgl_smallpedia/__init__.py b/entries/tkgl_smallpedia/__init__.py
index a0834cb..67f174c 100644
--- a/entries/tkgl_smallpedia/__init__.py
+++ b/entries/tkgl_smallpedia/__init__.py
@@ -33,9 +33,9 @@ The data do not include the labels of the entities and relations, which can be l
 
 The networks have the following properties:
 
-- `wikidata_id`: the Wikidata identifier of the entity, e.g. `Q648`.
-- Edge `relation`: the Wikidata property of the statement, e.g. `P166`.
-- Edge `year` (`temporal` only): the year of the statement."""
+- (Node) `wikidata_id`: the Wikidata identifier of the entity, e.g. `Q648`.
+- (Edge) `relation`: the Wikidata property of the statement, e.g. `P166`.
+- (Edge) `year` (`temporal` only): the year of the statement."""
 tags = ['Informational', 'Relatedness', 'Unweighted', 'Multigraph', 'Timestamps', 'Metadata']
 url = ['https://tgb.complexdatalab.com/docs/tkg/',
        'https://github.com/shenyangHuang/TGB']
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 2c69f19
Unneeded "global files" statements, unused imports and variables,
f-strings without placeholders, duplicate keys in foodweb_little_rock
(keeping the order and the values used), and the second definition of
get_lines() in twitter_higgs. Nothing changes in the networks or
descriptions.

Changed: none
diff --git a/entries/tkgl_smallpedia/__init__.py b/entries/tkgl_smallpedia/__init__.py
index b2de147..a0834cb 100644
--- a/entries/tkgl_smallpedia/__init__.py
+++ b/entries/tkgl_smallpedia/__init__.py
@@ -55,7 +55,6 @@ def fetch_upstream(force=False):
 @coerce_props()
 @annotate()
 def parse(alts=None):
-    global files
     name = __name__.split(".")[-1]
     for fname, alt, fmt in files:
         if alts is not None and alt not in alts:
[entries] New entry: tkgl_smallpedia by Tiago de Paula Peixoto a946b00
diff --git a/entries/tkgl_smallpedia/__init__.py b/entries/tkgl_smallpedia/__init__.py
new file mode 100644
index 0000000..b2de147
--- /dev/null
+++ b/entries/tkgl_smallpedia/__init__.py
@@ -0,0 +1,77 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+
+import pandas
+
+from .. import *
+
+
+title = "Wikidata temporal knowledge graph, small subset (tkgl-smallpedia, TGB 2.0)"
+description = """A temporal knowledge graph extracted from Wikidata, from the `tkgl-smallpedia` dataset of the Temporal Graph Benchmark (TGB 2.0): the statements between the Wikidata entities with identifiers below one million (i.e. Q1 to Q999999) that are paired with Wikipedia pages. Each node is an entity of Wikidata, and a directed edge from entity A to entity B is a statement (A, relation, B), with a Wikidata property as relation (e.g. `P166`, "award received", or `P54`, "member of sports team"). Pairs of entities may be connected by several edges.
+
+- `temporal`: the statements with a time (a point in time, or the start of a period), as a year from 1900 to 2024.
+- `static`: the statements of the same entities without a time; the statements that are also temporal ones were removed by TGB.
+
+The data do not include the labels of the entities and relations, which can be looked up in Wikidata.
+
+The networks have the following properties:
+
+- `wikidata_id`: the Wikidata identifier of the entity, e.g. `Q648`.
+- Edge `relation`: the Wikidata property of the statement, e.g. `P166`.
+- Edge `year` (`temporal` only): the year of the statement."""
+tags = ['Informational', 'Relatedness', 'Unweighted', 'Multigraph', 'Timestamps', 'Metadata']
+url = ['https://tgb.complexdatalab.com/docs/tkg/',
+       'https://github.com/shenyangHuang/TGB']
+citation = [('J. Gastinger, S. Huang, M. Galkin, E. Loghmani, A. Parviz, F. Poursafaei, J. Danovitch, E. Rossi, I. Koutis, H. Stuckenschmidt, R. Rabbany, G. Rabusseau, "TGB 2.0: A Benchmark for Learning on Temporal Knowledge Graphs and Heterogeneous Graphs." Advances in Neural Information Processing Systems 37 (Datasets and Benchmarks Track) (2024)', 'https://doi.org/10.48550/arXiv.2406.09639'),
+            ('D. Vrandečić, M. Krötzsch, "Wikidata: a free collaborative knowledgebase." Communications of the ACM 57(10), 78-85 (2014)', 'https://doi.org/10.1145/2629489')]
+icon_hash = None
+upstream_license = ('CC0 1.0 (Wikidata)', 'https://www.wikidata.org/wiki/Wikidata:Licensing')
+upstream_prefix = 'https://object-arbutus.alliancecan.ca/swift/v1/14c95234f6cd4a21a47deafe20cce2a7/tgb'
+files = [('tkgl-smallpedia.zip:tkgl-smallpedia_edgelist.csv', 'temporal', None),
+         ('tkgl-smallpedia.zip:tkgl-smallpedia_static_edgelist.csv', 'static', None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    global files
+    name = __name__.split(".")[-1]
+    for fname, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        # "ts,head,tail,relation_type" or "head,tail,relation_type"
+        with open_upstream_file(name, fname, "rb") as f:
+            df = pandas.read_csv(f, dtype=str)
+        cols = ["head", "tail", "relation_type"]
+        eprops = [("relation", "string")]
+        if alt == "temporal":
+            cols.append("ts")
+            eprops.append(("year", "int"))
+            df["ts"] = df["ts"].astype("int64")
+        g = Graph(directed=True)
+        g.vp.wikidata_id = g.add_edge_list(df[cols].itertuples(index=False),
+                                           hashed=True, eprops=list(eprops))
+        for k, t in eprops:
+            g.ep[k] = g.ep[k]
+        yield alt, g