What it does
Supplies an ontology (RDF/OWL, Turtle, or JSON-LD) to cognify so extracted entities are matched and grounded against a known vocabulary. TheOntologyResolver loads the file and matches
extracted entity names/types to ontology terms during knowledge-graph
extraction.
When to use it
- You have a controlled vocabulary / taxonomy and want extraction to align with it (consistent entity types, canonical names).
- You want to constrain or normalize the messy free-form output of an LLM.
CLI
cognee-cli cognify exposes the ontology file directly:
--ontology-file <path>
(crates/cli/src/cli.rs, CognifyArgs).
Configuration (env / config keys)
You can also set the ontology globally instead of per-invocation:ontology.resolver selects an OntologyResolverFactory on the component
registry. Only rdflib (RDF/JSON-LD/Turtle) is built in, and it implements only
the fuzzy matching strategy (it warns on any other). An external crate can add
a resolver with ComponentRegistry::register_ontology_resolver. See
Configuration: Ontology for the full surface.
Supported formats
RDF/OWL, Turtle, and JSON-LD, parsed via thesophia family of crates. See
crates/ontology/ for the resolver implementations and
the test fixtures under crates/ontology/tests/fixtures/.
Pointers
crates/ontology/—OntologyResolver,RdfLibOntologyResolver,NoOpOntologyResolver.crates/cli/src/cli.rs—--ontology-file.- Configuration — ontology env vars.
- Operations — cognify stage.