D Ф m i И i q ц e L Ф y e r commited on
Commit ·
2b06f78
1
Parent(s): cb7560c
Revert "Fix: Create ontology directories automatically before export"
Browse filesThis reverts commit cb7560cdbf6133efe800f757e646458487a41c28.
syscred/ontology_manager.py
CHANGED
|
@@ -427,7 +427,7 @@ class OntologyManager:
|
|
| 427 |
|
| 428 |
return {'nodes': nodes, 'links': links}
|
| 429 |
|
| 430 |
-
|
| 431 |
"""
|
| 432 |
Export the ontology to a TTL file.
|
| 433 |
|
|
@@ -439,12 +439,6 @@ class OntologyManager:
|
|
| 439 |
True if successful
|
| 440 |
"""
|
| 441 |
try:
|
| 442 |
-
# --- FIX 2.3 : Créer le dossier si nécessaire ---
|
| 443 |
-
output_dir = os.path.dirname(output_path)
|
| 444 |
-
if output_dir:
|
| 445 |
-
os.makedirs(output_dir, exist_ok=True)
|
| 446 |
-
# ----------------------------------------------
|
| 447 |
-
|
| 448 |
if include_base:
|
| 449 |
combined = self.base_graph + self.data_graph
|
| 450 |
combined.serialize(destination=output_path, format='turtle')
|
|
@@ -456,7 +450,6 @@ class OntologyManager:
|
|
| 456 |
except Exception as e:
|
| 457 |
print(f"[OntologyManager] Export error: {e}")
|
| 458 |
return False
|
| 459 |
-
|
| 460 |
|
| 461 |
def save_data(self) -> bool:
|
| 462 |
"""Save the data graph to its configured path."""
|
|
|
|
| 427 |
|
| 428 |
return {'nodes': nodes, 'links': links}
|
| 429 |
|
| 430 |
+
def export_to_ttl(self, output_path: str, include_base: bool = False) -> bool:
|
| 431 |
"""
|
| 432 |
Export the ontology to a TTL file.
|
| 433 |
|
|
|
|
| 439 |
True if successful
|
| 440 |
"""
|
| 441 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
if include_base:
|
| 443 |
combined = self.base_graph + self.data_graph
|
| 444 |
combined.serialize(destination=output_path, format='turtle')
|
|
|
|
| 450 |
except Exception as e:
|
| 451 |
print(f"[OntologyManager] Export error: {e}")
|
| 452 |
return False
|
|
|
|
| 453 |
|
| 454 |
def save_data(self) -> bool:
|
| 455 |
"""Save the data graph to its configured path."""
|