Skip to content

pixano.features.types.schema_reference

AnnotationRef

Bases: SchemaRef['Annotation']

Annotation reference.

EmbeddingRef

Bases: SchemaRef['Embedding']

Embedding reference.

EntityRef

Bases: SchemaRef['Entity']

Entity reference.

ItemRef

Bases: SchemaRef['Item']

Item reference.

SchemaRef

Bases: BaseType, Generic[T]

A schema reference.

A schema reference is used to reference a schema in a dataset. If an id is provided, the reference points to a specific element stored in the table associated to the schema.

Attributes:

Name Type Description
name str

The name of the schema.

id str

The id of the schema.

none() classmethod

Return a reference to no schema.

Source code in pixano/features/types/schema_reference.py
@classmethod
def none(cls) -> "SchemaRef":
    """Return a reference to no schema."""
    return cls(name="", id="")

resolve(dataset)

Resolve the reference to the schema.

Source code in pixano/features/types/schema_reference.py
def resolve(self, dataset: "Dataset") -> T:
    """Resolve the reference to the schema."""
    return dataset.resolve_ref(self)

SourceRef

Bases: SchemaRef['Source']

Source reference.

ViewRef

Bases: SchemaRef['View']

View reference.

create_annotation_ref(id, name)

Create an annotation reference.

Source code in pixano/features/types/schema_reference.py
def create_annotation_ref(id: str, name: str) -> AnnotationRef:
    """Create an annotation reference."""
    return AnnotationRef(name=name, id=id)

create_embedding_ref(id, name)

Create an embedding reference.

Source code in pixano/features/types/schema_reference.py
def create_embedding_ref(id: str, name: str) -> EmbeddingRef:
    """Create an embedding reference."""
    return EmbeddingRef(name=name, id=id)

create_entity_ref(id, name)

Create an entity reference.

Source code in pixano/features/types/schema_reference.py
def create_entity_ref(id: str, name: str) -> EntityRef:
    """Create an entity reference."""
    return EntityRef(name=name, id=id)

create_item_ref(id, name='item')

Create an item reference.

Source code in pixano/features/types/schema_reference.py
def create_item_ref(id: str, name: str = "item") -> ItemRef:
    """Create an item reference."""
    return ItemRef(name=name, id=id)

create_schema_ref(id, name)

Create a schema reference.

Source code in pixano/features/types/schema_reference.py
def create_schema_ref(id: str, name: str) -> SchemaRef:
    """Create a schema reference."""
    return SchemaRef(name=name, id=id)

create_source_ref(id)

Create a source reference.

Source code in pixano/features/types/schema_reference.py
def create_source_ref(id: str) -> SourceRef:
    """Create a source reference."""
    return SourceRef(id=id)

create_view_ref(id, name)

Create a view reference.

Source code in pixano/features/types/schema_reference.py
def create_view_ref(id: str, name: str) -> ViewRef:
    """Create a view reference."""
    return ViewRef(name=name, id=id)

is_annotation_ref(cls, strict=False)

Check if a class is an AnnotationRef or subclass of AnnotationRef.

Source code in pixano/features/types/schema_reference.py
def is_annotation_ref(cls: type, strict: bool = False) -> bool:
    """Check if a class is an `AnnotationRef` or subclass of `AnnotationRef`."""
    return issubclass_strict(cls, AnnotationRef, strict)

is_embedding_ref(cls, strict=False)

Check if a class is an EmbeddingRef or subclass of EmbeddingRef.

Source code in pixano/features/types/schema_reference.py
def is_embedding_ref(cls: type, strict: bool = False) -> bool:
    """Check if a class is an `EmbeddingRef` or subclass of `EmbeddingRef`."""
    return issubclass_strict(cls, EmbeddingRef, strict)

is_entity_ref(cls, strict=False)

Check if a class is an EntityRef or subclass of EntityRef.

Source code in pixano/features/types/schema_reference.py
def is_entity_ref(cls: type, strict: bool = False) -> bool:
    """Check if a class is an `EntityRef` or subclass of `EntityRef`."""
    return issubclass_strict(cls, EntityRef, strict)

is_item_ref(cls, strict=False)

Check if a class is an ItemRef or subclass of ItemRef.

Source code in pixano/features/types/schema_reference.py
def is_item_ref(cls: type, strict: bool = False) -> bool:
    """Check if a class is an `ItemRef` or subclass of `ItemRef`."""
    return issubclass_strict(cls, ItemRef, strict)

is_schema_ref(cls, strict=False)

Check if a class is a SchemaRef or subclass of SchemaRef.

Source code in pixano/features/types/schema_reference.py
def is_schema_ref(cls: type, strict: bool = False) -> bool:
    """Check if a class is a `SchemaRef` or subclass of `SchemaRef`."""
    return issubclass_strict(cls, SchemaRef, strict)

is_source_ref(cls, strict=False)

Check if a class is a SourceRef or subclass of SourceRef.

Source code in pixano/features/types/schema_reference.py
def is_source_ref(cls: type, strict: bool = False) -> bool:
    """Check if a class is a `SourceRef` or subclass of `SourceRef`."""
    return issubclass_strict(cls, SourceRef, strict)

is_view_ref(cls, strict=False)

Check if a class is a ViewRef or subclass of ViewRef.

Source code in pixano/features/types/schema_reference.py
def is_view_ref(cls: type, strict: bool = False) -> bool:
    """Check if a class is a `ViewRef` or subclass of `ViewRef`."""
    return issubclass_strict(cls, ViewRef, strict)