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:
-
All
https://example.org/greet/{NUMBER}, such ashttps://example.org/greet/456as well ashttps://example.org/greet/789(and any other) ARE aGreeting. (See also theiriTemplateproperty documentation.) -
The
yoproperty says that all Greetings (not just the above class!) have a link - but it depends on theNUMBERfrom the IRI; e.g.https://example.org/greet/456has ayolink tohttp://example.org/hi/456buthttps://example.org/greet/789tohttp://example.org/hi/789. -
https://example.org/greet/42is one an example of such a Greeting.
Check it out by generating documentation:
$ ./enola docgen --load docs/models/example.org/greetingN.ttl --output=/tmp/models/ --no-index
- ๐๏ธ
rdf:type:rdfs:Class - ๐
enola:example:ex:greet/42 - {}
enola:iriTemplateIRI Template: https://example.org/greet/{NUMBER} - ๐บ
enola:originOrigin: ex:yo: http://example.org/hi/{NUMBER} {}enola:IRITemplateIRI Template
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”.