Schema Builder

Note

The following is a sample from a previous documentation project for a backend machine learning service. Names and identifying content have been changed.

A schema is used to describe your unique business data, modelling your company’s chosen entities as Objects. These objects include the default User as well as any other you may need. For example, Post, Book, Order, or Hotel Room. Objects in [company name] can be described in greater detail using Attributes and Labels. The way a user may interact with other users or objects is described using Interactions. In order to start the learning process, you’ll need to create and publish your first Schema. Once a version is published, you are able to make further changes, which are saved for you in a draft until you are ready to Publish again.

This page covers how to add schema elements using the Schema Builder. Learn more about the elements of a schema here.

The Schema Builder

Screenshot of the Schema Builder page with key areas marked. Screenshot of the Schema Builder page with key areas marked.

Label # Name Description
1 Schema Name and Version Here you will find the current name and version id of the schema in your team. Schema versions are integer-based, beginning with version 1
2 Version Toolbar The Schema Version includes buttons for uploading a JSON schema (Advanced) and for publishing a new schema for Begin AI to learn from.
3 Building Toolbar The core activities of building a schema are included here. Using these simple building blocks, you will be able to describe and customize your entities.
4 User Object (Default) The default object in any new team is a User object. This can be appended to include your organization’s data points as needed, but cannot be removed or renamed.

Adding a New Object

To add a new object:

Screenshot of the Schema Builder page with the Add Object menu opened. An object with the name ‘book’ is being created. Key areas are marked for the steps described below. Screenshot of the Schema Builder page with the Add Object menu opened. An object with the name ‘book’ is being created. Key areas are marked for the steps described below.

  1. Select Add Object to expand the associated menu.
  2. Enter the name.
  3. Select save.

The name is automatically formatted to snake_case format. You can preview the object name in the preview below the name form.

Adding an Object Attribute

To add an object attribute:

Screenshot of the User object with three interactions included: ‘session’, ‘book’, and ‘reads’. Under ‘reads’, an interaction attribute labelled ‘finished_reading’ is pending. Screenshot of the User object with three interactions included: ‘session’, ‘book’, and ‘reads’. Under ‘reads’, an interaction attribute labelled ‘finished_reading’ is pending.

  1. Select Add Attribute to expand the associated menu.
  2. Select the object you would like to add an attribute to from the object dropdown menu.
  3. Name the attribute in teh Attribute Name field. It will automatically convert to snake_case in the preview below the field.
  4. Select the attribute type from the Type dropdown menu.
  5. Select Save. Once saved, the attribute will be added to the draft schema.

Screenshot of the draft schema with the newly created author_name attribute. Screenshot of the draft schema with the newly created author_name attribute.

Adding an Object Label

To add an object label:

Screenshot of the Schema Builder page with the Add Label menu opened. An object with the name ‘user’ is in the process of having a ‘is_fake’ label created. Key areas are marked for the steps described below. Screenshot of the Schema Builder page with the Add Label menu opened. An object with the name ‘user’ is in the process of having a ‘is_fake’ label created. Key areas are marked for the steps described below.

  1. Select Add Label. The corresponding menu will expand.
  2. Select the object to label from the Object dropdown menu.
  3. Enter the label name in the Label Name field. The preview below the field will show the output in snake_case.
  4. Select Save.

Once created, the new label will be shown below the associated object.

Screenshot of two objects. The ‘User’ object shows two labels underneath ‘is_fake’ and ’not_fake’. Screenshot of two objects. The ‘User’ object shows two labels underneath ‘is_fake’ and ’not_fake’.

Adding an Object Interaction

To add an interaction:

Screenshot of the Schema Builder page with the Add Interaction menu opened. An object with the name ‘book’ is in the process of having a ‘reads’ interaction created. Key areas are marked for the steps described below. Screenshot of the Schema Builder page with the Add Interaction menu opened. An object with the name ‘book’ is in the process of having a ‘reads’ interaction created. Key areas are marked for the steps described below.

  1. Select Add Interaction. The corresponding menu will expand.
  2. Select the object you would like to add an interaction to using the To Object dropdown.
  3. Enter the interaction name in the Interaction Name field. The preview below the field will show the output in snake_case.
  4. Select Save. This will add the interaction to your chosen object in the schema draft.

Screenshot of the Schema Builder page. There are two objects: ‘book’ and ‘user’. The ‘user’ object has three interactions created: ‘session’, ‘book’, and the newly created ‘reads’. ‘Reads’ is marked as pending. Screenshot of the Schema Builder page. There are two objects: ‘book’ and ‘user’. The ‘user’ object has three interactions created: ‘session’, ‘book’, and the newly created ‘reads’. ‘Reads’ is marked as pending.

Adding an Attribute to an Object Interaction

Attributes enable you to add more details to the interaction between two objects. They are composed of a name and a type. Some types have more parameters available.

The types available are:

  • boolean
  • number(includes optional parameters for minv, maxv, and num_slices)
  • date(includes an optional parameter for min_date)
  • category(includes required options for category names)

To create an interaction attribute:

Screenshot of the Schema Builder page with the Add Interaction Attribute menu opened. An object with the name ‘book’, with the interaction ‘reads’ is in the process of having a ‘finished_reading’ boolean attribute created. Key areas are marked for the steps described below. Screenshot of the Schema Builder page with the Add Interaction Attribute menu opened. An object with the name ‘book’, with the interaction ‘reads’ is in the process of having a ‘finished_reading’ boolean attribute created. Key areas are marked for the steps described below.

  1. Select Add Interaction Attribute. The corresponding menu will expand.
  2. Select the target object.
  3. Select the target interaction.
  4. Enter the attribute name in the Attribute Name field. The preview below the field will show the output in snake_case.
  5. Select the attribute type from the Type dropdown.
  6. Select Save.

Once the new interaction attribute is created, it will appear under the interaction.

Screenshot of the User object with three interactions included: ‘session’, ‘book’, and ‘reads’. Under ‘reads’, an interaction attribute labelled ‘finished_reading’ is pending. Screenshot of the User object with three interactions included: ‘session’, ‘book’, and ‘reads’. Under ‘reads’, an interaction attribute labelled ‘finished_reading’ is pending.

Publishing Your Schema

Once all objects, labels, attributes, and interactions are added. Select Publish.

This action will consolidate all of your pending changes into our backend. You will now be able to target your new active schema with any new algorithm projects you create.

You can make future changes to this schema from the Data Schema page. The version number will increase with every publication. Any changes to the draft will not affect any active algorithm projects.

You’re ready to begin your project.

Note

If you have a JSON schema already created, you can upload it directly without having to manually repeat each item. Click here to learn how to build a JSON schema.