roboto.association#

Module Contents#

class roboto.association.Association(/, **data)#

Bases: pydantic.BaseModel

Use to declare an association between two Roboto entities.

Parameters:

data (Any)

URL_ENCODING_SEP: ClassVar[str] = ':'#
association_id: str#

Roboto identifier

association_type: AssociationType#

association_type is the Roboto domain entity type of the association.

association_version: int | None = None#

association_version is the Roboto domain entity version of the association, if it exists.

classmethod coalesce(associations=None, dataset_ids=None, file_ids=None, topic_ids=None, message_path_ids=None, throw_on_empty=False)#
Parameters:
  • associations (Optional[collections.abc.Collection[Association]])

  • dataset_ids (Optional[collections.abc.Collection[str]])

  • file_ids (Optional[collections.abc.Collection[str]])

  • topic_ids (Optional[collections.abc.Collection[str]])

  • message_path_ids (Optional[collections.abc.Collection[str]])

  • throw_on_empty (bool)

Return type:

list[Association]

classmethod dataset(dataset_id)#
Parameters:

dataset_id (str)

Return type:

Association

property dataset_id: str | None#
Return type:

Optional[str]

classmethod file(file_id, version=None)#
Parameters:
  • file_id (str)

  • version (Optional[int])

property file_id: str | None#
Return type:

Optional[str]

classmethod from_url_encoded_value(encoded)#

Reverse of Association::url_encode.

Parameters:

encoded (str)

Return type:

Association

static group_by_type(associations)#
Parameters:

associations (collections.abc.Collection[Association])

Return type:

collections.abc.Mapping[AssociationType, collections.abc.Sequence[Association]]

property is_dataset: bool#
Return type:

bool

property is_file: bool#
Return type:

bool

property is_msgpath: bool#
Return type:

bool

property is_topic: bool#
Return type:

bool

property message_path_id: str | None#
Return type:

Optional[str]

classmethod msgpath(msgpath_id)#
Parameters:

msgpath_id (str)

Return type:

Association

parent: Association | None = None#

The next level up in the hierarchy of this association. A message path’s parent is its topic, a topic’s parent is its file, and a file’s parent is its dataset.

The absense of a parent in an Association object doesn’t necessarily mean that a parent doesn’t exist; parents are only provided when they’re easily computable in the context of a given request.

classmethod topic(topic_id)#
Parameters:

topic_id (str)

property topic_id: str | None#
Return type:

Optional[str]

url_encode()#

Association encoded in a URL path segment ready format.

Return type:

str

class roboto.association.AssociationType#

Bases: enum.Enum

AssociationType is the Roboto domain entity type of the association.

Dataset = 'dataset'#
File = 'file'#
MessagePath = 'message_path'#
Topic = 'topic'#