## lamindb.ULabel

| class lamindb.ULabel(name: str, type: ULabel | None | Unset = UNSET, is_type: bool = False, description: str | None = None, reference: str | None = None, reference_type: str | None = None, branch: Branch | None = None, space: Space | None = None) |
class lamindb.ULabel(*db_args)

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

 Universal labels.

 Use this registry to manage simple labels. For more complex
 entities with features, use "Record" instead.

 For cell lines, cell types, tissues, and other biological entities,
 use the ontology sources in "bionty". "ULabel" does not sync from
 external ontologies but can hold its own universal label ontology.

 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"".

| * **branch** -- "Branch | None = None" A branch. If "None", uses |
 the current branch.

| * **space** -- "Space | None = None" A space. If "None", uses |
 the current space.

 See also:

 "Record"
 Similar to "ULabel", but with the ability to store 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 under a **ULabel type**, 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.ULabel(name="CellType", is_type=True).save()
 t_cell = ln.ULabel(name="T Cell", type=cell_type).save()
 cd4_t_cell = ln.ULabel(name="CD4+ T Cell", type=cell_type).save()
 t_cell.children.add(cd4_t_cell)

 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(depth=None)

 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.

 Parameters:
| **depth** ("int" | "None", default: "None") -- How many type |
 hops to follow. "None" walks the whole subtree. "1" returns
 only the direct ulabels of this type.

 Return type:
 "QuerySet"