Skip to content

Workspace Index

Upon opening a workspace, Mentor automatically builds a index of all RDF terms used across the files in your workspace. This index enables features like code lenses and the “Find Usages” and “Go to Definition” commands, allowing you to quickly navigate and explore your knowledge graph project.

The index is kept entirely in memory and will be rebuilt each time you open the workspace. When files have changed, are added or removed the index is updated incrementally to reflect these changes.

In addition to the term maps, Mentor also maintains an in-memory triple store containing all RDF triples found in the workspace. This allows you to run SPARQL queries against all of your files in the workspace directly from within Visual Studio Code.

Mentor keeps track of the following RDF related data in your workspace:

DataDescription
ReferencesA mapping of IRIs to the files and line numbers where they are used, either as a subject or an object of a triple.
DefinitionsA mapping of IRIs to the files and line numbers where they are defined as a subject with an rdf:type predicate.
PrefixesA mapping of prefixes to their corresponding namespace IRIs, along with the files where they are declared.
TriplesAn in-memory representation of all RDF triples found in the workspace, allowing for querying the data with SPARQL.

The indexing process runs in the background and may take a few moments to complete, depending on the size of your workspace. You can monitor the indexing status in the Mentor status bar at the bottom of the Visual Studio Code window:

Screenshot of the Indexing status bar in Visual Studio Code

When indexing RDF files then the contents of all files are stored in an internal in-memory triple store.

Mentor automatically loads a set of built-in RDF ontologies into the triple store to provide foundational definitions and relationships for common terminology. These ontologies include:

OntologyGraph IRI
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfahttp://www.w3.org/ns/rdfa#
rdfshttp://www.w3.org/2000/01/rdf-schema#
owlhttp://www.w3.org/2002/07/owl#
shaclhttp://www.w3.org/ns/shacl#
skoshttp://www.w3.org/2004/02/skos/core#
skos-xlhttp://www.w3.org/2008/05/skos-xl#
xsdhttp://www.w3.org/2001/XMLSchema#
dcathttp://www.w3.org/ns/dcat#

The IRIs of these ontologies are used as named graphs in the triple store. You can query these graphs directly using SPARQL to access the definitions and relationships they provide.

For every RDF document in your workspace, Mentor creates an internal named graph that contains all triples found in that document. The graph IRI is derived from the document’s URI in the workspace. For example, for a document located at /documents/example.ttl, the corresponding graph IRI would be:

workspace:/documents/example.ttl

The file: IRI scheme is not used here because it does not support relative paths and thus cannot provide workspace-independent references.

To ensure that trees correctly displays all kinds of classes, such as OWL restrictions or equivalent classes, Mentor applies structural reasoning when parsing RDF documents. This means that a reasoning engine infers additional class, subclass relationships and property types based on the OWL and SHACL semantics.

The results of the reasoning process are stored in a separate graph that follows the same scheme as the document graph but appends ?inference to the graph IRI. For example:

workspace:/documents/example.ttl?inference

If the data graph IRI already contains query parameters, then the inference parameter is simply appended to the existing ones.

The memory consumption depends on the size of your workspace and the number of RDF terms used. For large workspaces, this may lead to increased memory usage. You can monitor the memory consumption of Mentor in the Visual Studio Code Process Explorer.

To avoid long indexing times or out-of-memory errors in large workspaces, you can configure Mentor to exclude certain files or folders from being indexed. The following settings are available: