import { Stream } from "../../../common/util/Stream"; import { TypeDBTransaction } from "../../connection/TypeDBTransaction"; import { Concept } from "../Concept"; import { AttributeType } from "../type/AttributeType"; import { RoleType } from "../type/RoleType"; import { ThingType } from "../type/ThingType"; import { Attribute } from "./Attribute"; import { Relation } from "./Relation"; import Annotation = ThingType.Annotation; export interface Thing extends Concept { /** Retrieves the unique id of the Thing. */ readonly iid: string; /** Retrieves the type which this Thing belongs to. */ readonly type: ThingType; /** Checks if this Thing is inferred by a [Reasoning Rule]. */ readonly inferred: boolean; /** * Deletes this Thing. * * ### Examples * * ```ts * thing.delete(transaction) * ``` * * @param transaction - The current transaction */ delete(transaction: TypeDBTransaction): Promise; /** * Checks if this Thing is deleted. * * ### Examples * * ```ts * thing.isDeleted(transaction) * ``` * * @param transaction - The current transaction */ isDeleted(transaction: TypeDBTransaction): Promise; /** {@inheritDoc Thing#getHas:(4)} */ getHas(transaction: TypeDBTransaction): Stream; /** {@inheritDoc Thing#getHas:(4)} */ getHas(transaction: TypeDBTransaction, annotations: Annotation[]): Stream; /** {@inheritDoc Thing#getHas:(4)} */ getHas(transaction: TypeDBTransaction, attributeType: AttributeType): Stream; /** {@inheritDoc Thing#getHas:(4)} */ getHas(transaction: TypeDBTransaction, attributeTypes: AttributeType[]): Stream; /** * Retrieves the Attributes that this Thing owns. Optionally, filtered by an AttributeType or a list of AttributeTypes. Optionally, filtered by Annotations. * * ### Examples * * ```ts * thing.getHas(transaction) * thing.getHas(transaction, attributeType, [Annotation.KEY]) * ``` * * @param transaction - The current transaction * @param attributeType - The AttributeType to filter the attributes by * @param attributeTypes - The AttributeTypes to filter the attributes by * @param annotations - Only retrieve attributes with all given Annotations */ getHas(transaction: TypeDBTransaction, attributeTypes: AttributeType[], annotations: Annotation[]): Stream; /** * Assigns an Attribute to be owned by this Thing. * * ### Examples * * ```ts * thing.setHas(transaction, attribute) * ``` * * @param transaction - The current transaction * @param attribute - The Attribute to be owned by this Thing. */ setHas(transaction: TypeDBTransaction, attribute: Attribute): Promise; /** * Unassigns an Attribute from this Thing. * * ### Examples * * ```ts * thing.unsetHas(transaction, attribute) * ``` * * @param transaction - The current transaction * @param attribute - The Attribute to be disowned from this Thing. */ unsetHas(transaction: TypeDBTransaction, attribute: Attribute): Promise; /** {@inheritDoc Thing#getRelations:(1)} */ getRelations(transaction: TypeDBTransaction): Stream; /** * Retrieves all the Relations which this Thing plays a role in, optionally filtered by one or more given roles. * * ### Examples * * ```ts * thing.getRelations(transaction, roleTypes) * ``` * * @param transaction - The current transaction * @param roleTypes - The list of roles to filter the relations by. */ getRelations(transaction: TypeDBTransaction, roleTypes: RoleType[]): Stream; /** * Retrieves the roles that this Thing is currently playing. * * ### Examples * * ```ts * thing.getPlaying(transaction) * ``` * * @param transaction - The current transaction */ getPlaying(transaction: TypeDBTransaction): Stream; } export declare namespace Thing { function proto(thing: Thing): import("typedb-protocol/proto/concept").Thing; }