@dasch-swiss/dsp-js
Version:
JavaScript library that handles API requests to Knora
43 lines (42 loc) • 1.84 kB
TypeScript
import { Observable } from "rxjs";
import { V2Endpoint } from "../../api/v2/v2-endpoint";
import { KnoraApiConfig } from "../../knora-api-config";
import { ReadOntology } from "../../models/v2/ontologies/read/read-ontology";
import { GenericCache } from "../GenericCache";
import { ResourceClassAndPropertyDefinitions } from "./resource-class-and-property-definitions";
/**
* Caches ontologies obtained from Knora and handles direct dependencies between ontologies.
*/
export declare class OntologyCache extends GenericCache<ReadOntology> {
private knoraApiConfig;
private v2Endpoint;
constructor(knoraApiConfig: KnoraApiConfig, v2Endpoint: V2Endpoint);
/**
* Gets an ontology from the cache including its direct dependencies.
*
* The ontology Iris are the keys of the resulting Map.
*
* @param ontologyIri the Iri of the ontology.
* @returns the requested ontology and its direct dependencies.
*/
getOntology(ontologyIri: string): Observable<Map<string, ReadOntology>>;
/**
* Gets a resource class definition including the property definitions
* the resource class has cardinalities for.
*
* This method does not return third party ontology entities, e.g., rdfs.
*
* @param resourceClassIri
*/
getResourceClassDefinition(resourceClassIri: string): Observable<ResourceClassAndPropertyDefinitions>;
/**
* Public method to access the reloadItem method
*
* @param key the id of the information to be returned.
* @return the item
*/
reloadCachedItem(key: string): Observable<ReadOntology>;
protected requestItemFromKnora(key: string, isDependency: boolean): Observable<ReadOntology[]>;
protected getKeyOfItem(item: ReadOntology): string;
protected getDependenciesOfItem(item: ReadOntology): string[];
}