Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -262,17 +262,21 @@ def run_entity_exploration():
|
|
262 |
)
|
263 |
|
264 |
if neighborhood and "neighbors" in neighborhood:
|
|
|
265 |
for distance in range(1, max_distance+1):
|
266 |
neighbors_at_distance = [n for n in neighborhood["neighbors"] if n["distance"] == distance]
|
267 |
|
268 |
if neighbors_at_distance:
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
|
|
|
|
276 |
|
277 |
elif not entities:
|
278 |
st.warning("No entities found in the ontology.")
|
|
|
262 |
)
|
263 |
|
264 |
if neighborhood and "neighbors" in neighborhood:
|
265 |
+
lines = []
|
266 |
for distance in range(1, max_distance+1):
|
267 |
neighbors_at_distance = [n for n in neighborhood["neighbors"] if n["distance"] == distance]
|
268 |
|
269 |
if neighbors_at_distance:
|
270 |
+
lines.append(f"**Neighbors at Distance {distance} ({len(neighbors_at_distance)})**")
|
271 |
+
for neighbor in neighbors_at_distance:
|
272 |
+
lines.append(f"- **{neighbor['id']}** ({neighbor.get('class_type', 'unknown')})")
|
273 |
+
for relation in neighbor.get("relations", []):
|
274 |
+
direction = "→" if relation["direction"] == "outgoing" else "←"
|
275 |
+
lines.append(f" - {direction} {relation['type']}")
|
276 |
+
lines.append("---")
|
277 |
+
with st.expander("Show Neighbor Details", expanded=False):
|
278 |
+
for line in lines:
|
279 |
+
st.markdown(line)
|
280 |
|
281 |
elif not entities:
|
282 |
st.warning("No entities found in the ontology.")
|