Help:Templatefile format

From semantic-mediawiki.org
(Redirected from Help:Templatefile format)
Templatefile format
Outputs semantic data in arbitrary file formats defined via templates
Further Information
Provided by: Semantic MediaWiki
Added: 3.0.0
Removed: still supported
Requirements: none
Format name: templatefile
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: mwjames
Categories: export · plaintext
Table of Contents

The result format templatefile is used to produce links to file outputs in all sorts of formats defined in a template.

General[edit]

Parameter Type Default Description
source text empty Alternative query source
limit whole number 50 The maximum number of results to return
offset whole number 0 The offset of the first result
link text all Show values as links
sort list of texts empty Property to sort the query by
order list of texts empty Order of the query sort
headers text show Display the headers/property names
mainlabel text no The label to give to the main page name
intro text empty The text to display before the query results, if there are any
outro text empty The text to display after the query results, if there are any
searchlabel text templateFile Text for continuing the search
default text empty The text to display if there are no query results

Format specific[edit]

Parameter Type Default Description
template arguments text legacy Sets how the named arguments are passed to the template
template text empty The name of a template with which to display the printouts
valuesep text , The separator between results
userparam text empty A value passed into each template call, if a template is used
introtemplate text empty The name of a template to display before the query results, if there are any
outrotemplate text empty The name of a template to display after the query results, if there are any
filename text file.txt The name for the output file
mimetype text text/plain ⧼smw-paramdesc-mimetype⧽

Examples[edit]

Creating a BEACON file with GND numbers[edit]

GND is an international authority file for the organisation of personal names, subject headings and corporate bodies from catalogues. It is used mainly for documentation in libraries and increasingly also by archives and museums. The GND is managed by the German National Library (German: Deutsche Nationalbibliothek; DNB) in cooperation with various regional library networks.

BEACON is a data interchange format for large numbers of uniform links. The format was developed to exchange mappings between authority files and resources incultural institutions.

For more information, see

For SMW <3.x this could be achieved manually as explained in Help:BEACON.

For SMW since 3.x this can be done using the templatefile format:

Table output[edit]

{{#ask:
 [[Has GND::+]]
 |?Has GND=GND
 |?Foaf:name=Name
 |format=table
 |link=none
}}
 GNDName
John Doe123456789John Doe
Max Mustermann987654321Max Mustermann

File output[edit]

{{#ask:
 [[Has GND::+]]
 |?Has GND=GND
 |?Foaf:name=Name
 |format=templatefile
 |link=none
 |template=BEACON
 |introtemplate=BEACONIntro
 |template arguments=legacy
 |filename=beacon.txt
 |searchlabel=beacon export file
}}

beacon export file

See also[edit]

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:3024