File size: 11,119 Bytes
7eaced5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
"""
Hardcoded query definitions β€” backed by QueryExecutor methods.

Each entry maps to one method on QueryExecutor (neo4j_graph/query_executor.py).
The UI reads `inputs` to render the right controls, collects values, then calls:

    getattr(executor, entry["method"])(**user_inputs, **entry.get("fixed_params", {}))

Input spec fields
-----------------
key         : kwarg name passed to the method
label       : label shown in the UI
type        : "text" | "select" | "checkbox" | "number"
placeholder : (text only) hint text
options     : (select only) list of values
default     : initial value
min / max   : (number only) bounds

Add a new query by appending a dict here β€” no other file needs to change.
"""
from __future__ import annotations

from typing import Final

HARDCODED_QUERIES: Final[list[dict]] = [

    # ── Exploration ───────────────────────────────────────────────────────────
    {
        "id":          "concept_neighborhood",
        "name":        "Concept Neighborhood",
        "icon":        "πŸ•ΈοΈ",
        "category":    "Explore mappings",
        "description": "Explore the semantic neighbors of a concept",
        "method":      "get_concept_neighborhood",
        "inputs": [
            {"key": "concept_keyword", "label": "Search for a concept", "type": "node_picker",
             "node_type": "UNESCOconcept", "placeholder": "e.g. artificial intelligence", "top_k": 7},
            {"key": "hops",        "label": "Semantic jumps allowed",           "type": "select",   "options": [1, 2, 3, 4], "default": 2, "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
            {"key": "limit",           "label": "Limit",               "type": "number", "default": 30, "min": 5, "max": 200},
        ],
    },
    {
        "id":          "platform_span",
        "name":        "Cross-Breakthroughs relationships (2026)",
        "icon":        "🌐",
        "category":    "Insights from the Knowledge Graph",
        "description": "Find the top 'producer' or 'receiver' Breakthroughs in the 2026 Radar",
        "method":      "get_breakthrough_platform_span",
        "inputs": [
            {"key": "breakthrough_profile", "label": "Breakthroughs that...", "type": "select",
             "options": ["all", "producer", "receiver"],
             "option_labels": {"all": "Both", "producer": "Produce most for other Breakthroughs", "receiver": "Need most from other Breakthroughs"},
             "default": "producer", "help": "Producer Breakthroughs advance fields that other breakthroughs require; Receiver breakthroughs require fields that other Breakthroughs advance."},
            {"key": "hops",        "label": "Semantic jumps allowed",           "type": "select",   "options": [0, 1, 2, 3], "default": 3, "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
            {"key": "limit",       "label": "Limit",               "type": "number",   "default": 20, "min": 5, "max": 200},
            {"key": "weight_by_nplatforms", "label": "Rank by importance score", "type": "checkbox", "default": False,
            "help": "Importance score = Breakthrough count Γ— Platform span."},
        ],
    },
    {
        "id":          "cross_domain_bridges",
        "name":        "Cross-Domain Concept Bridges",
        "icon":        "πŸ”—",
        "category":    "Cross-domain",
        "description": "Explore the semantic path between two Breakthroughs",
        "method":      "get_cross_domain_bridges",
        "inputs": [
            {"key": "keyword_1", "label": "Search for a breakthrough", "type": "node_picker",
             "node_type": "Breakthrough", "placeholder": "e.g. artificial intelligence", "top_k": 7},
            {"key": "keyword_2", "label": "Search for a breakthrough", "type": "node_picker",
             "node_type": "Breakthrough", "placeholder": "e.g. environment", "top_k": 7},
            {"key": "limit", "label": "Limit",     "type": "number", "default": 20, "min": 5, "max": 200},
            {"key": "hops",        "label": "Semantic jumps allowed",           "type": "select",   "options": [0, 1, 2, 3,4], "default": 0, "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
        ],
    },

    # ── Concept Analysis ──────────────────────────────────────────────────────
    {
        "id":          "concept_importance",
        "name":        "Concept importance to the Radar",
        "icon":        "πŸ“Š",
        "category":    "Explore mappings",
        "description": "Rank UNESCO concepts by their centrality to the Radar Breakthroughs",
        "method":      "get_concept_importance",
        "inputs": [
            {"key": "relationships", "label": "Count...", "type": "select",
             "options": ["all", "requires_only", "advances_only"],
             "option_labels": {"all": "Both", "requires_only": "Requirements for the field", "advances_only": "Advances to the field"},
             "default": "advances_only", "help": "Count the number of Breakthroughs that advance, require the field, or both."},
            {"key": "hops",        "label": "Semantic jumps allowed",           "type": "select",   "options": [0, 1, 2, 3], "default": 3, "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
            {"key": "limit",       "label": "Limit",               "type": "number",   "default": 30, "min": 5, "max": 200},
            {"key": "latest_only", "label": "Latest edition only", "type": "checkbox", "default": True,
             "help": "Only consider breakthroughs from the latest radar edition (2026)."},
            {"key": "weight_by_nplatforms", "label": "Rank by importance score", "type": "checkbox", "default": False,
             "help": "Importance score = #Breakthroughs reached Γ— #Platforms reached."},
        ],
    },
    {
        "id":          "concept_importance_sdg",
        "name":        "Concept importance to UN SDGs",
        "icon":        "🎯",
        "category":    "Explore mappings",
        "description": "Rank UNESCO concepts by their centrality to the SDG targets",
        "method":      "get_concept_importance_by_sdg",
        "inputs": [
            {"key": "hops",        "label": "Semantic jumps allowed",           "type": "select",   "options": [0, 1, 2, 3], "default": 3, "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
            {"key": "limit",       "label": "Limit",               "type": "number",   "default": 30, "min": 5, "max": 200},
            {"key": "weight_by_nsdggoals", "label": "Rank by importance score", "type": "checkbox", "default": False,
             "help": "Importance score = #SDG targets reached Γ— #SDG goals reached."},
        ],
    },
    {
        "id":          "concept_combined_importance",
        "name":        "Concept combined importance (Radar + SDGs)",
        "icon":        "⚑",
        "category":    "Explore mappings",
        "description": "Rank UNESCO concepts by both their connectivity to Radar Breakthroughs and SDG targets ('meta-trend' across diplomacy and science)",
        "method":      "get_concept_combined_importance",
        "inputs": [
            {"key": "relationships", "label": "Count...", "type": "select",
             "options": ["all", "requires_only", "advances_only"],
             "option_labels": {"all": "Both", "requires_only": "Requirements for the field", "advances_only": "Advances to the field"},
             "default": "advances_only", "help": "Count the number of Breakthroughs that advance, require the field, or both."},
            {"key": "hops",        "label": "Semantic jumps allowed", "type": "select", "options": [0, 1, 2, 3], "default": 3,
             "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
            {"key": "limit",       "label": "Limit",               "type": "number",   "default": 30, "min": 5, "max": 200},
            {"key": "latest_only", "label": "Latest edition only", "type": "checkbox", "default": True,
             "help": "Only consider breakthroughs from the latest radar edition (2026)."},
        ],
    },
    {
        "id":          "sdg_impact",
        "name":        "Breakthroughs SDG Impact (2026)",
        "icon":        "🌱",
        "category":    "Insights from the Knowledge Graph",
        "description": "Score 2026 Breakthroughs by how many distinct SDG targets they address",
        "method":      "rank_breakthroughs_by_sdg_impact",
        "inputs": [
            {"key": "hops",        "label": "Semantic jumps allowed",           "type": "select",   "options": [0, 1, 2, 3], "default": 3, "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
            {"key": "limit",                "label": "Limit",                "type": "number",   "default": 20, "min": 5, "max": 200},
            {"key": "weight_by_ngoals", "label": "Rank by importance score", "type": "checkbox", "default": False,
             "help": "Importance score = #SDG targets reached Γ— #SDG goals reached."},
        ],
    },

    {
        "id":          "sdg_breakthrough_contributors",
        "name":        "SDG Target β†’ Biggest Breakthrough Contributors",
        "icon":        "🎯",
        "category":    "Insights from the Knowledge Graph",
        "description": "Find the most direct Breakthrough contributors to a given SDG target, ranked by shortest concept path",
        "method":      "get_breakthrough_contributors_for_sdgtarget",
        "inputs": [
            {"key": "target_id", "label": "Search for an SDG target", "type": "node_picker",
             "node_type": "SDGtarget", "placeholder": "e.g. poverty", "top_k": 7,
             "value_prop": "node_id", "display_node_id": True},
            {"key": "limit",       "label": "Limit", "type": "number", "default": 10, "min": 1, "max": 100},
            {"key": "latest_only", "label": "Latest edition only", "type": "checkbox", "default": True,
             "help": "Only consider breakthroughs from the latest radar edition (2026)."},
        ],
    },
    {
        "id":          "concept_evolution",
        "name":        "Concept Evolution (2021 β†’ 2023 β†’ 2026)",
        "icon":        "πŸ“ˆ",
        "category":    "Insights from the Knowledge Graph",
        "description": "Compare concept importance between the 2021, 2023 and 2026 Radar editions. HEAVY QUERY (semantic jump = 1 β†’ ~ 1min; semantic jump = 2 β†’ ~3min)",
        "method":      "get_concept_evolution",
        "inputs":      [
            {"key": "hops",        "label": "Semantic jumps allowed",           "type": "select",   "options": [0, 1, 2], "default": 2, "help": "Jump between UNESCO Concepts via RELATED, BROADER, NARROWER relationships."},
        ],
    }
]