What is an ontology in Cognee?

An ontology is an optional RDF/OWL file you can provide to Cognee. It acts as a reference vocabulary, making sure that entity types (“classes”) and entity mentions (“individuals”) extracted from your data are linked to canonical, well-defined concepts. Think of it as adding a dictionary or schema to guide how your graph is built.

How it works

  • You pass ontology_file_path="my_ontology.owl" when running Cognify.
  • Cognee parses the file with RDFLib and loads its classes and relationships.
  • During graph extraction, entities and types are checked against the ontology:
    • If a match is found, the node is marked ontology_valid=True.
    • Parent classes and object-property links from the ontology are attached as extra edges.
  • If no ontology is provided, extraction still works, just without validation or enrichment.

Why use an ontology

  • Consistency: standardize how entities and types are represented
  • Enrichment: bring in inherited relationships from a domain schema
  • Control: align Cognee’s graph with existing enterprise or scientific vocabularies

Supported formats

Any format RDFLib can parse:
  • RDF/XML (.owl, .rdf)
  • Turtle (.ttl)
  • N-Triples, JSON-LD, and others

When to skip it

  • If you don’t supply one, Cognee still extracts nodes and edges.
  • Ontology fields will just remain unvalidated, and no extra structure is added.