All files / services/core preset-graphs.ts

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

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 45 46 47                                  15x                             15x                   1x 8x      
import { Store, _OWL, _RDF, _RDFA, _RDFS, _SH, _SKOS, _SPARQL, _XSD } from '@faubulous/mentor-rdf';
import owl from '@faubulous/mentor-rdf/ontologies/owl.ttl';
import rdf from '@faubulous/mentor-rdf/ontologies/rdf.ttl';
import rdfa from '@faubulous/mentor-rdf/ontologies/rdfa.ttl';
import rdfs from '@faubulous/mentor-rdf/ontologies/rdfs.ttl';
import sh from '@faubulous/mentor-rdf/ontologies/sh.ttl';
import skos from '@faubulous/mentor-rdf/ontologies/skos.ttl';
import sparql from '@faubulous/mentor-rdf/ontologies/sparql.ttl';
import xsd from '@faubulous/mentor-rdf/ontologies/xsd.ttl';
import { PresetGraph } from '@src/services/core/preset-graph';
import { PRESET_SHAPE_GRAPHS } from '@src/services/validation/presets';
 
/**
 * The RDF framework vocabularies, which are required for providing completions,
 * hovers and definitions for built-in concepts. Each is loaded into the graph
 * named by its namespace IRI.
 */
export const FRAMEWORK_VOCABULARY_GRAPHS: PresetGraph[] = [
	{ path: 'vocabularies/rdf.ttl', graphIri: _RDF, source: rdf, executeInference: true },
	{ path: 'vocabularies/rdfa.ttl', graphIri: _RDFA, source: rdfa, executeInference: true },
	{ path: 'vocabularies/rdfs.ttl', graphIri: _RDFS, source: rdfs, executeInference: true },
	{ path: 'vocabularies/owl.ttl', graphIri: _OWL, source: owl, executeInference: true },
	{ path: 'vocabularies/sh.ttl', graphIri: _SH, source: sh, executeInference: true },
	{ path: 'vocabularies/skos.ttl', graphIri: _SKOS, source: skos, executeInference: true },
	{ path: 'vocabularies/sparql.ttl', graphIri: _SPARQL, source: sparql, executeInference: true },
	{ path: 'vocabularies/xsd.ttl', graphIri: _XSD, source: xsd, executeInference: true },
];
 
/**
 * All graphs that ship with Mentor: the framework vocabularies and the preset
 * shape graphs.
 */
export const PRESET_GRAPHS: PresetGraph[] = [
	...FRAMEWORK_VOCABULARY_GRAPHS,
	...PRESET_SHAPE_GRAPHS,
];
 
/**
 * Loads the RDF framework vocabularies into the store.
 * @param store The store to load the vocabularies into.
 */
export function loadFrameworkVocabularies(store: Store): void {
	for (const graph of FRAMEWORK_VOCABULARY_GRAPHS) {
		store.loadTurtle(graph.source, graph.graphIri, graph.executeInference);
	}
}