Skip to content

Classy

You can tell that the greeting1 and greeting2 from the previous steps are both some kind of “Salutations”, can’t you? But Enola cannot.

greeting3.ttl illustrates how you can make more “classy” greetings:

@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#>.
@prefix enola: <https://enola.dev/>.
@prefix :      <https://example.org/>.

:Salutation a rdfs:Class;
  enola:emoji "👋".

:greeting3 a :Salutation;
  :message "hello".

This simply expresses that greeting3 “is a” Salutation. We’re also adding an Emoji to the Class, which Enola always displays for both that class itself and its instances.

This concludes our introduction about 🐢 Turtle; more detailed information about it is available in our Turtle Reference documentation.

You can now e.g. re-generate documentation:

$ ./enola docgen --load docs/models/example.org/greeting3.ttl --output=/tmp/models/ --no-index

👋 ex:Salutation

https://example.org/Salutation

and:

👋 ex:greeting3

https://example.org/greeting3

PS: RDF also has (various) ways of expressing “constraints” (AKA “shapes”) of Things, based on such Classes (and similar concepts). Enola itself does not directly support e.g. validations of such a “types” (yet) - but you could use other RDF existing tooling!