Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -236,20 +236,11 @@ def run_ontology_structure_analysis():
|
|
236 |
def run_entity_exploration():
|
237 |
st.title("Entity Exploration")
|
238 |
|
239 |
-
#
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
entities = []
|
245 |
-
for class_name in ontology_manager.get_classes():
|
246 |
-
class_entities = [
|
247 |
-
node for node, attr in ontology_manager.graph.nodes(data=True)
|
248 |
-
if attr.get("type") == "instance" and safe_match(class_name, attr.get("class_type"))
|
249 |
-
]
|
250 |
-
if class_entities:
|
251 |
-
entities.extend(class_entities)
|
252 |
-
|
253 |
entities = sorted(set(entities))
|
254 |
|
255 |
# Debug info
|
@@ -276,9 +267,8 @@ def run_entity_exploration():
|
|
276 |
max_distance=max_distance,
|
277 |
include_classes=True
|
278 |
)
|
279 |
-
|
280 |
st.warning("No entities found in the ontology.")
|
281 |
-
|
282 |
|
283 |
if selected_entity:
|
284 |
# Get entity information
|
|
|
236 |
def run_entity_exploration():
|
237 |
st.title("Entity Exploration")
|
238 |
|
239 |
+
# 從圖中抓出所有實體(不依賴 ontology["classes"] 中的列表)
|
240 |
+
entities = [
|
241 |
+
node for node, attr in ontology_manager.graph.nodes(data=True)
|
242 |
+
if attr.get("type") == "instance"
|
243 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
entities = sorted(set(entities))
|
245 |
|
246 |
# Debug info
|
|
|
267 |
max_distance=max_distance,
|
268 |
include_classes=True
|
269 |
)
|
270 |
+
else:
|
271 |
st.warning("No entities found in the ontology.")
|
|
|
272 |
|
273 |
if selected_entity:
|
274 |
# Get entity information
|