Module 3 · Lecture 3.2
Classes & Attributes
Parent classes, attribute classes, the sql tag, and the attribute types the Knowledge Graph is built from.
You have already seen classes in passing, one renamed and one promoted in the previous lecture. This lecture makes the definitions explicit: what classes and attributes are, how both are anchored to the database with a sql tag, and which type each attribute should get.
Key points
- Class: a core business concept people ask about, such as customer, product or region. The Knowledge Graph is built around them.
- Two kinds of classes: a parent class is usually defined from a table, so one row is one instance. An attribute class lives inside a parent class and is defined by a single column.
- Attributes: everything a class carries - attribute classes, numbers, booleans, strings and dates.
- The
sqltag: tells Veezoo what to use in the generated SQL. For an attribute that is its column, and for a parent class it is a value that is unique per row, usually an ID. - Class or not: a column deserves to be a class when it holds a smallish, finite set of values worth recognising individually, such as regions or product categories.
- Numbers and booleans: numbers are values Veezoo computes on - sums, averages, and the KPIs built on them. Booleans are binary flags such as online versus offline.
- Strings and dates: strings are free text searched with contains, and dates are points in time that come as a year, a date or a date with time.
- Relationships: connect classes to each other and get their own lecture later in this module.
Check your understanding
The class Line Item is defined with "from table". What does one instance of Line Item correspond to?
Parent classes are defined via a table, so one row represents one instance of the class.
A parent class stands for a whole row, yet it still carries a sql tag. What belongs in it?
The sql tag gives Veezoo one stable value to identify each instance by, and a unique ID per row does exactly that.
A column holds sales amounts that users want summed and averaged. Which attribute type does it get?
Numbers are the values Veezoo computes on, and sums, averages and KPIs are built on top of them.