## lamindb.ULabel

| class lamindb.ULabel(name: str, type: ULabel | None = None, is_type: bool = False, description: str | None = None, reference: str | None = None, reference_type: str | None = None) |
class lamindb.ULabel(*db_args)

 Bases: "SQLRecord", "HasType", "HasParents", "CanCurate",
 "TracksRun", "TracksUpdates"

 Universal labels.

 It behaves like "Record", just without the ability to link
 features.

 Parameters:
 * **name** -- "str" A name.

| * **description** -- "str | None = None" A description. |

| * **reference** -- "str | None = None" For instance, an external |
 ID or a URL.

| * **reference_type** -- "str | None = None" For instance, |
 ""url"".

 See also:

 "Record"
 Like "ULabel", but with the ability to link features.

 -[ Examples ]-

 Create a label and annotate an "Artifact":

 train_split = ln.ULabel(name="train").save()
 artifact.ulabels.add(train_split)

 Query artifacts by label:

 ln.Artifact.filter(ulabels=train_split).to_dataframe()

 Organize ulabels in a type hierarchy, based on the "type" field:

 split_type = ln.ULabel(name="Split", is_type=True).save()
 train_split = ln.ULabel(name="train", type="split_type").save()

 The "type" hierarchy gives rise to a tree. If you need to model a
 full DAG-like **ontology**, use the "parents"/"children" fields:

 cell_type = ln.Record(name="CellType", is_type=True).save()
 t_cell = ln.Record(name="T Cell", type=cell_type).save()
 cd4_t_cell = ln.Record(name="CD4+ T Cell", type=cell_type).save()
 t_cell.children.add(cd4_t_cell)

 If you work with basic biological entities like cell lines, cell
 types, tissues, consider building on the public biological
 ontologies in "bionty", which work in the same way.

 uid: str

 A universal random id, valid across DB instances.

 name: str

 Name or title of ulabel.

| description: str | None |

 A description.

| reference: str | None |

 A simple reference like URL or external ID.

| reference_type: str | None |

 Type of simple reference.

| type: ULabel | None |

 Type of ulabel, e.g., ""donor"", ""split"", etc. ← "ulabels"

 Allows to group ulabels by type, e.g., all donors, all split
 ulabels, etc.

 parents: RelatedManager[ULabel]

 Parent entities of this ulabel ← "children".

 For advanced use cases, you can build an ontology under a given
 "type".

 Say, if you modeled "CellType" as a "ULabel", you would
 introduce a type "CellType" and model the hiearchy of cell types
 under it.

 artifacts: RelatedManager[Artifact]

 The artifacts annotated by this ulabel ← "ulabels".

 linked_in_records: RelatedManager[Record]

 Records linking this ulabel as a value ← "linked_ulabels".

 branches: RelatedManager[Branch]

 The branches annotated by this ulabel ← "ulabels".

 runs: RelatedManager[Run]

 The runs annotated by this ulabel ← "ulabels".

 transforms: RelatedManager[Transform]

 The transforms annotated by this ulabel ← "ulabels".

 ulabels: RelatedManager[ULabel]

 ULabels of this type (can only be non-empty if "is_type" is
 "True").

 children: RelatedManager[ULabel]

 Child entities of this ulabel.

 Reverse accessor for parents.

 collections: RelatedManager[Collection]

 The collections annotated by this ulabel ← "ulabels".

 projects: RelatedManager[Project]

 The projects annotating this ulabel ← "ulabels".

 ablocks: RelatedManager[ULabelBlock]

 Attached blocks ← "ulabel".

 query_ulabels()

 Query ulabels of sub types.

 While ".ulabels" retrieves the ulabels with the current type,
 this method also retrieves sub types and the ulabels with sub
 types of the current type.

 Return type:
 "QuerySet"