Seeding#

Loading the ontologies a fresh store needs before anything can be registered.

Shared seeding helpers for knowledge-graph initialization.

These functions load the published/general ontology modules (Core, svc:, mes:) into named graphs, and clear the default graph. Both the example scenarios and the multi-process factory demo use this library code, so it lives here rather than in examples/.

kapps_semantic_middleware.seeding.clear_repository(db) → None[source]#

Clear the repository’s default graph (authorized test repo).

Always run this before seeding, so a scenario never accumulates residual triples from a previous run or a different scenario.

kapps_semantic_middleware.seeding.load_shared_ontologies(db, *, reload: bool = False) → None[source]#

Load the published/general ontology modules, one named graph per ontology.

Every scenario needs Core, svc:, and mes:, and they never change during a run. Each gets its own named graph. It is not re-imported into the default graph on every seed. The clear_repository function clears only the default graph. So a seed wipes the scenario’s own data, and leaves these standing. GraphDB reasons across all graphs, so a domain class still resolves its cfc: superclass from here.

The operation is idempotent. The function skips a present module unless you set reload.