Skip to content

Refactoring

Refactoring refers to changing the structure of existing code without altering its functionality. It is a common process in software development. Therefore, Mentor provides features to assist you in refactoring RDF data and queries and make working with RDF feel more intuitive.

In URIs the local name is the part that is different from the namespace, usually appearing after the last slash (/) or hash (#). For example, in the IRI http://example.org/ns#localName, the local name is localName.

To rename the local name of a URI in the document you can simply place the cursor on it and use the rename symbol command (F2) to edit it like you would rename variables in other programming languages. Mentor will automatically update all occurrences of the local name throughout the document in both prefixed and unprefixed forms.

Prefixes are used to shorten URIs and make them more readable. For example, instead of writing http://example.org/ns#localName, you can declare a prefix like ex and use ex:localName instead.

Renaming existing prefixes is another common refactoring task. You can select the prefix you want to change and use the rename symbol command (F2) to edit it. Mentor will automatically update all occurrences of the prefix throughout the document.

Mentor provides a quick way to extract the namespace portion of URIs and declare a prefix for it. When your cursor is placed on a URI, you can use the command palette to add a new prefix declaration, and Mentor will automatically change all occurrences of the full URI to a prefixed name throughout the document.