UNPKG

@knora/api

Version:

JavaScript library that handles API requests to Knora

65 lines (64 loc) 2.67 kB
import { JsonConvert } from "json2typescript"; import { KnoraApiConfig } from "../../../knora-api-config"; import { EntityDefinition } from "./EntityDefinition"; import { ReadOntology } from "./read-ontology"; export declare namespace OntologyConversionUtil { /** * Given a Knora entity IRI, gets the ontology Iri. * External entity Iris are ignored. * * @param entityIri an entity Iri. * @param knoraApiConfig the Knora api configuration. * @return the ontology IRI as the only entry in an array, otherwise an empty array. */ const getOntologyIriFromEntityIri: (entityIri: string, knoraApiConfig: KnoraApiConfig) => string[]; /** * Determines resource class definitions when passed to filter() applied to an array of entity definitions. * * @param entity the entity definition to be analyzed. */ const filterResourceClassDefinitions: (entity: { [index: string]: any; }) => boolean; /** * Determines standoff class definitions when passed to filter() applied to an array of entity definitions. * * @param entity the entity definition to be analyzed. */ const filterStandoffClassDefinitions: (entity: { [index: string]: any; }) => boolean; /** * Determines resource property definitions when passed to filter() applied to an array of entity definitions. * * @param entity the entity definition to be analyzed. */ const filterResourcePropertyDefinitions: (entity: { [index: string]: any; }) => boolean; /** * Determines system property definitions when passed to filter() applied to an array of entity definitions. * * @param entity the entity definition to be analyzed. */ const filterSystemPropertyDefintions: (entity: { [index: string]: any; }) => boolean; /** * Converts an entity definition to the specified type. * * @param entity the entity definition to be converted. * @param dataType the target type of the conversion. * @param jsonConvert the converter to be used. */ const convertEntity: <T extends EntityDefinition>(entity: object, dataType: new () => T, jsonConvert: JsonConvert) => T; /** * Converts an ontology serialized as JSON-LD to an instance of `ReadOntology`. * * @param ontologyJsonld ontology as JSON-LD already processed by the jsonld-processor. * @param jsonConvert * @param knoraApiConfig * @return the ontology as a `ReadOntology`. */ const convertOntology: (ontologyJsonld: object, jsonConvert: JsonConvert, knoraApiConfig: KnoraApiConfig) => ReadOntology; }