Spaces:
Sleeping
Sleeping
File size: 1,016 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 30 31 32 33 34 35 36 37 38 39 40 | from pathlib import Path
from rdflib import Graph, Namespace, RDF
ROOT = Path(__file__).resolve().parent.parent
TTL = ROOT / "outputs" / "strategy_graph.ttl"
SS = Namespace("http://example.org/strategy-sync#")
def main() -> None:
g = Graph()
g.parse(str(TTL), format="turtle")
print(f"Loaded: {TTL}")
print(f"Total triples: {len(g)}")
strategies = list(g.subjects(RDF.type, SS.Strategy))
actions = list(g.subjects(RDF.type, SS.ActionTask))
links = list(g.triples((None, SS.hasAction, None)))
print(f"Strategies: {len(strategies)}")
print(f"Actions: {len(actions)}")
print(f"hasAction links: {len(links)}")
# Show a couple of examples
print("\nSample Strategy URIs:")
for s in strategies[:3]:
print(f"- {s}")
print("\nSample Action URIs:")
for a in actions[:3]:
print(f"- {a}")
print("\nSample links (Strategy -> Action):")
for s, _, a in links[:5]:
print(f"- {s} -> {a}")
if __name__ == "__main__":
main()
|