Bixby Developer Center

Guides

Property Projections

There are times that your capsule's code or training needs to refer to a property of a concept rather than the concept as a whole. For example, a user might be asking just for a temperature in a location, rather than the whole weather forecast: "What will the high be in San Francisco tomorrow?" Or, for another example, your capsule's dialog might need to match on a concept that's a property of a structure, such as the range of open hours for a business. You can accomplish this through property projections.

Properties as Training Goals

Take the previous example of asking for the high temperature in San Francisco. Bixby needs to get San Francisco's weather report, but the dialog should return only the high temperature:

Dialog display for high temperature request

For Bixby to properly understand this utterance, it needs to be trained with a property as a goal, not a concept. To refer to a property, append the property name to its concept's name separated by a hash (#):

myExample.weather.Weather#highTemperature

By setting that as a training goal, you tell Bixby that this utterance's intent and goal is the highTemperature property of the viv.weather.Weather concept.

Property Matching

The from-property key lets you specify a property within a structure concept to match against. For instance, a result view for a local business service might want to match businesses against the type of businesses (BusinessCategory):

dialog (Result) {
match {
BusinessCategory (this) {
from-property: Business (business)
}
}
template("#{value(business.name)} has #{joinAs('value', this)}.")
}

View master on GitHub

The match key matches against the BusinessCategory concept; from-property specifies that the matched BusinessCategory must be a property of a Business concept. Business is a structure concept, which includes a categories property:

match-pattern/models/concepts/Business.model.bxb

You can also match on the _ wildcard for greater flexibility. For example, this match pattern matches against any property within a Business structure:

  match {
_ (this) {
from-property: Business (business) {
min (Required)
max (One)
}
}
}

View b8d70b1 on GitHub

Property Visibility

To use a property in a property projection, it must be "visibile" to the planner. By default, properties are only visible at the goal, so they cannot be used as inputs for actions.

The visibility of properties is controlled with the visibility key. This can be set to one of three values:

  • Public properties are fully exposed to the planner, allowing property projections to occur at any point in plan execution.
  • Private properties are hidden from the planner, and are only available in action implementation, dialog, and layouts.
  • Default visibility exposes a property to the planner only at the goal, allowing for property projections and sorts at the goal.

In this example, the property named type (the type of shoe) is made public, so it can be used for property projections or as an input for other actions:

structure (Shoe) {
property (name) {
type (Name)
min (Required)
}
property (type) {
type (Type)
min (Required)
// make property visible for projections and action input
visibility (Public)
}
}