semantica.seed gives your knowledge graph a reliable, verified starting point:
  • Load verified reference data first: ISO codes, employee rosters, product catalogs, domain taxonomies
  • SeedDataManager merges freshly extracted data onto foundation nodes without creating duplicates
  • Supports JSON, CSV, and programmatic registration of seed sources
  • Deterministic test graph generation from structured seed data
  • Anchors entity extraction to known entities, reducing hallucination and duplicate nodes

Exported Classes

What You Get

  • SeedDataManager — Register sources, build a foundation graph, validate quality, and merge with extracted data.
  • SeedDataSource — Typed source definition supporting CSV, JSON, SQL, and API with format-specific config.
  • Foundation Graph — Build a foundation graph from all registered sources in one pass, ready to merge with extracted data.
  • Merge Strategiesseed_first, extracted_first, and merge with property-level conflict detection.
  • Validation — Required field checks, ID uniqueness, type consistency, reference integrity, and encoding validation before loading.
  • Versioning — Track seed data versions across pipeline runs and diff changes between versions.
When to use the Seed Module: Bootstrapping with structured reference data (taxonomies, user lists, product catalogs), loading immutable facts (ISO country codes, standard ontology terms) that extracted data should not override, ensuring test reproducibility with deterministic datasets, and anchoring entity disambiguation with canonical forms.

Quick Start

1

Register your seed sources

Register all sources before calling create_foundation_graph(). create_foundation_graph() processes all registered sources in one pass. Registering a source after calling it means that source is silently excluded. Register all sources at the start of your script, then call create_foundation_graph() once.
2

Build the foundation graph

3

Validate before loading

Validate before loading. manager.validate_quality(seed_data) catches missing required fields, type inconsistencies, and duplicate IDs before they corrupt your graph. Running validation after loading means you’ll need to roll back. Validation is fast: always run it first.
4

Merge with extracted data

Load seed data before extracted data. Seed data is your ground truth: normalised, curated, and already de-duplicated. Load it first with create_foundation_graph(), then merge extracted entities on top. Merging in the wrong order lets noisy extracted data overwrite trusted reference values.

SeedDataSource Types

SeedDataManager Reference

Different strategies for resolving conflicts during integrate_with_extracted():
Seed data wins conflicts: preserves curated relationships over extracted ones.
Use when seed data is high-confidence and extraction is exploratory.
Use seed_first merge strategy for reference data. When seed data encodes authoritative facts (official company names, canonical taxonomy IDs, employee records), merge_strategy="seed_first" ensures those values win over extracted values. Use merge only when extracted data may be more current than the seed.

Full Pipeline Example

YAML Configuration

Define sources in YAML for production deployments: no code changes needed to switch environments:
Environment variable overrides:
Use YAML configuration for production deployments. Hard-coding source paths in Python scripts makes environment-switching (dev → staging → prod) fragile. Declare sources in config.yaml under the seed: key and override paths with SEMANTICA_SEED_DATA_DIR. This way, the same code runs in every environment.
  • Ingest — Load unstructured data alongside seed data.
  • Knowledge Graph — The target graph that seed data populates.
  • Deduplication — Handle duplicates during seed-extracted merge.
  • Pipeline — Incorporate seed loading as a named pipeline step.