@dasch-swiss/dsp-js
Version:
JavaScript library that handles API requests to Knora
93 lines (92 loc) • 4.34 kB
TypeScript
import { JsonConvert } from "json2typescript";
import { KnoraApiConfig } from "../../../knora-api-config";
import { EntityDefinition } from "./EntityDefinition";
import { OntologiesMetadata } from "./ontology-metadata";
import { ReadOntology } from "./read/read-ontology";
import { ResourceClassDefinitionWithAllLanguages } from "./resource-class-definition";
import { ResourcePropertyDefinitionWithAllLanguages } from "./resource-property-definition";
/**
* @category Internal
*/
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 instance of JsonConvert to use.
* @param knoraApiConfig config object to use.
* @param allLanguages indicates if labels and comments were fetched for all languages.
* @return the ontology as a `ReadOntology`.
*/
const convertOntology: (ontologyJsonld: object, jsonConvert: JsonConvert, knoraApiConfig: KnoraApiConfig, allLanguages: boolean) => ReadOntology;
/**
* Converts a list of ontologies or a single ontology serialized as JSON-LD to an instance of `OntologiesMetadata`
*
* @param ontologiesJsonld JSON-LD representing ontology metadata.
* @param jsonConvert instance of JsonConvert to use.
*/
const convertOntologiesList: (ontologiesJsonld: object, jsonConvert: JsonConvert) => OntologiesMetadata;
/**
* Converts the response from createResourceClass serialized as JSON-LD to an instance of `ResourceClassDefinition`
*
* @param resClassJsonld JSON-LD representing a resource class definition.
* @param jsonConvert instance of JsonConvert to use.
*/
const convertResourceClassResponse: (resClassJsonld: object, jsonConvert: JsonConvert) => ResourceClassDefinitionWithAllLanguages;
/**
* Converts the response from createResourceProperty serialized as JSON-LD to an instance of `ResourcePropertyDefinition`
*
* @param resPropJsonld JSON-LD representing a resource property definition.
* @param jsonConvert instance of JsonConvert to use.
*/
const convertResourcePropertyResponse: (resPropJsonld: object, jsonConvert: JsonConvert) => ResourcePropertyDefinitionWithAllLanguages;
}