How do I create Schemas?
Orbita lets developers define and manage custom data types using schemas. A schema defines content types, dynamic data models, and personas of the people with whom the application interacts. The information is stored and used by the applications you create.
For example, you can define a schema to track the number of times a user uses a voice application that includes properties with types such as:
Number of Visits (Number)
User (ID)
Last Visit (Date)
This topic shows two example schemas: a Visit Tracker, and a new Tip node for Experience Designer.
Schemas are not project-specific. If you define a schema, it will be available in any project within the same environment.
You cannot have duplicate schema name within the same environment.
Schema Fields
You can use predefined templates for each field.
Go to the Schema edit page.
Click on the help icon next to the schema editor to get the help window.
On the help window, click on the field type you wish to add to the schema.
For example, if you wish to add a text field to the schema, click on Text.
Copy the schema field code from the pop-up window.
Close the pop-up window and paste the copied content to the schema editor.
Change the
label
andkey
(should be unique) properties to identify the field.Save the schema.
The code for the schema field typically contains the below-listed properties.
{
"label": "Sample",
"key": "sample",
"isDefault": false,
"validation": [
{
"required": false
}
],
"options": [],
"multiple": false,
"ref": "",
"fieldType": "text",
"type": "String"
"es": "geo_point",
"comment": "this is a comment"
}
Field Property | Description |
---|---|
| Enter a label for the field. |
| Use lowercase alphabetic letters without spaces. |
| Boolean (true or false). This feature has been deprecated. The default value is false. |
| An array with the “required” object, which can be true or false. |
| This array will be used when you use fields such as checkbox, file, dropdown and so on. |
|
|
| This field is used to refer another schema within this schema. See, How do I reference other schemas in a schema? |
| Represents the type of field you are going to add. You can see the list of supported field types from the help window. |
| Represents the datatype of the field. (values the field can take). For example, string, boolean, integer, and so on. |
| Elasticsearch Supported types are available at https://www.elastic.co/guide/en/elasticsearch/reference/6.8/mapping-types.html |
| You can add comments using this property. |
To add extra fields, copy the object structure with the fields array and add it with the comma-separated values before the end of the fields array().
When creating a Content schema, the Experience Manager automatically creates the Title and Tags fields in your schema. These fields are mandatory.
The TTL(in days) is the time after which the documents created based on this schema will get removed after the specified time.
Example: Create a Visit Tracker
The following examples create a schema called VisitTracker.
Log in as an Administrator to the Experience Manager.
Click Schema Management and then Content Types.
Click Add (plus button in the middle panel).
Enter the following information:
Name. VisitTracker
Description. Track the number of visits
Tags. VisitTracker
In the schema edit panel, enter:
{ "fields": [ { "key": "yearmonthday", "label": "year month day", "isDefault": true, "validation": [ { "required": true } ], "options": [], "ref": "", "fieldType": "text", "type": "String" }, { "label": "Number of Visits", "key": "numbervisits", "isDefault": false, "validation": [ { "required": true } ], "options": [], "ref": "", "fieldType": "text", "type": "Number" }, { "label": "UserId", "key": "userid", "isDefault": true, "validation": [ { "required": true } ], "options": [], "ref": "", "fieldType": "text", "type": "String" } ] }
Click the Check icon when you are done to save your changes.
Example: Create a Tip Node
Log in as an Administrator to the Experience Manager.
Click Schema Management and then Content Types.
Click Add (plus button in the middle panel).
Enter the following information:
Name. Node Tips. (In the Content Demo flow, the Name of the schema is rich text.)
Description. Tips for building specific types of nodes.
Tags. node, tips.
Include two fields: NodeType of node and Tip.
Copy the lines in the schema edit window from the open curly bracket (“{”) before label to the closed curly bracket (“}”) after the type.
Add a comma after the last curly bracket.
Paste what you had copied previously.
Copy the two fields from their open curly bracket (“{”) before the label attribute in the first field to the close curly bracket (“}”) after the type attribute in the second field.
Note: Be sure to not include the comma in what you copy.
Toggle to your JSON editor and paste the field definitions
Note: You will get error notification on the line that includes the close curly bracket and the comma after the first field. Ignore it for now.
In the schema edit panel, enter:
{ “key”: “NodeType”, “label”: “NodeType”, “isDefault”: “true”, “validation”: [ { “required”: “true” } ], { “key”: “Tip”, “label”: “Node Tip”, “isDefault”: “false”, “validation”: [ { “required”: “true” } ], “options”: [], “ref”: “”, “fieldType”: “text”, “type”: “String” }
Click the Check icon when you are done to save your changes.