#!/usr/bin/env python3
"""E2 follow-up: confirm Aaron AI alias situation, find other potential duplicates."""
import subprocess

QUERIES = [
    ("Aaron AI variants",
     "MATCH (n:Entity) WHERE n.name CONTAINS 'Aaron AI' OR n.name CONTAINS 'ARIN' OR n.name CONTAINS 'RNAI' RETURN n.name, n.summary"),
    ("All Mossygear-named entities",
     "MATCH (n:Entity) WHERE n.name CONTAINS 'Mossy' OR n.name CONTAINS 'A+K' OR n.name CONTAINS 'AK Design' RETURN n.name, n.summary"),
    ("Total entity count check",
     "MATCH (n:Entity) RETURN count(n) as total"),
    ("Top 30 entity names by edge count",
     "MATCH (n:Entity)-[r]-() RETURN n.name, count(r) as edges ORDER BY edges DESC LIMIT 30"),
]

for label, query in QUERIES:
    print(f"\n{'=' * 60}")
    print(f"QUERY: {label}")
    print('=' * 60)
    result = subprocess.run(
        ["docker", "exec", "falkordb", "redis-cli", "GRAPH.QUERY", "aaron", query],
        capture_output=True, text=True
    )
    print(result.stdout)
