Nanopublication template
Templates that describe the shape of a nanopublication: statements, placeholders, resources, versions, settings, and fill modes.
What a nanopublication template is
A template is itself a nanopublication. It describes the shape of one part of some other nanopublication as a list of statements, with placeholders standing where the values are still to come. Nanodash turns a template into a form, and publishes the filled-in values in place of the placeholders.
Because a template is an ordinary nanopublication, it is signed, versioned and citable like any other, and the nanopublications made from it record which template they came from.
The three kinds of template
There is one kind of template for each part of a nanopublication that gets filled in: nt:AssertionTemplate for the assertion, nt:ProvenanceTemplate for the provenance, and nt:PubinfoTemplate for the publication info. All three are subclasses of nt:NanopubTemplate and work the same way.
A publish form combines one assertion template, one provenance template, and any number of publication-info templates. The assertion template is the one you pick; it gives the form its name and normally brings sensible defaults for the other two.
A template can additionally be typed nt:UnlistedTemplate. It is then no longer offered when creating new nanopublications but stays usable by its URI, so nanopublications already made from it can still be opened and updated. This is how a template is retired without breaking anything.
Creating a template
Templates are made with a template. Nanodash offers "Defining an assertion template" (and counterparts for provenance and publication-info templates), where you enter the statements and placeholders described below in a form and publish the result. A newly published template shows up in the template lists shortly afterwards, grouped under its tag.
A template can also be written by hand as a nanopublication file and published with the command-line tools. The result is the same kind of nanopublication either way, so a hand-written template can later be reopened and revised in the form.
Statements
The body of a template is its statements, each listed with nt:hasStatement and described by rdf:subject, rdf:predicate and rdf:object:
sub:st1 rdf:subject sub:paragraph ; rdf:predicate schema:title ; rdf:object sub:title .
Any of the three positions may be a fixed IRI, which then appears unchanged in every nanopublication made from the template, or a placeholder, which the user fills in. Fixed IRIs are usually given an rdfs:label in the template, so the form can show words rather than URIs. Where the order of statements matters, it is set with nt:statementOrder.
Optional, repeatable and grouped statements
A statement typed nt:OptionalStatement may be left empty, and is then simply absent from the published nanopublication. One typed nt:RepeatableStatement can be filled more than once, which gives the form an "add another" control.
A statement typed nt:GroupedStatement contains other statements, again listed with nt:hasStatement, and they are filled and repeated together as a unit. A group is how a template expresses a small record with several fields — say, an action with its label, its template and who may see it — rather than a single triple. An optional group can be left out as a whole.
Placeholders
A placeholder is a node in the template typed with one of the placeholder classes and given an rdfs:label; that label is what the form shows as the field's name.
The common kinds are: nt:LiteralPlaceholder for a short text and nt:LongLiteralPlaceholder for a longer one; nt:UriPlaceholder for a URI to be minted here and nt:ExternalUriPlaceholder for one that already exists elsewhere; nt:TrustyUriPlaceholder for the URI of another nanopublication; nt:AgentPlaceholder for a person or agent; nt:DatePlaceholder for a date whose precision is left to the author; and nt:RestrictedChoicePlaceholder and nt:GuidedChoicePlaceholder for values chosen from a list or looked up. nt:ValuePlaceholder accepts a text or a URI.
A placeholder can carry several types at once, for example a URI placeholder that is also an introduced resource, or a lookup field that is also an nt:ExternalUriPlaceholder, so that the form does not offer to mint a new identifier. nt:NewUriPlaceholder marks the opposite case, a field naming something that must not exist yet. A few further, rarely needed types exist for special cases such as automatically escaped URIs.
Fields that refer to people
A field standing for a person, an organisation or a bot should be an nt:AgentPlaceholder rather than a plain URI placeholder. It gives the form agent lookup and selection, and it marks the value as an agent for anything reading the nanopublication later.
Where the person filling in the form is the likely value — an author, a presenter — add nt:hasDefaultValue nt:CREATOR, and the field is pre-filled with the logged-in user.
Where the agent must already exist — which is nearly always — type the field nt:ExternalUriPlaceholder as well. Otherwise the form offers whatever name is typed as a new identifier minted on the spot, which then refers to nobody. Leave it off only where the form is meant to describe a new agent.
Choices looked up while typing
An nt:GuidedChoicePlaceholder lets the user search for an existing resource and pick it, instead of pasting a URI. Where to search is given by nt:possibleValuesFromApi: the beginning of a lookup URL, to which the form appends what the user types.
The usual source is the nanopublication lookup restricted to one type, which finds things introduced by nanopublications, for instance all spaces or all classes. Wikidata's entity search is the usual source for general topics; it cannot be restricted by type, so it suits open subjects better than fields where only one kind of thing makes sense. Several sources may be listed, and their results are offered together.
A lookup only suggests: a name that matches nothing is offered as a new identifier, minted on the spot. For a field that refers to something existing — a space, a template, a class — add nt:ExternalUriPlaceholder, and the form no longer offers to mint one.
Since Nanodash 5.20 each suggestion shows, under its label, its URI in short form, where it comes from — the space it belongs to, or else the person who published it — and how long ago it was published, newest first. If a lookup cannot be reached, a line under the field says so and offers to try again.
Choices fixed by the template
An nt:RestrictedChoicePlaceholder offers a closed set of values, listed in the template with nt:possibleValue, one per value, or taken from another nanopublication with nt:possibleValuesFrom.
A value outside the set is refused. This makes it the right type for a field that selects between a few well-defined options — a view type, a role tier, on or off — rather than for open-ended content.
Dates and other typed values
nt:hasDatatype on a literal placeholder both constrains the value and changes the field. With xsd:date or xsd:dateTime, the form shows a date picker instead of a text field. For a point in time coarser than a day, the types xsd:gYear, xsd:gYearMonth, xsd:gMonth, xsd:gMonthDay and xsd:gDay are offered as parts to pick, such as a year alone.
A fixed datatype suits a field whose precision the template can decide. Where it is the author's to decide — one person knows only the year, another the hour — use nt:DatePlaceholder instead (Nanodash 5.20 and later). It offers year, month, day, time and timezone, and the published value is typed by what was entered: "2026"^^xsd:gYear, "2026-11"^^xsd:gYearMonth, "2026-11-16"^^xsd:date, or a full xsd:dateTime. On this placeholder, nt:hasDatatype lists the precisions accepted instead of fixing one.
The datatype is matched exactly. A placeholder with a datatype does not accept a plain, untyped value, so adding a datatype to a field of an existing template makes the older nanopublications, whose values are untyped, no longer fit it.
Resources minted by the nanopublication
Three placeholder roles say where a URI comes from and what it stands for. nt:LocalResource marks a resource minted under the new nanopublication's own URI, so the user only types a short name for it.
nt:IntroducedResource additionally records the resource in the publication info with npx:introduces: this nanopublication brings the thing into existence, and the thing has an identity of its own that others can refer to. nt:EmbeddedResource records it with npx:embeds instead: the resource is content that belongs to this particular nanopublication.
The difference shows when a nanopublication is superseded. An introduced resource keeps the same URI in every later version, so a new version must refer to the original URI rather than mint another; an embedded resource is expected to get a new URI with each version.
Either way, the resource must be something each nanopublication supplies itself: a placeholder, a local resource, or a URI containing the ~~ARTIFACTCODE~~ marker. A fixed URI from elsewhere, marked introduced or embedded, would have every nanopublication made from the template claim the same thing, so since Nanodash 5.20 the form reports such a template as faulty and will not publish from it.
How templates are identified and versioned
A template is referred to by a URI. In older templates that is the URI of the nanopublication itself. Newer ones tell the template apart from each template version: the version is a node inside the nanopublication, marked as embedded and carrying the statements, and nanopublications made from it name that node. Both forms remain valid.
A template version names the template it belongs to with dct:isVersionOf: a URI that the first version introduces and every later version keeps. Templates made since late October 2026 call the two …/template and …/templateVersion. Older ones called the version …/template and the template …/templateKind; those URIs stay as they are, and nothing depends on the names.
Like any nanopublication, a template version can be superseded, and forms opened on an older version can offer the latest. A version can also name a space with gen:governedBy; once that space maintains the template, the current version is the newest one published by any member of the space, rather than by the holder of one particular key. This lets a community keep a shared template up to date even when its original author is no longer around. Provenance and publication-info templates work the same way: the forms for defining them offer both statements, and Nanodash follows them there too.
Settings for the whole template
Besides its statements, a template can declare a few things about itself. nt:hasTag gives the heading under which it is listed. nt:hasNanopubLabelPattern is a pattern like ${title} that names each published nanopublication after one of its fields. nt:hasTargetNanopubType gives one or more types that every nanopublication made from the template is marked with, which is how such nanopublications can later be found as a group.
Two settings reach into the other parts of the form: nt:hasDefaultProvenance names the provenance template the form opens with, and nt:hasRequiredPubinfoElement names publication-info templates that are always included, so that a form never lacks a particular piece of metadata.
Metadata that is not carried forward
Some publication-info templates describe metadata that belongs to one nanopublication alone, such as a "derived from" link, a change note, or the creator. When such a nanopublication is later used as the starting point for another, this metadata must not be copied along, or the new nanopublication would claim things that are no longer true.
A publication-info template typed nt:TransientTemplate marks its content as exactly that kind: consumed and dropped when the nanopublication is reused, never carried into the new one.
Prefixes on URI fields
nt:hasPrefix puts a fixed beginning in front of a URI field, so the user only types what comes after it, and nt:hasPrefixLabel gives that beginning a readable name in the form.
The prefix may also contain a token standing for wherever the form was opened: ~~SPACE~~ for the current space, and ~~NAMESPACE~~ for the namespace of the current maintained resource. A template using these mints new resources under the space or vocabulary the user is working in, rather than under a namespace fixed when the template was written. If the form is opened without such a context, it shows a picker to choose one.
A URI built from a prefix is not unique by construction: filling in the same name twice would make the second nanopublication quietly add to the first one's resource rather than create a new one. Typing the field nt:NewUriPlaceholder as well makes the form check, before publishing, whether any nanopublication already introduces the resulting URI, and refuse if one does (Nanodash 5.16 and later).
How a nanopublication records its templates
A nanopublication made from templates records them in its publication info: nt:wasCreatedFromTemplate for the assertion template, nt:wasCreatedFromProvenanceTemplate for the provenance one, and nt:wasCreatedFromPubinfoTemplate, one per template, for the publication-info ones.
These links are what allow a nanopublication to be reopened in the form it came from, to be superseded, or to serve as the starting point for another one. They are worth including even in a nanopublication written by hand, since without them it can be read but not maintained through the forms.
Each link must name a template of its own kind: a provenance template in the provenance link, publication-info templates in the publication-info links. The usual mistake is naming one of the templates that define provenance or publication-info templates. Since Nanodash 5.22.3 such a link is passed over, and a form opened on the nanopublication falls back to the generic templates.
Starting a form from an existing nanopublication
A form can be opened on an existing nanopublication instead of empty, and the way it is opened decides what the new nanopublication is in relation to the old one.
Use copies the content as a starting point for something new and independent; partial does the same but quietly drops whatever does not fit the chosen template. Supersede makes a new version of the same thing: it links back with npx:supersedes and keeps the identifiers of what the old nanopublication introduced. Derive makes a different thing based on the old one, linking back with prov:wasDerivedFrom but minting fresh identifiers. Override links back the same way but keeps the identifiers, which amounts to editing the thing in place — and, unlike supersede, it does not require the same signing key, so it is how someone revises what another person published.
Opening a form by link
A form can be reached directly by URL, with the template and any number of fields already filled in:
/publish?template=<template URI>¶m_title=Some+title¶m_space=<space URI>
Each param_ is followed by the placeholder's short name. Adding template-version=latest opens the newest version of the template instead of the one named. This is how the action buttons on views open pre-filled forms, and it is a convenient way to send someone a ready-to-publish link.
This page is a copy of the topic Nanopublication template of the Nanopublication Docs. Each paragraph is a nanopublication. In Nanodash you also find their examples, related paragraphs, and version history, and members of the nanopub space can edit them there.