Veezoo

Entity

Definition

An entity is an instantiation or an individual of a class.

A class could be something like:

  • Customer
  • Country
  • Order
  • Movie

Now, each of these classes may have instantiations of it. In programming, we call these "objects". In VKL, we call them entities. So following our example, we may have entities like:

  • entity Till_Haug of class Customer
  • entity Brazil of class Country
  • entity Batman of class Movie

But what about Order? For classes like Order, Transaction and Event, it makes sense usually to model it as a class without entities. Prefer to use classes with entities when there is a way to refer to an individual of this class in a question.

Usage

Entities are generated based on the sql of a class. Check its reference page to learn more about it.

kb.Customer {
    entity 00042_Arthur_Dent_1234 {         
        name.en: "[00042] Arthur Dent"

        synonym.en: "Arthur Dent"

        id: "00042"
    }
    ...
}

The id property holds the raw value as stored in the database, which this entity represents. The name and synonym properties define how the entity is displayed and how users can refer to it in questions - a synonym lets users use words that never appear in the data (e.g. "Midwest" for a region stored as "Central").

Entities can carry a few more properties:

  • description - explains the entity to users (can be generated via description_sql).
  • parent - the parent entity in a hierarchy class, referenced by its entity name within the same class.
  • sort_id - the position of the entity in an ordinal class.
  • chart_color - a fixed chart color, see below.

It is important to notice that entities, like any other Knowledge Graph concept, lives only in your Knowledge Graph. This means that whatever changes you make to its properties, like name or synonym, will not be written to your database.

In fact, Veezoo does not require any write access to your database and we recommend using read-only database credentials.

Chart Color

You can define a specific color for an entity using the chart_color property. This color will be used consistently when the entity appears in charts.

kb.Country {
    entity Switzerland {
        name.en: "Switzerland"
        chart_color: "#FF0000"  // Red
    }
    
    entity Germany {
        name.en: "Germany"
        chart_color: "#000000"  // Black
    }
}

The color must be a hex code (e.g., "#FF0000"). If not specified, Veezoo assigns colors automatically from its default palette.