Bixby Developer Center


Match Patterns

This capsule demonstrates how to use match patterns in your actions.

Download Capsule


Because you cannot submit a capsule with the example namespace, in order to test a sample capsule on a device, you must change the id in the capsule.bxb file from example to your organization's before making a private submission.

For example, if your namespace is acme, change example.matchingPattern to acme.matchingPattern.

Different goals for Bixby might take the same concept as an input but trigger different result views. The result views specify different match patterns.

In this sample capsule, which simulates a simple business search, there are five training samples with different goals:

"call business"CallBusiness
"find a business"FindBusiness
"what are the categories"Business#categories
"what is the rating"Business#rating
"navigate there"NavigateThere

The FindBusiness action simply outputs a Business model, whose result is displayed by the Business_Result view.

After a business is found, "what are the categories" and "what is the rating" demonstrate property projection: the goals are properties of the Business model. This is demonstrated in the BusinessReview.dialog.bxb and BusinessCategories.dialog.bxb dialogs, which match on BusinessReview and BusinessCategory respectively, using from-property to indicate the concepts being matched are properties of Business.

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

The Business_Result_From_CallBusiness.view.bxb and Business_Result_From_NavigateThere.view.bxb views also use match patterns. Both match on the Business concept, but use from-output to specify different goals via property projection.

// Business_Result_From_NavigateThere.view.bxb
result-view {
match {
Business (business) {
from-output: NavigateThere