Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -236,10 +236,17 @@ def run_ontology_structure_analysis():
|
|
236 |
def run_entity_exploration():
|
237 |
st.title("Entity Exploration")
|
238 |
|
239 |
-
#
|
|
|
|
|
|
|
|
|
240 |
entities = []
|
241 |
for class_name in ontology_manager.get_classes():
|
242 |
-
class_entities =
|
|
|
|
|
|
|
243 |
if class_entities:
|
244 |
entities.extend(class_entities)
|
245 |
|
@@ -271,6 +278,7 @@ def run_entity_exploration():
|
|
271 |
)
|
272 |
elif not entities:
|
273 |
st.warning("No entities found in the ontology.")
|
|
|
274 |
|
275 |
if selected_entity:
|
276 |
# Get entity information
|
|
|
236 |
def run_entity_exploration():
|
237 |
st.title("Entity Exploration")
|
238 |
|
239 |
+
# 永久修正:從 class_name 與圖中的 class_type 做不區分大小寫比對
|
240 |
+
def safe_match(class_name, class_type):
|
241 |
+
return class_name.strip().lower() == class_type.strip().lower() if class_type else False
|
242 |
+
|
243 |
+
# 重新抓取實體:正確比對 class_type
|
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 |
|
|
|
278 |
)
|
279 |
elif not entities:
|
280 |
st.warning("No entities found in the ontology.")
|
281 |
+
|
282 |
|
283 |
if selected_entity:
|
284 |
# Get entity information
|