Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Keeping Turtle and Dolfin in sync

In a turtle-origin project, every change you save in a Dolfin file is written back into the original Turtle automatically. You never have to export by hand.

When it runs

  • Three seconds after you save a .dlf file. Further saves within those three seconds are merged into one run.
  • When you delete or rename a .dlf file.

It runs once at a time per project and never for edits to package.dlf or to the Turtle itself.

What is changed in the Turtle

Sync compares what Dolfin produced at the last sync with what it produces now, subject by subject, and touches only the subjects that differ.

  • A changed declaration has its statement rewritten in place, using the Turtle’s own prefixes (missing prefixes are added after the last directive).
  • A new declaration is appended after its concept’s last statement, or at the end of the file.
  • A deleted declaration has its statements removed.
  • Everything else is left byte for byte: untouched statements, comments and blank lines between statements, and Turtle that Dolfin does not model (“foreign” statements, for example your own annotations) even on a subject that is rewritten.

Limits

  • Comments inside a rewritten statement are lost. Comments between statements are kept.
  • A rewritten statement uses the serializer’s layout, not yours, and blank nodes come back with generated labels (_:ts…).
  • A restriction or list whose blank nodes no longer match is replaced as a whole (it is listed as Degraded in the report).
  • Changes to package.dlf (version, author, description) are not copied to the Turtle.
  • Renaming a .dlf file changes its namespace and therefore the IRI of everything in it. Sync treats it as removing the old subjects and adding the new ones.

The status chip

The project toolbar shows a chip for turtle-origin projects. Click it for details.

ChipMeaning
Turtle in sync · 12:03Last sync succeeded at that (local) time.
syncing…A change is waiting or running.
blocked: turtle has syntax error (line N)The Turtle does not parse. Nothing is written. Fix the error and the next sync goes through.
blocked: dolfin has errorsThe Dolfin files do not compile. Nothing is written.
error: …Something else, with the reason (for example read-only when your licence has lapsed, or concurrent edit).

While blocked, no edit is lost: sync keeps its reference point and applies the whole difference once it can run.

Details

The popover shows the last report:

  • Updated, Added, Removed: the subjects sync touched;
  • Degraded: blank-node structures replaced as a whole;
  • Missing: subjects sync wanted to remove or change but could not find, because you already edited them in the Turtle (skipped);
  • the number of non-Dolfin statements kept.

Undo last sync

Undo last sync restores the Turtle as it was before the last sync, and survives a restart. It is refused if you edited the Turtle by hand since, or if it was already used.

Undo changes only the Turtle: the Dolfin edits that were synced stay. Turtle and Dolfin then differ until you change those declarations again or use Re-translate. Later edits sync normally.

If the Turtle is open while sync writes

If someone has the Turtle open, sync edits it as normal text operations, so other people’s cursors and selections are not disturbed. If the text changed under it, sync retries once and then reports error: concurrent edit.