diff --git a/mknodes.py b/mknodes.py index 712e478..15619af 100755 --- a/mknodes.py +++ b/mknodes.py @@ -9,8 +9,6 @@ import json from pathlib import Path data = '../dokk/data' -edge_properties = [ 'comics_cartoon', 'comics_author', 'ttrpg_character', - 'community_project' ] nodes = [] edges = [] @@ -18,24 +16,24 @@ edges = [] for path in Path(data).glob('**/*.json',): with open(path, 'r') as f: n = json.loads(f.read()) - + nodes.append({ 'title': n['node_name'] + ('\n' + n['node_description'] if 'node_description' in n else ''), #'color': { 'background': '', 'border': ''}, 'label': n['node_name'], 'id': n['node_id'] }) - - for p in edge_properties: - if p not in n.keys(): + + for p in n.keys(): + if not p.startswith('*'): continue - + if not type(n[p]) == list: n[p] = [ n[p] ] - + for target in n[p]: edges.append({ - 'title': p, + 'title': p[1:], 'from': n['node_id'], #'label': p, 'to': target,