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. You can generate documentation:

$ ./enola docgen --load "file:docs/models/example.org/greeting3.ttl" --output=file:///tmp/models/ --no-index
Loaded models have validation errors; use -v to show them
Use --no-validate to continue anyway

👋 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!