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

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/build

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/.editorconfig

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/.prettierignore

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/.prettierrc.yaml

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/dev

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/.markdownlint.yaml

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/@babel/helper-compilation-targets/node_modules/.bin/semver

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/@babel/core/node_modules/.bin/semver

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/parser

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/esparse

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/js-yaml

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/browserslist

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/node-which

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/json5

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/acorn

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/esvalidate

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/tsc

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/update-browserslist-db

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/jsesc

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/eslint

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/tsserver

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/eslint-config-prettier

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/prettier

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/.bin/semver

WARNING: Ignoring symlink: /home/runner/work/enola/enola/web/node_modules/@istanbuljs/load-nyc-config/node_modules/.bin/js-yaml

๐Ÿ‘‹ 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!