History of bookcrossing
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/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index c01a731..55fa6bf 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -34,7 +34,7 @@ The network has the following properties:
tags = ['Economic', 'Preferences', 'Weighted', 'Metadata']
url = 'https://web.archive.org/web/20140228065458/http://www.informatik.uni-freiburg.de/~cziegler/BX/'
citation = [('C.-N. Ziegler, S. M. McNee, J. A. Konstan, G. Lausen, "Improving recommendation lists through topic diversification." Proceedings of the 14th International Conference on World Wide Web (WWW 2005), 22-32 (2005)', 'https://doi.org/10.1145/1060745.1060754')]
-icon_hash = '5818e48e8cf714f319c3eae1'
+date_added = '2020-08-11'
upstream_license = ("Freely available for research use when acknowledged",
"https://web.archive.org/web/20140228065458/http://www.informatik.uni-freiburg.de/~cziegler/BX/")
# The Freiburg page is no longer online, so the file is obtained from the
[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/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index 5001b55..c01a731 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -24,10 +24,13 @@ description = """A bipartite network of users of the BookCrossing community (a w
The network has the following properties:
-- Nodes: `is_book`, whether the node is a book (otherwise it is a user).
-- Users: `user_id`, the anonymized user id; `location`, the user's location as given ("city, region, country"); `age`, the user's age as given (-1 if unknown; some values are implausible).
-- Books: `isbn`; `title`, `author` (only the first, if several), `year` of publication (0 if unknown) and `publisher`, for the 270,170 rated books listed in the book table (empty otherwise).
-- Edges: `rating`, the rating, from 1 to 10, or 0 for an implicit rating."""
+- (Node) `is_book`: whether the node is a book (otherwise it is a user).
+- (Node) `user_id` (users): the anonymized user id.
+- (Node) `location` (users): the user's location as given ("city, region, country").
+- (Node) `age` (users): the user's age as given (-1 if unknown; some values are implausible).
+- (Node) `isbn` (books): the ISBN of the book.
+- (Node) `title`, `author`, `year`, `publisher` (books): the title, the author (only the first, if several), the year of publication (0 if unknown) and the publisher, for the 270,170 rated books listed in the book table (empty otherwise).
+- (Edge) `rating`: the rating, from 1 to 10, or 0 for an implicit rating."""
tags = ['Economic', 'Preferences', 'Weighted', 'Metadata']
url = 'https://web.archive.org/web/20140228065458/http://www.informatik.uni-freiburg.de/~cziegler/BX/'
citation = [('C.-N. Ziegler, S. M. McNee, J. A. Konstan, G. Lausen, "Improving recommendation lists through topic diversification." Proceedings of the 14th International Conference on World Wide Web (WWW 2005), 22-32 (2005)', 'https://doi.org/10.1145/1060745.1060754')]
[entries] Remove unneeded code from the entries 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/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index 78f5ede..5001b55 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -54,7 +54,6 @@ def read_rows(f):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] Move more KONECT-derived entries to their original sources bf9dc0e
The entries now download the data from where KONECT obtained them (live, or via the Wayback Machine), using the same release as KONECT where it is still available, and gain the metadata KONECT dropped; descriptions and citations are rewritten from the original sources: - Linton Freeman's UCINET data page: bible_nouns, bison, cattle, hens, highschool, kangaroo, macaques, moreno_sheep, physician_trust (the three relations and the physicians' attributes), rhesus_monkey, train_terrorists, windsurfers (now the networks `interaction` and `closeness`), college_freshmen, crime, interactome_yeast (from the primary source), moreno_taro (undirected), residence_hall, zebras - other pages, archived: contiguous_usa, advogato, google, github, digg_reply, twitter, bookcrossing, dbtropes_feature (without KONECT's spurious "ItemName" tropes) - movielens_100k (in fact the MovieLens 10M tag assignments) - dblp release 2017-05-02: dblp_author_paper, dblp_cite, dblp_coauthor - DBpedia 3.9: dbpedia_country, dbpedia_genre, dbpedia_location, dbpedia_occupation, dbpedia_producer, dbpedia_recordlabel, dbpedia_starring, dbpedia_team, dbpedia_writer, dbpedia_all, dbpedia_link - Discogs releases dump of October 2015: discogs_affiliation, discogs_genre and discogs_label (now with genre and style networks)
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index 6308a7c..78f5ede 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -17,20 +17,38 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
from .. import *
+import html
-title = "BookCrossing ratings (2005)"
-description = """Two bipartite networks representing people and the books they have interacted with, from the BookCrossing website. Nodes represent users and books, and an edge connects a user to a book they have interacted with. The file book_implicit is unweighted; edge weights in book_ratings give the rating a user assigned to a book.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
-tags = ['Economic', 'Preferences', 'Unweighted', 'Weighted']
-url = 'http://konect.cc/networks/bookcrossing_full-rating'
-citation = [('C. Ziegler et al. "Improving recommendation lists through topic diversification." Proc. 14th Internat. Conf. on World Wide Web (WWW 2005).', 'https://doi.org/10.1145/1060745.1060754')]
+title = "BookCrossing ratings (2004)"
+description = """A bipartite network of users of the BookCrossing community (a website for exchanging books) and the books they rated, collected by C.-N. Ziegler in a 4-week crawl in August and September 2004, with the permission of the site's operators. Nodes are users and books, and an edge connects a user to a book the user rated, with the rating as edge weight. Ratings are either explicit, on a scale from 1 to 10 (higher values denoting higher appreciation), or implicit (a recorded interaction with the book without a rating), which are given the value 0. User ids are anonymized, and books are identified by their ISBN; according to the source, invalid ISBNs were removed from the book table, but the rating table contains some ISBNs that are malformed or not in the book table. Book information was obtained from Amazon Web Services. The network includes only the users and books that appear in some rating (the source also lists 173,575 users without ratings).
+
+The network has the following properties:
+
+- Nodes: `is_book`, whether the node is a book (otherwise it is a user).
+- Users: `user_id`, the anonymized user id; `location`, the user's location as given ("city, region, country"); `age`, the user's age as given (-1 if unknown; some values are implausible).
+- Books: `isbn`; `title`, `author` (only the first, if several), `year` of publication (0 if unknown) and `publisher`, for the 270,170 rated books listed in the book table (empty otherwise).
+- Edges: `rating`, the rating, from 1 to 10, or 0 for an implicit rating."""
+tags = ['Economic', 'Preferences', 'Weighted', 'Metadata']
+url = 'https://web.archive.org/web/20140228065458/http://www.informatik.uni-freiburg.de/~cziegler/BX/'
+citation = [('C.-N. Ziegler, S. M. McNee, J. A. Konstan, G. Lausen, "Improving recommendation lists through topic diversification." Proceedings of the 14th International Conference on World Wide Web (WWW 2005), 22-32 (2005)', 'https://doi.org/10.1145/1060745.1060754')]
icon_hash = '5818e48e8cf714f319c3eae1'
-upstream_prefix = 'http://konect.cc/files'
-files = [('download.tsv.bookcrossing_full-rating.tar.bz2', None, 'konect')]
+upstream_license = ("Freely available for research use when acknowledged",
+ "https://web.archive.org/web/20140228065458/http://www.informatik.uni-freiburg.de/~cziegler/BX/")
+# The Freiburg page is no longer online, so the file is obtained from the
+# Internet Archive.
+upstream_prefix = 'https://web.archive.org/web/20131210191740id_/http://www.informatik.uni-freiburg.de/~cziegler/BX'
+files = [(('BX-CSV-Dump.zip:BX-Book-Ratings.csv', 'BX-CSV-Dump.zip:BX-Books.csv',
+ 'BX-CSV-Dump.zip:BX-Users.csv'), None, None)]
def fetch_upstream(force=False):
- return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
- force)
+ return retry_download(fetch_upstream_files, __name__.split(".")[-1],
+ upstream_prefix, files, force)
+
+def read_rows(f):
+ # Semicolon-separated, all fields quoted (except NULL), Latin-1 encoded,
+ # with a header line; text fields contain HTML character references
+ lines = f.read().decode("latin-1").split("\r\n")
+ return [l for l in lines[1:] if l]
@cache_network()
@coerce_props()
@@ -41,9 +59,57 @@ def parse(alts=None):
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
continue
- if isinstance(fnames, str):
- fnames = [fnames]
with ExitStack() as stack:
fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
- g = parse_graph(fs, fmt, directed=True)
+ # "User-ID";"ISBN";"Book-Rating"
+ ratings = [re.match(r'^"(\d+)";"(.*)";"(\d+)"$', l).groups()
+ for l in read_rows(fs[0])]
+ # "ISBN";"Book-Title";"Book-Author";"Year-Of-Publication";
+ # "Publisher";"Image-URL-S";"Image-URL-M";"Image-URL-L"
+ books = {}
+ for l in read_rows(fs[1]):
+ x = l[1:-1].split('";"')
+ books[x[0]] = x[1:5]
+ # "User-ID";"Location";"Age" (the location may contain
+ # semicolons)
+ users = {}
+ for l in read_rows(fs[2]):
+ uid, rest = l.split(";", 1)
+ loc, age = rest.rsplit(";", 1)
+ users[int(uid.strip('"'))] = (loc.strip('"'), age.strip('"'))
+
+ uids = numpy.unique([int(u) for u, b, r in ratings])
+ isbns = sorted(set(b for u, b, r in ratings))
+ NU = len(uids)
+ bidx = {b: NU + i for i, b in enumerate(isbns)}
+ g = Graph(directed=False)
+ g.add_vertex(NU + len(isbns))
+ g.ep.rating = g.new_ep("int")
+ g.add_edge_list([(numpy.searchsorted(uids, int(u)), bidx[b], int(r))
+ for u, b, r in ratings], eprops=[g.ep.rating])
+ g.vp.is_book = g.new_vp("bool")
+ g.vp.is_book.a[NU:] = 1
+ g.vp.user_id = g.new_vp("int", val=-1)
+ g.vp.location = g.new_vp("string")
+ g.vp.age = g.new_vp("int", val=-1)
+ for i, uid in enumerate(uids):
+ g.vp.user_id[i] = uid
+ loc, age = users.get(int(uid), ("", "NULL"))
+ g.vp.location[i] = html.unescape(loc)
+ if age != "NULL":
+ g.vp.age[i] = int(age)
+ g.vp.isbn = g.new_vp("string")
+ g.vp.title = g.new_vp("string")
+ g.vp.author = g.new_vp("string")
+ g.vp.year = g.new_vp("int")
+ g.vp.publisher = g.new_vp("string")
+ for b, i in bidx.items():
+ g.vp.isbn[i] = b
+ x = books.get(b)
+ if x is None:
+ continue
+ g.vp.title[i] = html.unescape(x[0])
+ g.vp.author[i] = html.unescape(x[1])
+ g.vp.year[i] = int(x[2])
+ g.vp.publisher[i] = html.unescape(x[3])
yield alt, g
Update copyright information 73a4f0d
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index 11e4546..6308a7c 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-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
Update copyright information 3d288ea
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index f3f2553..11e4546 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2024 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
Update copyright information 8d005ae
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index 8c9a884..f3f2553 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2023 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
Update copyright info db2efcc
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index bb4b174..8c9a884 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2021 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
Un-orphan KONECT datasets 894eba5
KONECT has been brought back from the dead for the time being.
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index 6fbc538..bb4b174 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -26,7 +26,6 @@ url = 'http://konect.cc/networks/bookcrossing_full-rating'
citation = [('C. Ziegler et al. "Improving recommendation lists through topic diversification." Proc. 14th Internat. Conf. on World Wide Web (WWW 2005).', 'https://doi.org/10.1145/1060745.1060754')]
icon_hash = '5818e48e8cf714f319c3eae1'
upstream_prefix = 'http://konect.cc/files'
-orphan = True
files = [('download.tsv.bookcrossing_full-rating.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Update citations to use DOIs e878874
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index 3dd4d27..6fbc538 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -23,7 +23,7 @@ description = """Two bipartite networks representing people and the books they h
[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Economic', 'Preferences', 'Unweighted', 'Weighted']
url = 'http://konect.cc/networks/bookcrossing_full-rating'
-citation = [('C. Ziegler et al. "Improving recommendation lists through topic diversification." Proc. 14th Internat. Conf. on World Wide Web (WWW 2005).', 'http://dl.acm.org/citation.cfm?id=1060754')]
+citation = [('C. Ziegler et al. "Improving recommendation lists through topic diversification." Proc. 14th Internat. Conf. on World Wide Web (WWW 2005).', 'https://doi.org/10.1145/1060745.1060754')]
icon_hash = '5818e48e8cf714f319c3eae1'
upstream_prefix = 'http://konect.cc/files'
orphan = True
Add support for 'orphan' datasets and tag konect entries e330b80
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index f692953..3dd4d27 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -26,6 +26,7 @@ url = 'http://konect.cc/networks/bookcrossing_full-rating'
citation = [('C. Ziegler et al. "Improving recommendation lists through topic diversification." Proc. 14th Internat. Conf. on World Wide Web (WWW 2005).', 'http://dl.acm.org/citation.cfm?id=1060754')]
icon_hash = '5818e48e8cf714f319c3eae1'
upstream_prefix = 'http://konect.cc/files'
+orphan = True
files = [('download.tsv.bookcrossing_full-rating.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Change license from GPLv3 to AGPLv3 d754be5
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index ee22cfc..f692953 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -3,18 +3,18 @@
#
# Copyright (C) 2020 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 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 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 General Public License for more details.
+# 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 General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# 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/>.
from .. import *
Add explicit attribution to descriptions obtained from ICON 1645314
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
index f5194ac..ee22cfc 100644
--- a/entries/bookcrossing/__init__.py
+++ b/entries/bookcrossing/__init__.py
@@ -19,7 +19,8 @@
from .. import *
title = "BookCrossing ratings (2005)"
-description = "Two bipartite networks representing people and the books they have interacted with, from the BookCrossing website. Nodes represent users and books, and an edge connects a user to a book they have interacted with. The file book_implicit is unweighted; edge weights in book_ratings give the rating a user assigned to a book."
+description = """Two bipartite networks representing people and the books they have interacted with, from the BookCrossing website. Nodes represent users and books, and an edge connects a user to a book they have interacted with. The file book_implicit is unweighted; edge weights in book_ratings give the rating a user assigned to a book.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Economic', 'Preferences', 'Unweighted', 'Weighted']
url = 'http://konect.cc/networks/bookcrossing_full-rating'
citation = [('C. Ziegler et al. "Improving recommendation lists through topic diversification." Proc. 14th Internat. Conf. on World Wide Web (WWW 2005).', 'http://dl.acm.org/citation.cfm?id=1060754')]
Initial commit cc85872
diff --git a/entries/bookcrossing/__init__.py b/entries/bookcrossing/__init__.py
new file mode 100644
index 0000000..f5194ac
--- /dev/null
+++ b/entries/bookcrossing/__init__.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 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 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "BookCrossing ratings (2005)"
+description = "Two bipartite networks representing people and the books they have interacted with, from the BookCrossing website. Nodes represent users and books, and an edge connects a user to a book they have interacted with. The file book_implicit is unweighted; edge weights in book_ratings give the rating a user assigned to a book."
+tags = ['Economic', 'Preferences', 'Unweighted', 'Weighted']
+url = 'http://konect.cc/networks/bookcrossing_full-rating'
+citation = [('C. Ziegler et al. "Improving recommendation lists through topic diversification." Proc. 14th Internat. Conf. on World Wide Web (WWW 2005).', 'http://dl.acm.org/citation.cfm?id=1060754')]
+icon_hash = '5818e48e8cf714f319c3eae1'
+upstream_prefix = 'http://konect.cc/files'
+files = [('download.tsv.bookcrossing_full-rating.tar.bz2', None, 'konect')]
+
+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 fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ if isinstance(fnames, str):
+ fnames = [fnames]
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
+ g = parse_graph(fs, fmt, directed=True)
+ yield alt, g