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 :class:encord.objects.ontology_object.Object.

RadioAttribute Objects

class RadioAttribute(Attribute["NestableOption"])

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"])

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.

attribute_from_dict

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