wu981526092 commited on
Commit
46af2b7
·
1 Parent(s): fb42428

🔧 Fix Knowledge Graph Relationship Field Names

Browse files

CRITICAL FIX: Relationships were not connecting in visualization due to incorrect field names:

❌ BEFORE (broken):
- 'source_id' and 'target_id' fields
- Relationships appeared as disconnected nodes

✅ AFTER (fixed):
- 'source' and 'target' fields (correct format)
- Relationships now properly connect in graph visualization

📊 AFFECTED FILES:
- kg_algorithm_sample_3.json (Probability Game Theory)
- kg_algorithm_sample_14.json (Academic Literature)
- kg_algorithm_sample_16.json (Wildlife Data Analysis)

🎯 RESULT: All 9 relationships per knowledge graph now render correctly with proper entity connections

backend/database/samples/knowledge_graphs/kg_algorithm_sample_14.json CHANGED
@@ -149,8 +149,8 @@
149
  "relations": [
150
  {
151
  "id": "rel_001",
152
- "source_id": "input_001",
153
- "target_id": "agent_001",
154
  "type": "CONSUMED_BY",
155
  "importance": "HIGH",
156
  "interaction_prompt": "Academic research query consumed by Literary Analysis Expert",
@@ -164,8 +164,8 @@
164
  },
165
  {
166
  "id": "rel_002",
167
- "source_id": "agent_001",
168
- "target_id": "task_001",
169
  "type": "PERFORMS",
170
  "importance": "HIGH",
171
  "interaction_prompt": "Literary Analysis Expert performs scholarly article investigation",
@@ -179,8 +179,8 @@
179
  },
180
  {
181
  "id": "rel_003",
182
- "source_id": "agent_002",
183
- "target_id": "task_002",
184
  "type": "PERFORMS",
185
  "importance": "HIGH",
186
  "interaction_prompt": "Norse Mythology Expert performs mythological reference analysis",
@@ -194,8 +194,8 @@
194
  },
195
  {
196
  "id": "rel_004",
197
- "source_id": "agent_003",
198
- "target_id": "task_003",
199
  "type": "PERFORMS",
200
  "importance": "HIGH",
201
  "interaction_prompt": "Verification Expert performs academic source validation",
@@ -209,8 +209,8 @@
209
  },
210
  {
211
  "id": "rel_005",
212
- "source_id": "task_001",
213
- "target_id": "task_002",
214
  "type": "NEXT",
215
  "importance": "HIGH",
216
  "interaction_prompt": "Article investigation reveals mythological references requiring expert analysis",
@@ -224,8 +224,8 @@
224
  },
225
  {
226
  "id": "rel_006",
227
- "source_id": "task_002",
228
- "target_id": "task_003",
229
  "type": "NEXT",
230
  "importance": "HIGH",
231
  "interaction_prompt": "Mythological analysis feeds into comprehensive validation process",
@@ -239,8 +239,8 @@
239
  },
240
  {
241
  "id": "rel_007",
242
- "source_id": "task_003",
243
- "target_id": "output_001",
244
  "type": "PRODUCES",
245
  "importance": "HIGH",
246
  "interaction_prompt": "Validation process produces comprehensive literature analysis",
@@ -254,8 +254,8 @@
254
  },
255
  {
256
  "id": "rel_008",
257
- "source_id": "output_001",
258
- "target_id": "human_001",
259
  "type": "DELIVERS_TO",
260
  "importance": "HIGH",
261
  "interaction_prompt": "Literature analysis delivered to academic researcher",
@@ -269,8 +269,8 @@
269
  },
270
  {
271
  "id": "rel_009",
272
- "source_id": "agent_004",
273
- "target_id": "task_001",
274
  "type": "USES",
275
  "importance": "MEDIUM",
276
  "interaction_prompt": "Computer Terminal provides database access for article research",
 
149
  "relations": [
150
  {
151
  "id": "rel_001",
152
+ "source": "input_001",
153
+ "target": "agent_001",
154
  "type": "CONSUMED_BY",
155
  "importance": "HIGH",
156
  "interaction_prompt": "Academic research query consumed by Literary Analysis Expert",
 
164
  },
165
  {
166
  "id": "rel_002",
167
+ "source": "agent_001",
168
+ "target": "task_001",
169
  "type": "PERFORMS",
170
  "importance": "HIGH",
171
  "interaction_prompt": "Literary Analysis Expert performs scholarly article investigation",
 
179
  },
180
  {
181
  "id": "rel_003",
182
+ "source": "agent_002",
183
+ "target": "task_002",
184
  "type": "PERFORMS",
185
  "importance": "HIGH",
186
  "interaction_prompt": "Norse Mythology Expert performs mythological reference analysis",
 
194
  },
195
  {
196
  "id": "rel_004",
197
+ "source": "agent_003",
198
+ "target": "task_003",
199
  "type": "PERFORMS",
200
  "importance": "HIGH",
201
  "interaction_prompt": "Verification Expert performs academic source validation",
 
209
  },
210
  {
211
  "id": "rel_005",
212
+ "source": "task_001",
213
+ "target": "task_002",
214
  "type": "NEXT",
215
  "importance": "HIGH",
216
  "interaction_prompt": "Article investigation reveals mythological references requiring expert analysis",
 
224
  },
225
  {
226
  "id": "rel_006",
227
+ "source": "task_002",
228
+ "target": "task_003",
229
  "type": "NEXT",
230
  "importance": "HIGH",
231
  "interaction_prompt": "Mythological analysis feeds into comprehensive validation process",
 
239
  },
240
  {
241
  "id": "rel_007",
242
+ "source": "task_003",
243
+ "target": "output_001",
244
  "type": "PRODUCES",
245
  "importance": "HIGH",
246
  "interaction_prompt": "Validation process produces comprehensive literature analysis",
 
254
  },
255
  {
256
  "id": "rel_008",
257
+ "source": "output_001",
258
+ "target": "human_001",
259
  "type": "DELIVERS_TO",
260
  "importance": "HIGH",
261
  "interaction_prompt": "Literature analysis delivered to academic researcher",
 
269
  },
270
  {
271
  "id": "rel_009",
272
+ "source": "agent_004",
273
+ "target": "task_001",
274
  "type": "USES",
275
  "importance": "MEDIUM",
276
  "interaction_prompt": "Computer Terminal provides database access for article research",
backend/database/samples/knowledge_graphs/kg_algorithm_sample_16.json CHANGED
@@ -149,8 +149,8 @@
149
  "relations": [
150
  {
151
  "id": "rel_001",
152
- "source_id": "input_001",
153
- "target_id": "agent_001",
154
  "type": "CONSUMED_BY",
155
  "importance": "HIGH",
156
  "interaction_prompt": "Invasive species data request consumed by Data Analysis Expert",
@@ -164,8 +164,8 @@
164
  },
165
  {
166
  "id": "rel_002",
167
- "source_id": "agent_001",
168
- "target_id": "task_001",
169
  "type": "PERFORMS",
170
  "importance": "HIGH",
171
  "interaction_prompt": "Data Analysis Expert performs government dataset processing",
@@ -179,8 +179,8 @@
179
  },
180
  {
181
  "id": "rel_003",
182
- "source_id": "agent_002",
183
- "target_id": "task_002",
184
  "type": "PERFORMS",
185
  "importance": "HIGH",
186
  "interaction_prompt": "Statistical Analysis Expert performs population statistics calculation",
@@ -194,8 +194,8 @@
194
  },
195
  {
196
  "id": "rel_004",
197
- "source_id": "agent_003",
198
- "target_id": "task_003",
199
  "type": "PERFORMS",
200
  "importance": "HIGH",
201
  "interaction_prompt": "Data Verification Expert performs ecological data validation",
@@ -209,8 +209,8 @@
209
  },
210
  {
211
  "id": "rel_005",
212
- "source_id": "task_001",
213
- "target_id": "task_002",
214
  "type": "NEXT",
215
  "importance": "HIGH",
216
  "interaction_prompt": "Processed dataset feeds into statistical analysis pipeline",
@@ -224,8 +224,8 @@
224
  },
225
  {
226
  "id": "rel_006",
227
- "source_id": "task_002",
228
- "target_id": "task_003",
229
  "type": "NEXT",
230
  "importance": "HIGH",
231
  "interaction_prompt": "Statistical results undergo validation and quality assessment",
@@ -239,8 +239,8 @@
239
  },
240
  {
241
  "id": "rel_007",
242
- "source_id": "task_003",
243
- "target_id": "output_001",
244
  "type": "PRODUCES",
245
  "importance": "HIGH",
246
  "interaction_prompt": "Validation process produces final ecological statistics",
@@ -254,8 +254,8 @@
254
  },
255
  {
256
  "id": "rel_008",
257
- "source_id": "output_001",
258
- "target_id": "human_001",
259
  "type": "DELIVERS_TO",
260
  "importance": "HIGH",
261
  "interaction_prompt": "Validated statistics delivered to wildlife researcher",
@@ -269,8 +269,8 @@
269
  },
270
  {
271
  "id": "rel_009",
272
- "source_id": "agent_004",
273
- "target_id": "task_001",
274
  "type": "USES",
275
  "importance": "HIGH",
276
  "interaction_prompt": "Computer Terminal provides access to government databases",
 
149
  "relations": [
150
  {
151
  "id": "rel_001",
152
+ "source": "input_001",
153
+ "target": "agent_001",
154
  "type": "CONSUMED_BY",
155
  "importance": "HIGH",
156
  "interaction_prompt": "Invasive species data request consumed by Data Analysis Expert",
 
164
  },
165
  {
166
  "id": "rel_002",
167
+ "source": "agent_001",
168
+ "target": "task_001",
169
  "type": "PERFORMS",
170
  "importance": "HIGH",
171
  "interaction_prompt": "Data Analysis Expert performs government dataset processing",
 
179
  },
180
  {
181
  "id": "rel_003",
182
+ "source": "agent_002",
183
+ "target": "task_002",
184
  "type": "PERFORMS",
185
  "importance": "HIGH",
186
  "interaction_prompt": "Statistical Analysis Expert performs population statistics calculation",
 
194
  },
195
  {
196
  "id": "rel_004",
197
+ "source": "agent_003",
198
+ "target": "task_003",
199
  "type": "PERFORMS",
200
  "importance": "HIGH",
201
  "interaction_prompt": "Data Verification Expert performs ecological data validation",
 
209
  },
210
  {
211
  "id": "rel_005",
212
+ "source": "task_001",
213
+ "target": "task_002",
214
  "type": "NEXT",
215
  "importance": "HIGH",
216
  "interaction_prompt": "Processed dataset feeds into statistical analysis pipeline",
 
224
  },
225
  {
226
  "id": "rel_006",
227
+ "source": "task_002",
228
+ "target": "task_003",
229
  "type": "NEXT",
230
  "importance": "HIGH",
231
  "interaction_prompt": "Statistical results undergo validation and quality assessment",
 
239
  },
240
  {
241
  "id": "rel_007",
242
+ "source": "task_003",
243
+ "target": "output_001",
244
  "type": "PRODUCES",
245
  "importance": "HIGH",
246
  "interaction_prompt": "Validation process produces final ecological statistics",
 
254
  },
255
  {
256
  "id": "rel_008",
257
+ "source": "output_001",
258
+ "target": "human_001",
259
  "type": "DELIVERS_TO",
260
  "importance": "HIGH",
261
  "interaction_prompt": "Validated statistics delivered to wildlife researcher",
 
269
  },
270
  {
271
  "id": "rel_009",
272
+ "source": "agent_004",
273
+ "target": "task_001",
274
  "type": "USES",
275
  "importance": "HIGH",
276
  "interaction_prompt": "Computer Terminal provides access to government databases",
backend/database/samples/knowledge_graphs/kg_algorithm_sample_3.json CHANGED
@@ -149,8 +149,8 @@
149
  "relations": [
150
  {
151
  "id": "rel_001",
152
- "source_id": "input_001",
153
- "target_id": "agent_001",
154
  "type": "CONSUMED_BY",
155
  "importance": "HIGH",
156
  "interaction_prompt": "Game theory riddle consumed by Probability Expert for analysis",
@@ -164,8 +164,8 @@
164
  },
165
  {
166
  "id": "rel_002",
167
- "source_id": "agent_001",
168
- "target_id": "task_001",
169
  "type": "PERFORMS",
170
  "importance": "HIGH",
171
  "interaction_prompt": "Probability Expert performs statistical analysis and calculations",
@@ -179,8 +179,8 @@
179
  },
180
  {
181
  "id": "rel_003",
182
- "source_id": "agent_002",
183
- "target_id": "task_002",
184
  "type": "PERFORMS",
185
  "importance": "HIGH",
186
  "interaction_prompt": "Theoretical Chemistry Expert performs chemical process modeling",
@@ -194,8 +194,8 @@
194
  },
195
  {
196
  "id": "rel_004",
197
- "source_id": "agent_003",
198
- "target_id": "task_003",
199
  "type": "PERFORMS",
200
  "importance": "HIGH",
201
  "interaction_prompt": "Verification Expert performs solution validation",
@@ -209,8 +209,8 @@
209
  },
210
  {
211
  "id": "rel_005",
212
- "source_id": "task_001",
213
- "target_id": "task_002",
214
  "type": "NEXT",
215
  "importance": "MEDIUM",
216
  "interaction_prompt": "Probability calculations inform chemistry modeling requirements",
@@ -224,8 +224,8 @@
224
  },
225
  {
226
  "id": "rel_006",
227
- "source_id": "task_002",
228
- "target_id": "task_003",
229
  "type": "NEXT",
230
  "importance": "HIGH",
231
  "interaction_prompt": "Chemical modeling results feed into validation process",
@@ -239,8 +239,8 @@
239
  },
240
  {
241
  "id": "rel_007",
242
- "source_id": "task_003",
243
- "target_id": "output_001",
244
  "type": "PRODUCES",
245
  "importance": "HIGH",
246
  "interaction_prompt": "Validation process produces final verified solutions",
@@ -254,8 +254,8 @@
254
  },
255
  {
256
  "id": "rel_008",
257
- "source_id": "output_001",
258
- "target_id": "human_001",
259
  "type": "DELIVERS_TO",
260
  "importance": "HIGH",
261
  "interaction_prompt": "Validated solutions delivered to game participant",
@@ -269,8 +269,8 @@
269
  },
270
  {
271
  "id": "rel_009",
272
- "source_id": "agent_004",
273
- "target_id": "task_001",
274
  "type": "USES",
275
  "importance": "MEDIUM",
276
  "interaction_prompt": "Computer Terminal supports probability calculations",
 
149
  "relations": [
150
  {
151
  "id": "rel_001",
152
+ "source": "input_001",
153
+ "target": "agent_001",
154
  "type": "CONSUMED_BY",
155
  "importance": "HIGH",
156
  "interaction_prompt": "Game theory riddle consumed by Probability Expert for analysis",
 
164
  },
165
  {
166
  "id": "rel_002",
167
+ "source": "agent_001",
168
+ "target": "task_001",
169
  "type": "PERFORMS",
170
  "importance": "HIGH",
171
  "interaction_prompt": "Probability Expert performs statistical analysis and calculations",
 
179
  },
180
  {
181
  "id": "rel_003",
182
+ "source": "agent_002",
183
+ "target": "task_002",
184
  "type": "PERFORMS",
185
  "importance": "HIGH",
186
  "interaction_prompt": "Theoretical Chemistry Expert performs chemical process modeling",
 
194
  },
195
  {
196
  "id": "rel_004",
197
+ "source": "agent_003",
198
+ "target": "task_003",
199
  "type": "PERFORMS",
200
  "importance": "HIGH",
201
  "interaction_prompt": "Verification Expert performs solution validation",
 
209
  },
210
  {
211
  "id": "rel_005",
212
+ "source": "task_001",
213
+ "target": "task_002",
214
  "type": "NEXT",
215
  "importance": "MEDIUM",
216
  "interaction_prompt": "Probability calculations inform chemistry modeling requirements",
 
224
  },
225
  {
226
  "id": "rel_006",
227
+ "source": "task_002",
228
+ "target": "task_003",
229
  "type": "NEXT",
230
  "importance": "HIGH",
231
  "interaction_prompt": "Chemical modeling results feed into validation process",
 
239
  },
240
  {
241
  "id": "rel_007",
242
+ "source": "task_003",
243
+ "target": "output_001",
244
  "type": "PRODUCES",
245
  "importance": "HIGH",
246
  "interaction_prompt": "Validation process produces final verified solutions",
 
254
  },
255
  {
256
  "id": "rel_008",
257
+ "source": "output_001",
258
+ "target": "human_001",
259
  "type": "DELIVERS_TO",
260
  "importance": "HIGH",
261
  "interaction_prompt": "Validated solutions delivered to game participant",
 
269
  },
270
  {
271
  "id": "rel_009",
272
+ "source": "agent_004",
273
+ "target": "task_001",
274
  "type": "USES",
275
  "importance": "MEDIUM",
276
  "interaction_prompt": "Computer Terminal supports probability calculations",
backend/database/samples/samples_config.json CHANGED
@@ -144,7 +144,7 @@
144
  "id": "algorithm_sample_16",
145
  "name": "Wildlife Data Analysis and Ecological Monitoring System",
146
  "description": "Comprehensive ecological data analysis system specializing in government wildlife datasets and invasive species monitoring. Demonstrates data science applications in conservation and ecological research.",
147
- "trace_file": "traces/algorithm_sample_16.json",
148
  "knowledge_graph_file": "knowledge_graphs/kg_algorithm_sample_16.json",
149
  "tags": [
150
  "multi_agent",
 
144
  "id": "algorithm_sample_16",
145
  "name": "Wildlife Data Analysis and Ecological Monitoring System",
146
  "description": "Comprehensive ecological data analysis system specializing in government wildlife datasets and invasive species monitoring. Demonstrates data science applications in conservation and ecological research.",
147
+ "trace_file": "traces/algorithm_sample_16.json",
148
  "knowledge_graph_file": "knowledge_graphs/kg_algorithm_sample_16.json",
149
  "tags": [
150
  "multi_agent",