Skip to main content

Module rename

Module rename 

Source
Expand description

Shared, model-based rename for the text RDF syntaxes (Turtle / TriG / SPARQL / N3 โ€” anything whose parsed Element is the Turtle model).

Unlike the language-agnostic rename in swls-core (which slices the rope at a term span and classifies the raw string), these systems work off the parsed Turtle model. Walking the model gives us:

  • exact term boundaries (no <>/_: string heuristics for finding the token under the cursor), and
  • natural de-duplication โ€” a subject written once with the ; shorthand appears exactly once in the model, so it yields exactly one edit.

Each text RDF language opts in via [setup_rename]. JSON-LD deliberately stays on the core agnostic path because its concrete syntax wraps IRIs in quoted strings rather than <>.

Functionsยง

prepare_rename
Model-based prepare_rename: report the range and placeholder of the term under the cursor.
rename
Model-based rename: replace every occurrence of the term under the cursor (matched by canonical key) with the wrapped new text.