Objects and associations

video locked
Enroll to watch

5 mins

Chapters
About
Discussion0
Notes
Be the first to start a conversation!

TAO's data model has two records, an object and an association.

An object has an ID, a type and a set of key value pairs. A profile with the name Gaurav is an object.

An association links two objects. It has a source ID, a type, a destination ID, a timestamp and a map of key value pairs. Gaurav is linked to India by an association of type nationality.

The timestamp is there for two reasons:

  1. Ordering. One request comes first, another later.
  2. Recent event sorting. Most objects that are accessed were created recently, and old posts are rarely seen.

The source ID, type and destination ID are unique. A post is liked or not liked, so an association maps a one-time event well. A second check-in at the same hotel is not allowed.

Objects map repeatable actions. Each comment on a post is an object, and so is a check-in.

An inverse makes an association bidirectional. Gaurav is friends with Pankaj, so Pankaj is also friends with Gaurav.

The API adds, deletes and updates an association.