History of wikipedia_citations
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 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/wikipedia_citations/__init__.py b/entries/wikipedia_citations/__init__.py
index 0a19b1f..031f140 100644
--- a/entries/wikipedia_citations/__init__.py
+++ b/entries/wikipedia_citations/__init__.py
@@ -38,7 +38,7 @@ tags = ['Informational', 'Citation', 'Bipartite', 'Multigraph', 'Metadata']
url = ['https://zenodo.org/records/3940692']
citation = [('H. Singh, R. West, G. Colavizza, "Wikipedia citations: A comprehensive data set of citations with identifiers extracted from English Wikipedia." Quantitative Science Studies 2(1), 1-19 (2021)',
'https://doi.org/10.1162/qss_a_00105')]
-icon_hash = None
+date_added = '2026-10-28'
upstream_license = ('CC BY 4.0', 'https://creativecommons.org/licenses/by/4.0/')
upstream_prefix = 'https://zenodo.org/records/3940692/files'
# The "minimal" version of the dataset (version 0.2 of the Zenodo record):
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) 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/wikipedia_citations/__init__.py b/entries/wikipedia_citations/__init__.py
index efac818..0a19b1f 100644
--- a/entries/wikipedia_citations/__init__.py
+++ b/entries/wikipedia_citations/__init__.py
@@ -28,12 +28,12 @@ A directed edge from an article to a work is a citation. Only the citations that
The network has the following properties:
-- `is_article`: whether the node is a Wikipedia article (otherwise it is a cited work).
-- `title`: the title of the Wikipedia article, or of the cited work (as written in the first citation of it).
-- `id_type` (works): the type of the identifier of the work, e.g. `DOI`, `PMID`, `ISBN`.
-- `id` (works): the identifier of the work (normalized as described above).
-- `identifiers` (works): all the identifiers given in the first citation of the work, e.g. `{PMID=20784713, PMC=2282302, DOI=10.1136/bmj.1.4286.261}`.
-- Edge `template`: the citation template used, e.g. `cite journal`."""
+- (Node) `is_article`: whether the node is a Wikipedia article (otherwise it is a cited work).
+- (Node) `title`: the title of the Wikipedia article, or of the cited work (as written in the first citation of it).
+- (Node) `id_type` (works): the type of the identifier of the work, e.g. `DOI`, `PMID`, `ISBN`.
+- (Node) `id` (works): the identifier of the work (normalized as described above).
+- (Node) `identifiers` (works): all the identifiers given in the first citation of the work, e.g. `{PMID=20784713, PMC=2282302, DOI=10.1136/bmj.1.4286.261}`.
+- (Edge) `template`: the citation template used, e.g. `cite journal`."""
tags = ['Informational', 'Citation', 'Bipartite', 'Multigraph', 'Metadata']
url = ['https://zenodo.org/records/3940692']
citation = [('H. Singh, R. West, G. Colavizza, "Wikipedia citations: A comprehensive data set of citations with identifiers extracted from English Wikipedia." Quantitative Science Studies 2(1), 1-19 (2021)',
[entries] New entry: wikipedia_citations 874c755
diff --git a/entries/wikipedia_citations/__init__.py b/entries/wikipedia_citations/__init__.py
new file mode 100644
index 0000000..efac818
--- /dev/null
+++ b/entries/wikipedia_citations/__init__.py
@@ -0,0 +1,132 @@
+#! /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 pyarrow
+import pyarrow.parquet
+
+from .. import *
+
+title = "English Wikipedia citations of identified works (2020)"
+description = r"""A bipartite network of the articles of the English Wikipedia and the works (scholarly articles, books, ...) they cite, from the Wikipedia Citations dataset of H. Singh, R. West and G. Colavizza. The authors extracted all the citations made with citation templates (`cite journal`, `cite book`, `cite news`, `citation`, ... 35 templates in all) from the wikitext of the articles in the English Wikipedia dump of May 2020, 29.3 million citations in total, together with the identifiers given in them (DOI, PMID, PMC, ISBN, arXiv, JSTOR, OCLC, ...).
+
+A directed edge from an article to a work is a citation. Only the citations that carry an identifier of the cited work can be linked to the same work cited elsewhere, so only these are included (3.8 million citations); the others (mostly of news and web pages, identified only by their title or URL) are left out. Each work is identified by the first identifier available among, in this order: DOI, PMID, PMC, arXiv, Bibcode, JSTOR, ISBN, OCLC, LCCN, Open Library, ASIN, MR, zbMATH, JFM, SSRN, OSTI, RFC, ISMN and Usenet id. DOIs are compared in lower case, and ISBNs as 13-digit numbers (ISBN-10s are converted, and hyphens removed). Citations with only an ISSN (which identifies a journal, not a work) are left out. A work cited with different identifiers in different articles (e.g. only a PMID in one, and a DOI in another) appears as several nodes. The candidate DOIs found by the authors for some citations without identifiers by searching Crossref are not used. The network is a multigraph, since an article may cite the same work several times.
+
+The network has the following properties:
+
+- `is_article`: whether the node is a Wikipedia article (otherwise it is a cited work).
+- `title`: the title of the Wikipedia article, or of the cited work (as written in the first citation of it).
+- `id_type` (works): the type of the identifier of the work, e.g. `DOI`, `PMID`, `ISBN`.
+- `id` (works): the identifier of the work (normalized as described above).
+- `identifiers` (works): all the identifiers given in the first citation of the work, e.g. `{PMID=20784713, PMC=2282302, DOI=10.1136/bmj.1.4286.261}`.
+- Edge `template`: the citation template used, e.g. `cite journal`."""
+tags = ['Informational', 'Citation', 'Bipartite', 'Multigraph', 'Metadata']
+url = ['https://zenodo.org/records/3940692']
+citation = [('H. Singh, R. West, G. Colavizza, "Wikipedia citations: A comprehensive data set of citations with identifiers extracted from English Wikipedia." Quantitative Science Studies 2(1), 1-19 (2021)',
+ 'https://doi.org/10.1162/qss_a_00105')]
+icon_hash = None
+upstream_license = ('CC BY 4.0', 'https://creativecommons.org/licenses/by/4.0/')
+upstream_prefix = 'https://zenodo.org/records/3940692/files'
+# The "minimal" version of the dataset (version 0.2 of the Zenodo record):
+# Spark parquet files, one row per citation
+files = [(('minimal_dataset.zip',), None, None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force, check=False)
+
+ORDER = ["DOI", "PMID", "PMC", "ARXIV", "BIBCODE", "JSTOR", "ISBN", "OCLC",
+ "LCCN", "OL", "ASIN", "MR", "ZBL", "JFM", "SSRN", "OSTI", "RFC",
+ "ISMN", "USENETID"]
+
+def isbn13(s):
+ s = "".join(ch for ch in s.upper() if ch.isdigit() or ch == "X")
+ if len(s) == 10:
+ s = "978" + s[:9]
+ s += str((10 - sum((1 if i % 2 == 0 else 3) * int(ch)
+ for i, ch in enumerate(s)) % 10) % 10)
+ return s
+
+def work_key(ids):
+ "The (type, normalized value) of the identifier of a work, or None."
+ d = {}
+ for item in ids.strip().strip("{}").split(", "):
+ k, sep, v = item.partition("=")
+ if sep:
+ d.setdefault(k.strip().upper(), v.strip())
+ for k in ORDER:
+ v = d.get(k)
+ if v:
+ if k == "DOI":
+ v = v.lower()
+ elif k == "ISBN":
+ v = isbn13(v)
+ if v:
+ return k, v
+ return None
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ articles = {}
+ works = {}
+ wtitle, wids = [], []
+ edges, templates = [], []
+ with open_upstream_file(name, fnames[0], "rb", seekable=True) as f:
+ with zipfile.ZipFile(f) as zf:
+ for member in sorted(zf.namelist()):
+ if not member.endswith(".parquet"):
+ continue
+ with zf.open(member) as mf:
+ t = pyarrow.parquet.read_table(
+ io.BytesIO(mf.read()),
+ columns=["type_of_citation", "page_title", "Title",
+ "ID_list"])
+ t = t.filter(pyarrow.compute.is_valid(t["ID_list"]))
+ for tmpl, page, ttl, ids in zip(*[c.to_pylist() for c in t.columns]):
+ k = work_key(ids)
+ if k is None:
+ continue
+ w = works.get(k)
+ if w is None:
+ w = works[k] = len(works)
+ wtitle.append(ttl or "")
+ wids.append(ids)
+ a = articles.setdefault(page, len(articles))
+ edges.append((a, w))
+ templates.append(tmpl or "")
+ A = len(articles)
+ g = Graph(directed=True)
+ g.add_vertex(A + len(works))
+ e = numpy.array(edges, dtype="int64")
+ del edges
+ e[:, 1] += A
+ g.add_edge_list(e)
+ del e
+ g.vp.is_article = g.new_vp("bool")
+ g.vp.is_article.a[:A] = 1
+ g.vp.title = g.new_vp("string", vals=list(articles) + wtitle)
+ g.vp.id_type = g.new_vp("string", vals=[""] * A + [k[0] for k in works])
+ g.vp.id = g.new_vp("string", vals=[""] * A + [k[1] for k in works])
+ g.vp.identifiers = g.new_vp("string", vals=[""] * A + wids)
+ g.ep.template = g.new_ep("string", vals=templates)
+ yield alt, g