Standard Definitions
Standard definitions are Standards that serve as enumerations. You can define a Standard definition for an object or variable where it may be represented as a single value.
color: CLR {
def red "RED"
def orange "ORANGE"
def yellow "YELLOW"
def green "GREEN"
def blue "BLUE"
def indigo "INDIGO"
def violet "VIOLET"
}
Standard definitions are used by referencing them as a constraint in another Standard. A Standard representing a vehicle may have the color Standard definition to define the vehicle color like so.
vehicle: VHL {
private vin string VN *
protected make string MK *
protected model string MDL *
protected type standard @CLR clr
}
Now when a value is passed to the vehicle Standard for the color constraint, it must match one of the values defined in the color Standard definition.
Creating with Definitions
When using a creation query and Standard definitions, you can use the values verbatim or reference the Standard. You reference Standard definitions in any type of query like this:
#Create red vehicles
[vehicle] + ("VIN173", "Dodge", "Durango", red)
[vehicle] + ("VIN453", "Dodge", "Durango", "RED")
[vehicle] + ("VIN189", "Dodge", "Durango", @CLR.red)
#Delete red vehicles
[vehicle] - <color CLR.red>
[vehicle] - <color "RED">
[vehicle] - <color red>
#Find 5 red vehicles
[vehicle] <color @CLR.red, LIMIT 5>