The ontology is a declarative YAML file that defines the structure of your knowledge graph. It specifies the types of entities and relationships that can exist in your graph, acting as a schema to ensure data consistency and to guide the query generation process. By defining a clear and explicit ontology, you enable a1facts to validate incoming data and construct precise queries.

Example

Here is an example of an ontology for financial analysis, taken from the Stock Analysis cookbook example.
company.yaml
name: company_info
description: "Ontology for company information"
entities:
  - name: Company
    description: "A company"
    properties:
      - name: name
        type: string
        description: "The name of the company"
      - name: ticker
        type: string
        description: "The stock ticker of the company"
      - name: description
        type: string
        description: "A description of the company"
  - name: Product_Service
    description: "A product or service offered by a company"
    properties:
      - name: name
        type: string
        description: "The name of the product or service"
  - name: Market
    description: "A market that a company operates in"
    properties:
      - name: name
        type: string
        description: "The name of the market"
relationships:
  - name: competes_with
    description: "A company competes with another company"
    domain: Company
    range: Company
  - name: offers
    description: "A company offers a product or service"
    domain: Company
    range: Product_Service
  - name: operates_in
    description: "A company operates in a market"
    domain: Company
    range: Market

Key Concepts

The ontology is defined by the following key concepts, which are organized into a hierarchical structure in the YAML file.