UNPKG

@dasch-swiss/dsp-js

Version:

JavaScript library that handles API requests to Knora

77 lines (76 loc) 2.77 kB
import { ReadWriteResource } from "../read-write-resource"; import { TypeGuard } from "../type-guard"; import { ReadValue } from "../values/read/read-value"; import { ResourceClassAndPropertyDefinitions } from "../../../../cache/ontology-cache/resource-class-and-property-definitions"; /** * @category Model V2 */ export declare class ReadResource extends ReadWriteResource { label: string; attachedToProject: string; attachedToUser: string; hasPermissions: string; userHasPermission: string; arkUrl: string; versionArkUrl: string; creationDate: string; lastModificationDate?: string; deleteDate?: string; deleteComment?: string; isDeleted?: boolean; resourceClassLabel?: string; resourceClassComment?: string; entityInfo: ResourceClassAndPropertyDefinitions; 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; /** * Given the IRI of a property pointing to a link value, * returns the corresponding link property IRI. * * @param linkValueProperty IRI of the link value property. */ getLinkPropertyIriFromLinkValuePropertyIri(linkValueProperty: string): string; /** * 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[]; }