Skip to main content

Option Objects

@dataclass
class Option(OntologyNestedElement)
Base class for shared Option fields

NestableOption Objects

@dataclass
class NestableOption(Option)

add_nested_option

@deprecated(version="0.1.100", alternative=".add_nested_attribute")
def add_nested_option(cls: Type[AttributeType],
                      name: str,
                      local_uid: Optional[int] = None,
                      feature_node_hash: Optional[str] = None,
                      required: bool = False) -> AttributeType
This method is deprecated, please use :meth:.add_nested_option instead. There is no functional difference between these methods.

add_nested_attribute

def add_nested_attribute(cls: Type[AttributeType],
                         name: str,
                         local_uid: Optional[int] = None,
                         feature_node_hash: Optional[str] = None,
                         required: bool = False) -> AttributeType
Adds a nested attribute to a RadioAttribute option. Arguments:
  • cls - attribute type, one of RadioAttribute, ChecklistAttribute, TextAttribute
  • name - the user-visible name of the attribute
  • local_uid - integer identifier of the attribute. Normally auto-generated; omit this unless the aim is to create an exact clone of existing ontology
  • feature_node_hash - global identifier of the object. Normally auto-generated; omit this unless the aim is to create an exact clone of existing ontology
  • required - whether the label editor would mark this attribute as ‘required’
Returns: the created attribute that can be further specified with Options, where appropriate Raises:
  • ValueError - if specified local_uid or feature_node_hash violate uniqueness constraints