All files / languages/sparql sparql-document.ts

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

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                  7x               3x                      
import * as vscode from 'vscode';
import { RdfSyntax } from '@faubulous/mentor-rdf-parsers';
import { TurtleDocument } from '@src/languages/turtle/turtle-document';
 
/**
 * A document context for SPARQL documents.
 */
export class SparqlDocument extends TurtleDocument {
	constructor(uri: vscode.Uri) {
		super(uri, RdfSyntax.Sparql);
	}
 
	/**
	 * SPARQL documents are considered loaded when tokens are available.
	 * Unlike RDF documents, SPARQL queries don't produce graphs.
	 */
	override get isLoaded(): boolean {
		return this.hasTokens;
	}
 
	public override async infer(): Promise<void> {
		// Inference is not supported for SPARQL documents.
	}
 
	public override async loadTriples(data: string): Promise<void> {
		// SPARQL documents don't load triples into the store.
		// Tokens are already set by the language server.
	}
}