Utilizing Relationships in Aito

Documentation

September 3, 2019

Table linking is a crucial feature of Aito. A table can contain link columns which express relationships with other tables and are similar to foreign keys in SQL databases. When a table has links you can make queries which predict the linked row or properties of the linked row.

Inference with linked tables

Aito can use the linked tables information to perform inference operation.

Let's consider a case of job matching where we have the following schema:

Job matching data

The table "Match History" is linked to the table "Job Information" and the table "People Information". Given descriptions of a job, Aito is able to match a person to the job based on the matching history, and vice versa. For instance, the following match query:

{
  "from": "match_history",
  "where": {
    "job.position": "music producer",
    "job.company": "w bros"
  },
  "match": person
}

would match the most suitable person for the position "music producer" at the "w bros" company.

Internally, Aito finds the statical relationships between the columns (fields) of the people information table and the job criteria. In other words, Aito discovers if there's any pattern between people's previous jobs, degrees, etc. and "music producer" and "w bros". This alleviates the problem of the lack of training data in machine learning problems. In this case, a person might not show up in the match results because she/he does not appear in the training data (the match history table). However, with the links, Aito can still match jobs with people, who do not appear in the "match history", if they possess qualities (e.g: previous job, degree, etc.) that have strong patterns with the job criterion.

Links and join operations

Aito follows and expands links when they are used in queries. If you are familiar with SQL, the behavior is similar to left join and inner join, except tables are joined implicitly.

Consider a case where you have a table of transactions and a table of users table. The field "user" of the "transactions" table is linked to the field "id" of the "users" table.

Users and user contacts tables

The generic query

{
  "from": "transactions",
  "select": ["user", "user.name"]
}

behaves similarly to a LEFT JOIN operation in SQL:

SELECT transactions.user, users.name
FROM transactions
LEFT JOIN users
ON transactions.user = users.id

In combination with the $defined operator, Aito can also perform an INNER JOIN. The following generic query

{
  "from": "transactions",
  "where": {
    "user.id":{ "$defined": true }
  }.
  "select": ["user", "user.name"]
}

behaves similarly to a INNER JOIN operation in SQL:

SELECT transactions.user, users.name
FROM transactions
INNER JOIN users
ON transactions.user = users.id

which uses INNER JOIN.

Back to developer docs

Locations

Aito Intelligence Oy

Kaivokatu 10 A, 8th floor

00100 Helsinki

Finland

VAT ID FI28756352

See map

470 Ramona St.

Palo Alto

CA 94301, USA

See map

Contact

COVID-19 situation has driven us all to work from homes, please connect with us online. Stay safe & play with data!

About usContact usJoin our Slack workspace

Follow us