Template:Accession relations
More actions
Renders one group of related accessions for Template:Infobox accession.
Two sources feed one group. Accessions that exist come from a query, so a relationship
typed on either of two pages shows on both and nothing has to be edited twice. Values typed
into this page that are not pages are printed as plain text after them, because
several accessions carry free text such as All Khati Accessions in
related_accession and linking those would assert pages that nobody is going to
write. A value that is a page is left to the query, so nothing appears twice.
The #ask sits at the top level of a template because an ask nested directly
inside #if with |-escaped pipes reaches SMW as one unsplit
argument and fails; Template:RecordRelated exists for the same reason. The query is
written twice, once as a one-row probe that decides whether the group renders at all and
once for the rows, so that a group with nothing to show prints nothing rather than an empty
heading.
Parameters:
rel- which relation to show.children: accessions whoseparent_accessionis this page, that is, the material grown from it.samepop:same_population_accessions, read in both directions.related:related_accession, read in both directions.
page- the accession being rendered, normallyTemplate:Accession relations.typed- the matching field of this page, so that values naming no page still show.label- the group heading.limit- maximum rows, 24 by default.
Query notes, each of which has caught this wiki before:
[[Category:Accessions]]keeps values that name no accession out of the query.- There is no
sort: a sort on a property silently drops every result that lacks
it. Default title order is the accession ID, which every accession page has.
- Class names use single hyphens, because a double underscore inside an ask parameter is
flattened to a space.
- The
#arraymapvariable is@@, notx: arraymap replaces
every occurrence of the variable in the formula, so anxvariable rewrites{{#ifexist:into{{#ife<value>ist:and the call renders as literal text.