Linking
  • 13 Jul 2020
  • 2 Minutes To Read
  • Print
  • Share
  • Dark
    Light

Linking

  • Print
  • Share
  • Dark
    Light

Table linking is a crucial feature of Aito. A table can contain linked 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 table's information to perform inference operation.

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

Your browser does not support Svg.click here to download

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.

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.

Was This Article Helpful?