Skip to content

Authoring Write Turtle

New to Folio? Start here

Write Turtle

Turtle is the plain-text format RDF is usually written in. Each statement is a triple: a subject, a predicate and an object. Folio's Turtle Editor completes each one as you type, adds the punctuation and prefix lines for you, and checks the file against the profile you pick.

This guide builds films.ttl, a Film class schema checked by the Class Schema profile, from an empty file. The Form view guide goes on to edit the same class schema as a form.

Create the file

Select New file in the Explorer and pick Turtle, the format marked "Best for modeling". Folio adds Untitled.ttl to the Explorer with its name selected. Type films and press Enter.

The file opens empty. Its toolbar holds + Resource, View ▾, the Profile menu, and the Code | Form switch, which starts on Code.

New file offers Turtle as a .ttl file.

Pick a profile

A profile is the set of vocabularies and shapes a file is written against. Folio warns about any term in the file outside of the selected profiles.

Open the Profile menu at the top right of the editor. It reads your workspace's name. Pick Class Schema. Folio writes two lines into the file, @prefix dct: and a <> dct:conformsTo statement that names the profile, and the menu reads Class Schema.

Class Schema picked for this file. Folio wrote the line that says so.

Name the file's namespace

Every name in the file is short for a full IRI, and the empty prefix : is the one you will use most. At the end of the @prefix dct: line, press Enter and type the line below. Folio draws a grey . at the end of the line; press Enter to write it.

The address is your package's base IRI followed by films#. On a new workspace the base IRI is https://example.org/my-semantic-package/; if your package has its own, use that. With this line, :Film means https://example.org/my-semantic-package/films#Film.

Turtle
@prefix : <https://example.org/my-semantic-package/films#> .

Typeahead fills each slot

Below the <> statement, start a new one with the subject :Film, then a, Turtle's word for "is a". Type Cla and the list offers svs:ClassSchema. Press Enter to take it, then Enter again to take the grey ; after it.

In the predicate slot, type Lab. The list is headed PROPERTIES OF CLASSSCHEMA: the properties Class Schema gives a class, each with its label beside it. Take rdfs:label, then type "Film"@en as its object. Take the ;, type descr, take rdfs:comment and type "A feature film whose rights the studio licenses to distributors."@en.

The predicate slot on a Class Schema. Each property shows the label its form field uses.

The grey ; and .

After an object, Folio draws a grey ; beside it and a grey . on the line below. Neither is in the file until you take it. Press Enter to take the ; and start the next line of the same subject. The first ; you take writes the . below as well, so the statement is closed while you add to it.

When the last line is done, leave its ; and move on.

Add a field and fix its warnings

Each field of a class schema is a sh:property. On the line after the description, type Prop and take sh:property. Type [ and Folio closes it as []. Press Escape, then Enter, to open the brackets onto their own lines. Inside them, type Pa, take sh:path, then type title and take dct:title.

A warning triangle appears beside sh:path. Hover it for the two warnings the profile raises: the field has no Label and no Description. Fix both inside the brackets:

  1. Take the grey ;, type nam, take sh:name and type "Title"@en.
  2. Take the ;, type descr, take sh:description and type "The name the film is released under."@en.
  3. Take the ; and type sh:minCount 1. Every Film now needs a title.

The warning triangle goes. Put the cursor after the closing ], press Enter to take its ;, and add two more fields the same way:

  • dct:rightsHolder (type rightsH), with the Label "Rights holder"@en, the Description "The company that holds the rights to the film."@en, and sh:nodeKind sh:IRI (type nodeK, then I), so it points at a company.
  • dct:issued, with the Label "Release date"@en, the Description "The date the film was first released."@en, and sh:datatype xsd:date (type dataty, then da), so it holds a date.
A field with only a path. The profile asks for its Label and Description.

Folio declares the prefix

Each time you take a name whose prefix the file doesn't declare yet, Folio adds the @prefix line at the top of the file. Taking svs:ClassSchema added svs:, rdfs:label added rdfs:, sh:property added sh:, and xsd:date added xsd:. Folio saves as you type; this is films.ttl on disk.

films.ttl
Two cards in Folio's Graph View. films, the file, shows its namespace and conforms to Class Schema. Film, a Class Schema, shows its comment A feature film whose rights the studio licenses to distributors. and lists its instance properties Release date (date), Rights holder, and Title (1..*).
Film, a Class Schema with three properties, and the file that conforms to Class Schema, in Graph View.

Read it back

Every statement in films.ttl reads left to right as subject, predicate, object: a triple. Each row is a piece of Turtle beside what it means, as films.ttl writes it. films.ttl uses no ,, typed value or comment, so those three rows give a film example of their own. Each construct's name links its section of the Turtle specification.

@prefix dct: <http://purl.org/dc/terms/> .
A prefix declaration. Makes dct: short for the IRI in angle brackets, so dct:title means http://purl.org/dc/terms/title. The @prefix : line does the same for the empty prefix, the file's own namespace.
<>
A relative IRI, read against the file's own address. Empty, it is the file itself: <> dct:conformsTo <…> names the profile the file is checked against.
:Film
The subject: the first term of a statement, the thing it describes. :Film is a prefixed name in the file's own namespace, short for https://example.org/my-semantic-package/films#Film.
a
"Is a". Short for rdf:type, so :Film a svs:ClassSchema says Film is a class schema.
;
A predicate list: another predicate for the same subject. :Film has a label, a description and three fields, and its name is written once. A ; with nothing after it, as on the <> statement, adds nothing.
,
An object list: another object for the same subject and predicate. When Form view adds a field, it writes sh:property [ … ], [ … ]: two fields without repeating sh:property.
.
Ends the statement. The next subject starts a new one.
[ … ]
A blank node: a resource with no name of its own, described in place by the predicates between the brackets. Each field of Film is one, such as sh:property [ sh:path dct:title ; … ].
"Film"@en
A string with a language tag. The tag after @ names the language, here English. Quoted text with no tag is a plain string.
"2025-06-13"^^xsd:date
A typed value: quoted text, ^^, then its XSD datatype. A film's release date is written this way, the value sh:datatype xsd:date asks the Release date field for.
sh:minCount 1
A number. A whole number needs no quotes: 1 is short for "1"^^xsd:integer. Here it means at least one value, so the field is required.
# Feature films the studio licenses.
A comment, from # to the end of the line. It adds nothing to the graph. Folio keeps a comment on the line above a subject when Form view edits the file.

One graph, whichever format wrote it

Folio reads every file in a workspace into one graph. films.ttl writes its statements directly. A Markdown page builds them from headings and lists, and a Spreadsheet builds them from rows. Nothing is imported or converted: a query or a form sees what every file says at once.

Choose the format that suits what you're writing. Turtle suits exact statements, like the fields Film has here or the concepts of a taxonomy. Markdown suits prose and domain models written as headings, as in Markdown syntax. A Spreadsheet suits many rows of the same kind of thing.

Ask your agent to…

  • "Add a box-office revenue field to :Film, then check films.ttl against the Class Schema profile and fix every warning it raises."