UNPKG

sparnatural

Version:

Visual client-side SPARQL query builder and knowledge graph exploration tool

65 lines (64 loc) 2.6 kB
import SparnaturalComponent from "./sparnatural/components/SparnaturalComponent"; import { SparnaturalQueryIfc } from "./sparnatural/SparnaturalQueryIfc"; import { SparnaturalQuery } from "./sparnatural/SparnaturalQueryIfc-v13"; import { SparnaturalAttributes } from "./SparnaturalAttributes"; export declare class SparnaturalElement extends HTMLElement { static HTML_ELEMENT_NAME: string; static EVENT_SUBMIT: string; static EVENT_QUERY_UPDATED: string; static EVENT_RESET: string; static EVENT_INIT: string; _attributes: SparnaturalAttributes; sparnatural: SparnaturalComponent; constructor(); /** * Call display only in the connectedCallback */ connectedCallback(): void; set customization(customization: any); get customization(): any; display(): void; /** * Expands the SPARQL query according to the configuration. * Can be called from the outside * @returns */ expandSparql(query: string): string; static get observedAttributes(): string[]; attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void; /** * Enable the play button when a query has finished executing * Can be called from the outside. Removes the loading spinner on the btn */ enablePlayBtn(): void; /** * Disable the play button when query is triggered * Can be called from the outside */ disablePlayBtn(): void; /** * Type guard to check if the provided query is a v13 SparnaturalQuery * @param query The query to check * @returns True if the query is a SparnaturalQuery (v13), false if it's a SparnaturalQueryIfc (v1) */ private isV13Query; /** * Load a saved/predefined query in the visual query builder * Can be called from the outside * @param query */ loadQuery(query: SparnaturalQuery | SparnaturalQueryIfc): void; /** * Executes the provided SPARQL query, using the configured headers, and sending it to multiple * endpoints, if configured through the catalog attribute (results are then merged in a single result set) * @param query The SPARQL query to execute * @param callback The callback to execute with the final query string * @param errorCallback The callback to execute in case of an error during the query execution */ executeSparql(query: string, callback: (data: any) => void, errorCallback?: (error: any) => void): void; /** * Clears the current query. * Can be called from the outside */ clear(): void; }