logo Netzschleuder network catalog, repository, and centrifuge

History of dbtropes_feature

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/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index a82d45e..e3ef662 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -30,7 +30,7 @@ The network has the following properties:
 tags = ['Informational', 'Relatedness', 'Unweighted', 'Multigraph', 'Metadata']
 url = 'https://web.archive.org/web/20161001182354/http://skipforward.opendfki.de/wiki/DBTropes'
 citation = [('M. Kiesel, G. A. Grimnes, "DBTropes - a linked data wrapper approach incorporating community feedback." EKAW 2010 Demo & Poster Abstracts, International Conference on Knowledge Engineering and Knowledge Management (2010)', 'https://web.archive.org/web/20150824162510/http://www.dfki.uni-kl.de/~kiesel/paper/2010_DBTropes_EKAW_Poster.pdf')]
-icon_hash = '5759cd23bd3e93b53c6955ec'
+date_added = '2020-08-11'
 upstream_license = None
 # dbtropes.org is no longer online, so the file is obtained from the
 # Internet Archive.
[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/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 55ae66a..a82d45e 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -23,8 +23,10 @@ description = """A bipartite network of artistic works (films, series, novels, g
 
 The network has the following properties:
 
-- Nodes: `is_trope`, whether the node is a trope (otherwise it is a work); `name`, the page title (for works, prefixed by the TV Tropes namespace, e.g. "Film: The Matrix"; empty for the 3,053 pages without a title in the dump); `page`, the TV Tropes page ("Namespace/PageName").
-- Edges: `applicability`, a value given by DBTropes to each example: 1 for most examples, -1 for some examples (at least those marked as averted on TV Tropes), or -0.3 (whose meaning is not documented)."""
+- (Node) `is_trope`: whether the node is a trope (otherwise it is a work).
+- (Node) `name`: the page title (for works, prefixed by the TV Tropes namespace, e.g. "Film: The Matrix"; empty for the 3,053 pages without a title in the dump).
+- (Node) `page`: the TV Tropes page ("Namespace/PageName").
+- (Edge) `applicability`: a value given by DBTropes to each example: 1 for most examples, -1 for some examples (at least those marked as averted on TV Tropes), or -0.3 (whose meaning is not documented)."""
 tags = ['Informational', 'Relatedness', 'Unweighted', 'Multigraph', 'Metadata']
 url = 'https://web.archive.org/web/20161001182354/http://skipforward.opendfki.de/wiki/DBTropes'
 citation = [('M. Kiesel, G. A. Grimnes, "DBTropes - a linked data wrapper approach incorporating community feedback." EKAW 2010 Demo & Poster Abstracts, International Conference on Knowledge Engineering and Knowledge Management (2010)', 'https://web.archive.org/web/20150824162510/http://www.dfki.uni-kl.de/~kiesel/paper/2010_DBTropes_EKAW_Poster.pdf')]
[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/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index be7f73c..55ae66a 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -60,7 +60,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] Move more KONECT-derived entries to their original sources by Tiago de Paula Peixoto 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/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 49b72f3..be7f73c 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -18,19 +18,43 @@
 
 from .. import *
 
-title = "Artistic works and their tropes"
-description = """A bipartite network of artistic works (movies, novels, etc.) and their tropes (stylistic conventions or devices), as extracted from tvtropes.org. The date of this snapshot is uncertain.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
-tags = ['Informational', 'Relatedness', 'Unweighted']
-url = 'http://konect.cc/networks/dbtropes-feature'
-citation = [('J. Kunegis "TV tropes network dataset" KONECT, the Koblenz Network Collection (2016)', 'https://doi.org/10.1145/2487788.2488173')]
+title = "Artistic works and their tropes (2016)"
+description = """A bipartite network of artistic works (films, series, novels, games, etc.) and the tropes (writing devices and conventions) they use, from the TV Tropes wiki (tvtropes.org), as converted into RDF by the DBTropes project of M. Kiesel (DFKI). DBTropes parsed the pages of TV Tropes, and each example of a trope listed on the page of a work (or each work listed on the page of a trope) became a "feature instance" linking the work to the trope. Nodes are works and tropes, and an edge connects a work to a trope exemplified in it, with one edge per feature instance, so a pair can be connected by several edges when the example appears more than once (e.g. on both pages). This is the monthly DBTropes snapshot of 1 July 2016 (with pages fetched from TV Tropes at various earlier dates). The "item name" pseudo-features that DBTropes attaches to every work are not included.
+
+The network has the following properties:
+
+- Nodes: `is_trope`, whether the node is a trope (otherwise it is a work); `name`, the page title (for works, prefixed by the TV Tropes namespace, e.g. "Film: The Matrix"; empty for the 3,053 pages without a title in the dump); `page`, the TV Tropes page ("Namespace/PageName").
+- Edges: `applicability`, a value given by DBTropes to each example: 1 for most examples, -1 for some examples (at least those marked as averted on TV Tropes), or -0.3 (whose meaning is not documented)."""
+tags = ['Informational', 'Relatedness', 'Unweighted', 'Multigraph', 'Metadata']
+url = 'https://web.archive.org/web/20161001182354/http://skipforward.opendfki.de/wiki/DBTropes'
+citation = [('M. Kiesel, G. A. Grimnes, "DBTropes - a linked data wrapper approach incorporating community feedback." EKAW 2010 Demo & Poster Abstracts, International Conference on Knowledge Engineering and Knowledge Management (2010)', 'https://web.archive.org/web/20150824162510/http://www.dfki.uni-kl.de/~kiesel/paper/2010_DBTropes_EKAW_Poster.pdf')]
 icon_hash = '5759cd23bd3e93b53c6955ec'
-upstream_prefix = 'http://konect.cc/files'
-files = [('download.tsv.dbtropes-feature.tar.bz2', None, 'konect')]
+upstream_license = None
+# dbtropes.org is no longer online, so the file is obtained from the
+# Internet Archive.
+upstream_prefix = 'https://web.archive.org/web/20220419041933id_/http://dbtropes.org/static'
+files = [('dbtropes.zip:dbtropes-20160701.nt', None, None)]
+
+RES = b"<http://dbtropes.org/resource/"
+SKIP = b"<http://skipforward.net/skipforward/resource/seeder/skipinions/"
+HAS_FEATURE = SKIP + b"hasFeature>"
+APPLICABILITY = SKIP + b"featureApplicability>"
+ITEM_NAME = SKIP + b"ItemName>"
+TYPE = b"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"
+LABEL = b"<http://www.w3.org/2000/01/rdf-schema#label>"
+
+def nt_literal(o):
+    """The string value of an N-Triples literal such as '"abc"@en'."""
+    s = o[1:o.rindex(b'"')].decode("ascii", errors="replace")
+    return re.sub(r'\\(u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|.)',
+                  lambda m: (chr(int(m.group(1)[1:], 16))
+                             if len(m.group(1)) > 1 else
+                             {"t": "\t", "n": "\n", "r": "\r"}.get(m.group(1), m.group(1))),
+                  s)
 
 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)
 
 @cache_network()
 @coerce_props()
@@ -38,12 +62,41 @@ def fetch_upstream(force=False):
 def parse(alts=None):
     global files
     name = __name__.split(".")[-1]
-    for fnames, alt, fmt in files:
+    for fname, 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=False)
+        inst_item = {}     # feature instance -> work
+        inst_trope = {}    # feature instance -> trope
+        inst_app = {}      # feature instance -> applicability
+        labels = {}
+        with open_upstream_file(name, fname, "rb") as f:
+            for line in f:
+                s, p, o = line.rstrip(b" .\r\n").split(b" ", 2)
+                if p == HAS_FEATURE:
+                    inst_item[o] = s
+                elif p == TYPE and b"/int_" in s:
+                    if o != ITEM_NAME:
+                        inst_trope[s] = o
+                elif p == APPLICABILITY:
+                    inst_app[s] = float(nt_literal(o))
+                elif p == LABEL:
+                    labels[s] = nt_literal(o)
+        insts = [i for i in inst_item if i in inst_trope]
+        works = sorted(set(inst_item[i] for i in insts))
+        tropes = sorted(set(inst_trope[i] for i in insts))
+        W = len(works)
+        idx = {u: i for i, u in enumerate(works + tropes)}
+        g = Graph(directed=False)
+        g.add_vertex(len(idx))
+        g.ep.applicability = g.new_ep("double")
+        g.add_edge_list([(idx[inst_item[i]], idx[inst_trope[i]],
+                          inst_app.get(i, numpy.nan)) for i in insts],
+                        eprops=[g.ep.applicability])
+        g.vp.is_trope = g.new_vp("bool")
+        g.vp.is_trope.a[W:] = 1
+        g.vp.name = g.new_vp("string")
+        g.vp.page = g.new_vp("string")
+        for u, i in idx.items():
+            g.vp.page[i] = u[len(RES):-1].decode("utf-8", errors="replace")
+            g.vp.name[i] = labels.get(u, "")
         yield alt, g
Update copyright information by Tiago de Paula Peixoto 73a4f0d
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 5a759b1..49b72f3 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__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 by Tiago de Paula Peixoto 3d288ea
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 6d7b0c0..5a759b1 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__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 by Tiago de Paula Peixoto 8d005ae
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index ea3e0e9..6d7b0c0 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__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 by Tiago de Paula Peixoto db2efcc
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 2e73ddf..ea3e0e9 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__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 by Tiago de Paula Peixoto 894eba5
KONECT has been brought back from the dead for the time being.
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 242327f..2e73ddf 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -26,7 +26,6 @@ url = 'http://konect.cc/networks/dbtropes-feature'
 citation = [('J. Kunegis "TV tropes network dataset" KONECT, the Koblenz Network Collection (2016)', 'https://doi.org/10.1145/2487788.2488173')]
 icon_hash = '5759cd23bd3e93b53c6955ec'
 upstream_prefix = 'http://konect.cc/files'
-orphan = True
 files = [('download.tsv.dbtropes-feature.tar.bz2', None, 'konect')]
 
 def fetch_upstream(force=False):
Update citations to use DOIs by Tiago de Paula Peixoto e878874
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 6c4cf7d..242327f 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -23,7 +23,7 @@ description = """A bipartite network of artistic works (movies, novels, etc.) an
 [^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
 tags = ['Informational', 'Relatedness', 'Unweighted']
 url = 'http://konect.cc/networks/dbtropes-feature'
-citation = [('J. Kunegis "TV tropes network dataset" KONECT, the Koblenz Network Collection (2016)', 'http://konect.cc/networks/dbtropes-feature')]
+citation = [('J. Kunegis "TV tropes network dataset" KONECT, the Koblenz Network Collection (2016)', 'https://doi.org/10.1145/2487788.2488173')]
 icon_hash = '5759cd23bd3e93b53c6955ec'
 upstream_prefix = 'http://konect.cc/files'
 orphan = True
Add support for 'orphan' datasets and tag konect entries by Tiago de Paula Peixoto e330b80
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 4ffeb92..6c4cf7d 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -26,6 +26,7 @@ url = 'http://konect.cc/networks/dbtropes-feature'
 citation = [('J. Kunegis "TV tropes network dataset" KONECT, the Koblenz Network Collection (2016)', 'http://konect.cc/networks/dbtropes-feature')]
 icon_hash = '5759cd23bd3e93b53c6955ec'
 upstream_prefix = 'http://konect.cc/files'
+orphan = True
 files = [('download.tsv.dbtropes-feature.tar.bz2', None, 'konect')]
 
 def fetch_upstream(force=False):
Change license from GPLv3 to AGPLv3 by Tiago de Paula Peixoto d754be5
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 6f9a7b8..4ffeb92 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__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 by Tiago de Paula Peixoto 1645314
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
index 006b204..6f9a7b8 100644
--- a/entries/dbtropes_feature/__init__.py
+++ b/entries/dbtropes_feature/__init__.py
@@ -19,7 +19,8 @@
 from .. import *
 
 title = "Artistic works and their tropes"
-description = "A bipartite network of artistic works (movies, novels, etc.) and their tropes (stylistic conventions or devices), as extracted from tvtropes.org. The date of this snapshot is uncertain."
+description = """A bipartite network of artistic works (movies, novels, etc.) and their tropes (stylistic conventions or devices), as extracted from tvtropes.org. The date of this snapshot is uncertain.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
 tags = ['Informational', 'Relatedness', 'Unweighted']
 url = 'http://konect.cc/networks/dbtropes-feature'
 citation = [('J. Kunegis "TV tropes network dataset" KONECT, the Koblenz Network Collection (2016)', 'http://konect.cc/networks/dbtropes-feature')]
Initial commit by Tiago de Paula Peixoto cc85872
diff --git a/entries/dbtropes_feature/__init__.py b/entries/dbtropes_feature/__init__.py
new file mode 100644
index 0000000..006b204
--- /dev/null
+++ b/entries/dbtropes_feature/__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 = "Artistic works and their tropes"
+description = "A bipartite network of artistic works (movies, novels, etc.) and their tropes (stylistic conventions or devices), as extracted from tvtropes.org. The date of this snapshot is uncertain."
+tags = ['Informational', 'Relatedness', 'Unweighted']
+url = 'http://konect.cc/networks/dbtropes-feature'
+citation = [('J. Kunegis "TV tropes network dataset" KONECT, the Koblenz Network Collection (2016)', 'http://konect.cc/networks/dbtropes-feature')]
+icon_hash = '5759cd23bd3e93b53c6955ec'
+upstream_prefix = 'http://konect.cc/files'
+files = [('download.tsv.dbtropes-feature.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=False)
+        yield alt, g