UNPKG

@knora/api

Version:

JavaScript library that handles API requests to Knora

64 lines (63 loc) 2.35 kB
import { IResourceClassAndPropertyDefinitions } from "../../../../cache/OntologyCache"; import { ReadWriteResource } from "../read-write-resource"; import { TypeGuard } from "../type-guard"; import { ReadValue } from "../values/read/read-value"; export declare class ReadResource extends ReadWriteResource { label: string; attachedToProject: string; attachedToUser: string; hasPermissions: string; userHasPermission: string; arkUrl: string; versionArkUrl: string; creationDate: string; lastModificationDateDate?: string; resourceClassLabel?: string; resourceClassComment?: string; entityInfo: IResourceClassAndPropertyDefinitions; properties: { [index: string]: ReadValue[]; }; incomingReferences: ReadResource[]; outgoingReferences: ReadResource[]; /** * Gets number of resource properties for this resource. * Each resource property is counted once, * regardless of how many values it has (if number of values > 1). */ getNumberOfProperties(): number; /** * Gets the number of values for a given resource property. * * @param property the IRI of the property. */ getNumberOfValues(property: string): number; /** * Gets the value type of a given resource property, * or `false` if cannot be determined. * * @param property the IRI of the property. */ getValueType(property: string): string | false; /** * Gets all the values for a given resource property. * * @param property the IRI of the property. */ getValues(property: string): ReadValue[]; /** * Gets an array of string values representing the values of a property. * * @param property the IRI of the property. * @param defaultStr placeholder if there is no string representation of a value. */ getValuesAsStringArray(property: string, defaultStr?: string): string[]; /** * Gets all the values for a given resource property as instances of the requested type. * If the value cannot be casted to the requested type, an error is thrown. * * @param property the IRI of the property. * @param valueType the requested type of the value. */ getValuesAs<T extends ReadValue>(property: string, valueType: TypeGuard.Constructor<T>): T[]; }