template property
An optional template string for constructing IRIs from resource properties.
The template can contain static text combined with variables in curly braces. Two variable expansion syntaxes are supported:
- Standard variables (
{variable}): Values are percent-encoded according to URI standards - Reserved expansion (
{+variable}): Values containing URI-reserved characters like slashes are not percent-encoded, preserving them as structural URI components
Variables are resolved in the following order:
-
Class property variables: Bound to properties marked with
@RdfIriPart- Example:
IriStrategy('urn:isbn:{isbn}')where{isbn}is replaced with the value of a property marked with@RdfIriPart('isbn') - Multiple properties can be combined:
{+baseUrl}/users/{userId}/profiles/{profileId}
- Example:
-
Context variables: Any variable not bound to a property (commonly using
+prefix)- When used with
registerGlobally = true(default):- The generator adds provider parameters to
initRdfMapper - Example:
{+baseUri}createsrequired baseUriProvider: () => 'https://example.org'
- The generator adds provider parameters to
- When used with
registerGlobally = false:- The mapper looks for:
- Properties in the parent class with
@RdfProvides('variableName') - Or adds the provider as a required constructor parameter
- Properties in the parent class with
- The mapper looks for:
- The
+prefix (e.g.,{+baseUri}) indicates variables that may contain URI-reserved characters like slashes, which should not be percent-encoded when substituted
- When used with
If no template is provided (template == null), the property marked with @RdfIriPart
will be used directly as the complete IRI value.
Implementation
final String? template;