All files / languages/sparql/services sparql-result-serializer.interface.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                                                                                       
import * as vscode from 'vscode';
import { AsyncIterator } from 'asynciterator';
import { Bindings, Quad } from '@rdfjs/types';
import { BindingsResult, SparqlQueryExecutionState } from '@src/languages/sparql/services/sparql-query-state';
 
/**
 * Interface for the SparqlResultSerializer.
 */
export interface ISparqlResultSerializer {
	/**
	 * Serializes SPARQL query results into a format suitable for the webview.
	 * @param context The query execution context.
	 * @param bindingStream The SPARQL query results as a BindingsStream.
	 * @param token The cancellation token.
	 * @returns An object containing the serialized results.
	 */
	serializeBindings(
		context: SparqlQueryExecutionState,
		bindingStream: AsyncIterator<Bindings>,
		token: vscode.CancellationToken
	): Promise<BindingsResult>;
 
	/**
	 * Serializes a stream of quads into Turtle format.
	 * @param context The query execution context.
	 * @param quadStream The SPARQL query results as a QuadStream.
	 * @param token The cancellation token.
	 * @returns A string containing the serialized Turtle document.
	 */
	serializeQuads(
		context: SparqlQueryExecutionState,
		quadStream: AsyncIterator<Quad>,
		token: vscode.CancellationToken
	): Promise<string>;
 
	/**
	 * Serializes an array of quads into Turtle format without requiring a context.
	 * @param quads The array of quads to serialize.
	 * @param namespaces Optional namespace map for prefix resolution.
	 * @returns A string containing the serialized Turtle document.
	 */
	serializeQuadsToString(quads: Quad[], namespaces?: Record<string, string>): Promise<string>;
}