1

I have an enum defining names of altbrains (publications) like so:

enum (AltBrainsNames) {
  description (AltBrainsNames)
  symbol (Inside the Helmet)
  symbol (Impeachment Sage)
  symbol (Iran Conflict Tracker)
  symbol (Historical Carbon Dioxide Emissions)
  symbol (Picard)
  symbol (Quotation Bank)
  symbol (US Elections)
}

With a corresponding vocab.bxb file to match variations on the names to these "official" names.

What I really want is the Bixby to pass along a string identifier that corresponds to each symbol -- like (Impeachment Sage, impeachmentsage) so that the identifier can be used as a parameter in a request to a restdb. What's a simple way of setting up these tuple relationships?

Fred

Fred Zimmerman
  • 1,178
  • 3
  • 13
  • 29

1 Answers1

2

The symbol for your enum concept can be the string identifier in your restDb. Here's one pattern:

Modify your existing enum to follow this format

enum (AltBrainsNames) {
  description (AltBrainsNames Identifiers)
  symbol (insideTheHelmut) 
  symbol (impeachmentSage)
  symbol (iranConflictTracker)
  symbol (historicalCarbonDioxideEmissions)
  symbol (picard)
  symbol (quotationBank)
  symbol (USElections)
}

Your tuple to connect the user-friendly name to the identifier.

structure (NameSelection) {

  property (name) {
    type (AltBrainsNames)
    min (Required) max (One)
  }

   property (title) {
    type (core.Text)
    min (Required) max (One)
    visibility (Private)
  }

}

Get a list of names

action (GetAltBrainsNames) {
  type(Constructor)
  output (NameSelection)
}

Provide a list of names, and prompt the user to select one

action (MakeNameSelection) {
  type(Calculation)
  collect {

    input (selection) {
      type (NameSelection)
      min (Required) max (One)
      default-init {
        intent {
          goal: GetAltBrainsNames
        }
      }
    }
  }
  output (AltBrainsNames)
}

Your vocabulary can support the user saying synonyms for symbol

vocab (AltBrainsNames) {
"insideTheHelmut" { "insideTheHelmut" "inside the helmut" "helmut"}
"impeachmentSage" { "impeachmentSage" "impeachment sage" "impeachment" "sage"}
"iranConflictTracker" {"iranConflictTracker" "iran conflict tracker"} 
"historicalCarbonDioxideEmissions" { "historicalCarbonDioxideEmissions" "historical carbon dioxide emissions"}
"picard" { "picard"}  
"quotationBank" {"quotationBank" "quotation bank" "quotations"} 
"USElections" {"USElections" "us elections" }
}

enter image description here enter image description here enter image description here enter image description here

Pete Haas
  • 1,800
  • 1
  • 12
  • 15