AD2000X commited on
Commit
bf7e005
·
verified ·
1 Parent(s): e127e76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -16
app.py CHANGED
@@ -236,20 +236,11 @@ def run_ontology_structure_analysis():
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
-
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
- elif not entities:
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