import { Catalog, Key, TID, PID } from '../catalog'; import { DID, Dimension } from './dimension'; import { AID, AttributeDescription, DimensionAndTensorDescription } from './interfaces'; import { Tensor } from './tensor'; /** * The (dimension, position) coordinates of an attribute within a Tensor. * Dimension corresponds to a characteristic like `size`. Position corresponds * to a specific characteristic value such as `small`, `medium`, or `large`. */ export interface AttributeCoordinate { dimension: Dimension; position: number; } /** * Store information about the relationships between DimensionAndTensorDescription, Dimensions, * and Tensors. */ export declare class AttributeInfo { private readonly catalog; private readonly nameToDimension; private readonly didToDimension; private readonly aidToCoordinate; private readonly tensorIdToTensor; private readonly aidToDescription; constructor(catalog: Catalog, attributes: DimensionAndTensorDescription); /** * Indexes a Dimension and its Attributes. */ private addDimension; getDimension(did: DID): Dimension; getDimensionFromName(name: string): Dimension; dimensions(): IterableIterator; getAttribute(aid: AID): AttributeDescription; /** * Indexes a Tensor. */ private addTensor; /** * Look up an AttributeCoordinate by AID. The Coordinate provides the * Attribute's Dimension (e.g. `size`) and its Position in the Dimension * (e.g. `0 ==> small`). */ getAttributeCoordinates(aid: AID): AttributeCoordinate; getTensor(tid: TID): Tensor; /** * Returns a GenericEntity's Tensor. */ getTensorForEntity(pid: PID): Tensor; /** * Given a GenericEntity's PID and a map from DID to AID, return a number * that represents those set of attribute values associated with Dimensions * of the GenericEntity's Tensor. * * @param {PID} pid A GenericEntity product id. * @param dimensionIdToAttribute Attribute ids, indexed by their * dimensions. * @param generateRegexKey If true, generate regex fragment `"\d+"` instead of default * coordinate. */ getKey(pid: PID, dimensionIdToAttribute: Map, generateRegexKey: boolean): string; getAttributes(key: Key): AID[]; static hasDimension(tensor: Tensor, did: DID): boolean; static pidFromKey(key: Key): PID; }