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.
Indexed Data
Section titled “Indexed Data”Mentor keeps track of the following RDF related data in your workspace:
| Data | Description |
|---|---|
| References | A mapping of IRIs to the files and line numbers where they are used, either as a subject or an object of a triple. |
| Definitions | A mapping of IRIs to the files and line numbers where they are defined as a subject with an rdf:type predicate. |
| Prefixes | A mapping of prefixes to their corresponding namespace IRIs, along with the files where they are declared. |
| Triples | An in-memory representation of all RDF triples found in the workspace, allowing for querying the data with SPARQL. |
Indexing Status
Section titled “Indexing Status”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:
Generated Graphs
Section titled “Generated Graphs”When indexing RDF files then the contents of all files are stored in an internal in-memory triple store.
Framework Ontologies
Section titled “Framework Ontologies”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:
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.
Documents
Section titled “Documents”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.ttlThe file: IRI scheme is not used here because it does not support relative paths and thus cannot
provide workspace-independent references.
Inference
Section titled “Inference”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?inferenceIf the data graph IRI already contains query parameters, then the inference parameter is simply
appended to the existing ones.
Memory Usage
Section titled “Memory Usage”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.
Settings
Section titled “Settings”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: