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 | 1x 4x 1x 3x 2x 2x 1x 1x 1x | import * as vscode from 'vscode';
import { container } from 'tsyringe';
import { ServiceToken } from '@src/services/tokens';
import { SparqlQueryExecutionState } from '@src/languages/sparql/services/sparql-query-state';
import { SparqlResultsController } from '@src/views/webviews';
import { executeNotebookCell } from './execute-notebook-cell';
export const executeSparqlQuery = {
id: 'mentor.command.executeSparqlQuery',
handler: async (query: SparqlQueryExecutionState): Promise<void> => {
if (query.notebookIri && query.cellIndex !== undefined) {
// @ts-ignore: handler signature
executeNotebookCell.handler(query.notebookIri, query.cellIndex);
} else if (query.documentIri) {
const document = vscode.workspace.textDocuments.find(d => d.uri.toString() === query.documentIri);
if (!document) {
throw new Error(`Document with IRI ${query.documentIri} not found.`);
}
const controller = container.resolve<SparqlResultsController>(ServiceToken.SparqlResultsController);
await controller.executeQueryFromTextDocument(document);
}
}
}; |