import { Stream } from "../../../common/util/Stream"; import { TypeDBTransaction } from "../../connection/TypeDBTransaction"; import { Concept } from "../Concept"; import { Relation } from "../thing/Relation"; import { RoleType } from "./RoleType"; import { ThingType } from "./ThingType"; import Transitivity = Concept.Transitivity; export interface RelationType extends ThingType { /** * Creates and returns an instance of this RelationType. * * ### Examples * * ```ts * relationType.create(transaction) * ``` * * @param transaction - The current transaction */ create(transaction: TypeDBTransaction): Promise; /** @inheritDoc */ getSupertype(transaction: TypeDBTransaction): Promise; /** * Sets the supplied RelationType as the supertype of the current RelationType. * * ### Examples * * ```ts * relationType.setSupertype(transaction, superRelationType).resolve(); * ``` * * @param transaction The current transaction * @param superRelationType The RelationType to set as the supertype of this RelationType */ setSupertype(transaction: TypeDBTransaction, type: RelationType): Promise; /** @inheritDoc */ getSupertypes(transaction: TypeDBTransaction): Stream; /** @inheritDoc */ getSubtypes(transaction: TypeDBTransaction): Stream; /** @inheritDoc */ getSubtypes(transaction: TypeDBTransaction, transitivity: Transitivity): Stream; /** @inheritDoc */ getInstances(transaction: TypeDBTransaction): Stream; /** @inheritDoc */ getInstances(transaction: TypeDBTransaction, transitivity: Transitivity): Stream; /** RelationType#getRelates:(1) */ getRelates(transaction: TypeDBTransaction): Stream; /** * Retrieves roles that this RelationType relates to directly or via inheritance. If role_label is given, returns a corresponding RoleType or None. * * ### Examples * * ```ts * relationType.getRelates(transaction, roleLabel, transitivity) * ``` * * @param transaction - The current transaction * @param roleLabel - Label of the role we wish to retrieve (optional) * @param transitivity - Transitivity.TRANSITIVE for direct and inherited relates, Transitivity.EXPLICIT for direct relates only */ getRelates(transaction: TypeDBTransaction, transitivity: Transitivity): Stream; getRelatesForRoleLabel(transaction: TypeDBTransaction, roleLabel: string): Promise; /** * Retrieves a RoleType that is overridden by the role with the role_label. * * ### Examples * * ```ts * relationType.getRelatesOverridden(transaction, roleLabel) * ``` * * @param transaction - The current transaction * @param roleLabel - Label of the role that overrides an inherited role */ getRelatesOverridden(transaction: TypeDBTransaction, roleLabel: string): Promise; /** * Sets the new role that this RelationType relates to. If we are setting an overriding type this way, we have to also pass the overridden type as a second argument. * * ### Examples * * ```ts * relationType.setRelates(transaction, roleLabel) * relationType.setRelates(transaction, roleLabel, overriddenLabel) * ``` * * @param transaction - The current transaction * @param roleLabel - The new role for the RelationType to relate to * @param overriddenLabel - The label being overridden, if applicable */ setRelates(transaction: TypeDBTransaction, roleLabel: string, overriddenLabel?: string): Promise; /** * Disallows this RelationType from relating to the given role. * * ### Examples * * ```ts * relationType.unsetRelates(transaction, roleLabel) * ``` * * @param transaction - The current transaction * @param roleLabel - The role to not relate to the relation type. */ unsetRelates(transaction: TypeDBTransaction, roleLabel: string): Promise; } export declare namespace RelationType { const NAME = "relation"; function proto(relationType: RelationType): import("typedb-protocol/proto/concept").RelationType; }