Spaces:
Sleeping
Sleeping
File size: 773 Bytes
a91323c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from pathlib import Path
import sys
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))
from src import ontology # noqa: E402
try:
build_graph_from_files = ontology.build_graph_from_files
except AttributeError:
build_graph_from_files = ontology.build_graph
save_graph = ontology.save_graph
ONTOLOGY = ROOT / "docs" / "ontology.ttl"
STRATEGY_JSON = ROOT / "data" / "strategic.json"
ACTION_JSON = ROOT / "data" / "action.json"
OUTPUT_TTL = ROOT / "outputs" / "strategy_graph.ttl"
def main() -> None:
g = build_graph_from_files(ONTOLOGY, STRATEGY_JSON, ACTION_JSON)
out = save_graph(g, OUTPUT_TTL, fmt="turtle")
print(f"Saved RDF graph to: {out}")
print(f"Triples count: {len(g)}")
if __name__ == "__main__":
main()
|