#!/usr/bin/env python3 import json from pathlib import Path ROOT = Path(__file__).resolve().parents[1] def load(path): with (ROOT / path).open("r", encoding="utf-8") as f: return json.load(f) def check(name, ann_path, rel_path): anns = load(ann_path) rels = load(rel_path) annot_ids = {x["annot_id"] for x in anns} missing = [] for rel in rels: for key in ("first_node_annot_id", "second_node_annot_id"): if rel[key] not in annot_ids: missing.append((rel["relation_id"], key, rel[key])) if missing: raise SystemExit(f"{name}: missing endpoints: {missing[:5]} (total {len(missing)})") print(f"{name}: ok ({len(anns)} nodes, {len(rels)} edges)") check("all", "annotations.json", "relations.json") check("FunGraph3D", "compat/FunGraph3D/FunGraph3D.annotations.json", "compat/FunGraph3D/FunGraph3D.relations.json") check("SceneFun3D_Graph", "compat/SceneFun3D_Graph/SceneFun3D.annotations.json", "compat/SceneFun3D_Graph/SceneFun3D.relations.json")