Skip to content

Templates

Are you bored with greeting1, greeting2 & greeting3 by now? 😼 Fear not - Enola has a way to define ALL Greetings! 😸 To learn how, check out greetingN.ttl:

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

:greeting a rdfs:Class;
  enola:iriTemplate "https://example.org/greet/{NUMBER}";
  enola:example     <https://example.org/greet/42>;
  :yo               "http://example.org/hi/{NUMBER}"^^enola:IRITemplate.

This means:

  1. All https://example.org/greet/{NUMBER}, such as https://example.org/greet/456 as well as https://example.org/greet/789 (and any other) ARE a Greeting. (See also the iriTemplate property documentation.)

  2. The yo property says that all Greetings (not just the above class!) have a link - but it depends on the NUMBER from the IRI; e.g. https://example.org/greet/456 has a yo link to http://example.org/hi/456 but https://example.org/greet/789 to http://example.org/hi/789.

  3. https://example.org/greet/42 is one an example of such a Greeting.

Check it out by generating documentation:

$ ./enola docgen --load "file:docs/models/example.org/greetingN.ttl" --output=file:///tmp/models/ --no-index

https://example.org/greeting

Now click on the example link (42)… can you tell what happened?! 😻

PS: In Technical Infrastructure Models, Things like a Machine, or perhaps more ephemeral concepts such Kubernetes Pod might be good candidates for such “templated Things”.