import ParsingClient from 'sparql-http-client/ParsingClient.js';
import SimpleClient from 'sparql-http-client/SimpleClient.js';
import type { EventEmitter } from 'node:events';
import type { Quad, Stream } from '@rdfjs/types';
import type { Logger } from 'pino';
import type { ResultRow } from 'sparql-http-client/ResultParser.js';
import type { TrifidQuery } from '../types/index.ts';
/**
 * Supported types for the serialization.
 */
export declare const supportedTypes: string[];
/**
 * Serialize a formatted stream to a string.
 *
 * @param quadStream The formatted stream to serialize.
 * @returns The serialized string.
 */
export declare const serializeFormattedStream: (quadStream: Stream<Quad> | EventEmitter | null) => Promise<string>;
/**
 * Serialize a quad stream to a string.
 *
 * @param quadStream The quad stream to serialize.
 * @param mimeType The mime type to serialize to.
 * @param _options Options (reserved for further use).
 * @returns The serialized string.
 */
export declare const serializeQuadStream: (quadStream: Stream<Quad> | null, mimeType: string, _options?: Record<string, unknown>) => Promise<string>;
/**
 * The computed rewrite configuration.
 */
export interface RewriteConfiguration {
    /** Whether IRI rewriting is enabled. */
    rewrite: boolean;
    /** The normalized dataset base URL (or `null` when rewriting is disabled). */
    datasetBaseUrl: string | null;
    /** Rewrite an IRI to the dataset base URL. */
    replaceIri: (iri: string) => string;
    /** Compute the origin of an IRI. */
    iriOrigin: (iri: string) => string;
}
/**
 * Compute the value for the `rewrite` option and the `datasetBaseUrl`.
 *
 * @param value The value from the configuration (ideally: true, false or auto ; default="auto").
 * @param datasetBaseUrl The dataset base URL to use in case rewriting is enabled.
 * @returns The computed value of the `rewrite` option.
 */
export declare const getRewriteConfiguration: (value: unknown, datasetBaseUrl?: string) => RewriteConfiguration;
export interface QueryResult {
    /** The response body. */
    response: unknown;
    /** The response content type. */
    contentType: string;
}
export interface RewriteResponseOptions {
    /** The string to find. */
    find: string;
    /** The string to replace with. */
    replace: string;
}
export interface QueryOptions {
    /** Is it a ASK query? */
    ask?: boolean;
    /** Is it a SELECT query? */
    select?: boolean;
    /** Headers to use in the request. */
    headers?: Record<string, string>;
    /** Replace strings in the response. */
    rewriteResponse?: Array<RewriteResponseOptions>;
}
export interface SPARQLClient {
    /** Supported clients. */
    clients: {
        parsing: ParsingClient;
        simple: SimpleClient;
    };
    /** Query function. */
    query: (query: string, options?: QueryOptions) => Promise<QueryResult | Array<ResultRow> | boolean>;
}
/**
 * Generate a SPARQL client.
 *
 * @param sparqlEndpoint The SPARQL endpoint URL.
 * @param options Options.
 * @returns The SPARQL client.
 */
export declare const generateClient: (sparqlEndpoint: string, options: QueryOptions) => SPARQLClient;
export interface SPARQLEndpointConfig {
    /** SPARQL endpoint URL. */
    url: string;
}
/**
 * Create a SPARQL query function that can be used inside Trifid plugins.
 *
 * @param logger Logger instance.
 * @param configuredEndpoints Configured endpoints.
 * @param instanceHostname Instance hostname, used to resolve relative URLs.
 * @returns Query function.
 */
export declare const initQuery: (logger: Logger, configuredEndpoints?: Record<string, SPARQLEndpointConfig>, instanceHostname?: string) => {
    endpoints: Record<string, SPARQLClient>;
    query: (pluginLogger: Logger) => TrifidQuery;
};
//# sourceMappingURL=sparql.d.ts.map