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/456
as well ashttps://example.org/greet/789
(and any other) ARE aGreeting
. (See also theiriTemplate
property documentation.) -
The
yo
property says that all Greetings (not just the above class!) have a link - but it depends on theNUMBER
from the IRI; e.g.https://example.org/greet/456
has ayo
link tohttp://example.org/hi/456
buthttps://example.org/greet/789
tohttp://example.org/hi/789
. -
https://example.org/greet/42
is 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:iriTemplate
: https://example.org/greet/{NUMBER}- 🤔
enola:example
:ex:greet/42
ex:yo
: http://example.org/hi/{NUMBER} {}enola:IRITemplate
IRI Template- 🏺
enola:origin
Origin: greetingN.ttl
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”.