Skip to main content

Attribute Objects

class Attribute(OntologyNestedElement, Generic[OptionType])
Base class for shared Attribute fields

dynamic

The dynamic member is part of every attribute. However it can only be true for top level (not nested) attributes that are part of an Object.

RadioAttribute Objects

class RadioAttribute(Attribute["NestableOption"])
An ontology attribute that allows selecting exactly one option from a list of options. Each option is represented by a NestableOption, which may itself contain nested attributes (up to 7 levels deep).

add_option

def add_option(label: str,
               value: Optional[str] = None,
               local_uid: Optional[int] = None,
               feature_node_hash: Optional[str] = None) -> NestableOption
Arguments:
  • label - user-visible name of the option
  • value - internal unique value; optional; normally mechanically constructed from the label
  • local_uid - integer identifier of the option. Normally auto-generated; omit this unless the aim is to create an exact clone of existing ontology
  • feature_node_hash - global identifier of the option. Normally auto-generated; omit this unless the aim is to create an exact clone of existing ontology
Returns: a NestableOption instance attached to the attribute. This can be further specified by adding nested attributes.

ChecklistAttribute Objects

class ChecklistAttribute(Attribute["FlatOption"])
An ontology attribute that allows selecting exactly one or more options from a list of options.

add_option

def add_option(label: str,
               value: Optional[str] = None,
               local_uid: Optional[int] = None,
               feature_node_hash: Optional[str] = None) -> FlatOption
Arguments:
  • label - user-visible name of the option
  • value - internal unique value; optional; normally mechanically constructed from the label
  • local_uid - integer identifier of the option. Normally auto-generated; omit this unless the aim is to create an exact clone of existing ontology
  • feature_node_hash - global identifier of the option. Normally auto-generated; omit this unless the aim is to create an exact clone of existing ontology
Returns: a FlatOption instance attached to the attribute.

TextAttribute Objects

class TextAttribute(Attribute["FlatOption"])
An ontology attribute that allows users to type text strings in a text field.

NumericAttribute Objects

class NumericAttribute(Attribute["FlatOption"])
An ontology attribute that allows users to type numerical values (float) in a numerical field.

attribute_from_dict

def attribute_from_dict(d: Dict[str, Any]) -> Attribute
Convenience functions as you cannot call static member on union types.