Help:CSV format

From semantic-mediawiki.org
Jump to: navigation, search
CSV format
Outputs semantic data in Windows-style Comma Separated Value format
Available languages
deenruzh-hans
Further Information
Provided by: Semantic MediaWiki
Added: 1.2.1
Removed: still supported
Requirements: none
Format name: csv
Enabled by default: 
Indicates whether the result format is enabled by default upon installation of the respective extension.
yes
Authors: Nathan Yergler, Markus Krötzsch
Categories: export · plaintext
Group:
Table of Contents

↓ INFO ↓


The result format csv is used to produce links to CSV files.

Parameters

General

Parameter Type Default Description
source text empty Alternative query source
limit whole number 100 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 CSV Text for continuing the search
default text empty The text to display if there are no query results

Format specific

Parameter Type Default Description
sep text , The separator to use
showsep yes/no no Show separator in top of CSV file ("sep=<value>")
filename text result.csv The name for the output file

Output

All numeric or named entities in the generated output is decoded as UTF-8 string therefore the character set in your application has to be set accordingly (UTF-8).

Examples

{{#ask: [[Category:City]] [[located in::Germany]] 
| ?population
| format=csv
}}

Result: CSV

The same query, but this time, we're using tilde («~») as the separator.

{{#ask: [[Category:City]] [[located in::Germany]] 
| ?population
| format=csv
| sep=~
}}

Result: CSV

Remarks

On most platforms, CSV files will be automatically opened by the default spreadsheet program.



This documentation page applies to all SMW versions from 1.2.1 to the most current version.
      Other languages: defrruzh-hans

Help:CSV format en 1.2.1