From c3c8ea38d5327d73b5359ae29ed5fd3b4eb9a544 Mon Sep 17 00:00:00 2001 From: ecwood Date: Thu, 20 Jul 2023 01:59:16 -0700 Subject: [PATCH] #321 get rid of nodes dictionary that doesn't exist and refactor it into other for loop --- report_stats_on_json_kg.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/report_stats_on_json_kg.py b/report_stats_on_json_kg.py index 4d5790c5..651e27cd 100755 --- a/report_stats_on_json_kg.py +++ b/report_stats_on_json_kg.py @@ -207,18 +207,15 @@ def count_orphan_nodes(nodes: list, edges: list): build_info = dict() - for n in nodes: # search for build info node starting at end - if n["id"] == kg2_util.CURIE_PREFIX_RTX + ':' + 'KG2': # should be the first node accessed + number_of_nodes = 0 + for node in kg2_util.read_json_lines(input_nodes_file): + number_of_nodes += 1 + if n["id"] == kg2_util.CURIE_PREFIX_RTX + ':' + 'KG2': build_info = n - break if len(build_info) == 0: print("WARNING: 'build' property is missing from the input JSON.", file=sys.stderr) - number_of_nodes = 0 - for node in kg2_util.read_json_lines(input_nodes_file): - number_of_nodes += 1 - number_of_edges = 0 for edge in kg2_util.read_json_lines(input_edges_file): number_of_edges += 1