All files / languages/sparql/services/endpoints default-endpoint-provider.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

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                          70x   70x           1x           1x                 1x      
import { SparqlConnection, SparqlStoreType } from '../sparql-connection';
import { ComunicaEndpoint, SparqlEndpoint } from '../sparql-endpoint';
import { ISparqlEndpointProvider, SparqlEndpointOptions } from '../sparql-endpoint-provider.interface';
 
/**
 * Default query source provider for generic SPARQL endpoints.
 * 
 * This provider creates query sources for standard SPARQL endpoints
 * that do not support inference toggling through URL parameters or headers.
 * It serves as a fallback when no specific provider is registered for
 * a store type.
 */
export class DefaultSparqlEndpointProvider implements ISparqlEndpointProvider {
    readonly storeType: SparqlStoreType = 'sparql';
 
    readonly supportsInference = false;
 
    async createEndpoint(
        connection: SparqlConnection,
        _options: SparqlEndpointOptions
    ): Promise<ComunicaEndpoint> {
        const source: SparqlEndpoint = {
            type: 'sparql',
            value: connection.endpointUrl,
            connection: connection,
        };
 
        return source;
    }
 
    async getGraphs(
        _connection: SparqlConnection,
        _options: SparqlEndpointOptions
    ): Promise<string[]> {
        // TODO: Implement generic SPARQL graph retrieval via SPARQL query
        // e.g., SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } }
        return [];
    }
}