Shortcut: wd:WDQS/Result views
Wikidata:Сервис запросов SPARQL/Помощь по сервису запросов Викиданных/Просмотр результатов

Эта страница помогает вам понять разнообразные возможности отображения результатов в сервисе запросов SPARQL. Страница примеров запросов содержит много хороших примеров, которые вы можете попробовать!
After running a query, you can choose with the "Display" button which result view you want to display. Depending on your query and the data type, some of the views will be available.
Таблица (по умолчанию)
Показывает данные результат в виде таблицы. Это — вид по умолчанию для результатов и может отображать любой тип данных.
Will map every variable from the SPARQL select clause to a formatted table column.
-
Табличный результат
-
Table Result on small screens with flipped columns
Image Grid

Shows the result data as a grid with images.
Every grid item has a big picture and opens the gallery when clicking on it.
Contents an item is the formatted row data.
Переменная | Тип данных | Mapping | Описание |
---|---|---|---|
* | медиафайл с Викисклада | Grid Item | Image columns will create a grid item. |
Ряда, не содержащие изображений, будут проигнорированы.
It’s nonetheless possible to include no image rows in the result by modifying the sparql by including a default image in case the image variable is not bound:
optional {
?item wdt:P18 ?img_ .
}
bind (if(bound(?img_),
?img_,
<http://commons.wikimedia.org/wiki/Special:FilePath/File:Profile_avatar_placeholder_large.png>) as ?image) # [[:commons:File:Profile_avatar_placeholder_large.png]] as a placeholder
Here the file commons:File:Profile avatar placeholder large.png is used as a placeholder, you can use your own
Опции
Имя опции | Тип | Описание |
---|---|---|
hide
|
Одно или больше имён переменных (строк, начинающихся с ? ), единственное значение или массив
|
Не показывать эти переменные в результате. |
Карта
Показывает данные результата как карту с данными Open Street Map.
Переменная | Тип данных | Mapping | Описание |
---|---|---|---|
* | Coordinate or Geographic shape | Map Marker | Колонки будут создавать маркер на карте.
Содержимое маркера — форматированный ряд данных. |
?layer | Map Marker Layer | Создаёт цветной слой карты, который позволяет фильтрование. | |
?rgb | Цвет | Color Map Marker | Example 000000 for black color. |
-
Карта со слоями Попробовать
-
Карта аэропортов в Бельгии Попробовать
Technically, any well-known text literal can be displayed, not just a point coordinate.
Non-point geometry values are never stored on Wikidata, but they can be constructed in SPARQL using functions like CONCAT()
and STRDT()
–
see this map of Czech railway lines for an example of LINESTRING()
geometry.
Опции
specify using e.g. #defaultView:Map{"hide":["?foo", "?bar"],"layer":"?bar"}
, using an array when there are multiple variables.
Имя опции | Тип | Описание |
---|---|---|
hide
|
Одно или больше имён переменных (строк, начинающихся с ? ), единственное значение или массив
|
Не показывать эти переменные в результате. |
layer
|
Одно или больше имён переменных (строк, начинающихся с ? ), единственное значение или массив
|
Используйте эти переменные для слоя карты, отличного от слоя по умолчанию ?layerLabel , ?layer .
|
markercluster
|
boolean or object |
|
Line, Bar, Scatter and Area Chart
Shows one of these chart types.
Variable | Тип данных | Mapping | Описание |
---|---|---|---|
* | Число
Метка Дата и время |
Ось X
Ось Y |
First will be X-axis, second Y-axis |
* | Метка | Category / Legend Item (optional) | Will only be used after the above are mapped |
* | Метка | Storyboard / Animation (optional) | Will only be used after the above are mapped |
Пузырьковая диаграмма

Shows a bubble chart where the size and the color of the bubble can configured.
When an item is provided a bubble is linked to Wikidata.org.
Переменная | Тип данных | Mapping |
---|---|---|
* | Метка | Имя пузырька |
* | Число | Размер пузырька |
* | Элемент | Bubble Link (optional) |
?rgb | Цвет | Цвет пузырька (опционально) |
Tree Map

Shows a zoomable tree map.
Переменная | Тип данных | Mapping | Описание |
---|---|---|---|
* | Метка | Метка | 1st label in a row will be 1st level in tree map. 2-я метка будет 2-м уровнем. 3-я метка будет 3-м уровнем и т. д. |
* | Элемент | Ссылка (опционально) | |
* | Количество | Размер |
Дерево
Показывает расширяемое дерево.

Переменная | Тип данных | Mapping | Описание |
---|---|---|---|
* | Элемент | Node ID | First item will be a root node the following items in the same row will be nested. |
* | Label | Node Label (optional) | Labels will be appended to current node. |
* | Number | Node Label (optional) | |
* | медиафайл с Викисклада | Изображение элемента |
Timeline

Shows a explorable timeline.
Переменная | Тип данных | Mapping | Описание |
---|---|---|---|
* | Дата и время | Item Point in Time
Item End Point in Time |
First date in a row sets the item position in the timeline.
If a second date is present a start and end date will be set. |
* | медиафайл с Викисклада | Изображение элемента |
Опции
Option name | Тип | Описание |
---|---|---|
hide
|
Одно или больше имён переменных (строк, начинающихся с ? ), единственное значение или массив
|
Не показывать эти переменные в результате. |
Dimensions

Shows dimension and their links.
It also allows filtering them by selecting an axis fraction.
This type of graph is also known as parallel coordinates.
Переменная | Тип данных | Mapping | Описание |
---|---|---|---|
* | Метка | Dimension | Every column in the result row is mapped to a dimension |
* | Число | ||
* | Дата и время |
Граф
Shows an interactive graph that allow hierarchically ordering and exploring items.
Переменная | Тип данных | Mapping | Описание |
---|---|---|---|
* | Элемент | Node ID | First item in a row of output variables will have an arrow pointing to the items in the same row. |
* | Метка | Node Label (optional) | |
* | медиафайл с Викисклада | Node Image (optional) | |
?rgb | Цвет | Node Color (optional) | Color of the item just before the rgb variable. Example 000000 for black color. |
* | Число | Node Size (optional) | |
?edgeLabel | Метка | Edge Label (optional) |

Дополнительная информация
RDF Data Type Mapping
RDF Type | RDF Data Type | Constraint | Тип данных |
---|---|---|---|
URI | String starts with http://www.wikidata.org/entity/Q |
Entity | |
URI | String starts with http://commons.wikimedia.org/wiki/Special:FilePath |
медиафайл с Викисклада | |
Literal | http://www.w3.org/2001/XMLSchema#dateTime | DateTime | |
Literal | http://www.opengis.net/ont/geosparql#wktLiteral | Coordinate | |
Literal | http://www.w3.org/2001/XMLSchema#double
http://www.w3.org/2001/XMLSchema#float http://www.w3.org/2001/XMLSchema#decimal http://www.w3.org/2001/XMLSchema#integer http://www.w3.org/2001/XMLSchema#long http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#short http://www.w3.org/2001/XMLSchema#nonNegativeInteger http://www.w3.org/2001/XMLSchema#positiveInteger http://www.w3.org/2001/XMLSchema#unsignedLong http://www.w3.org/2001/XMLSchema#unsignedInt http://www.w3.org/2001/XMLSchema#unsignedShort http://www.w3.org/2001/XMLSchema#nonPositiveInteger http://www.w3.org/2001/XMLSchema#negativeInteger |
Число | |
Literal | Has no RDF Data Type | Метка | |
Literal | Имеет свойство xml:lang |
Метка | |
Literal | String matches /^[0-9A-F]{6}$/ |
Color |
Форматирование
Для следующих типов данных есть специальное форматирование:
Тип данных | Формат |
---|---|
Entity | Ссылка на Wikidata.org
Label is shortened to wd:Qxx Explore an item (magnify icon) |
DateTime | MM DD, YYYY
Tooltip shows raw ISO timestamp |
Commons Media | Ссылка на Commons.Wikimedia.org
Displaying Gallery ( image icon ) |
Mobile / Responsive
Result views are made to work on different devices and resolutions. Their appearance may change depending on the space they can use.
Embed Mode
Result views can be linked or embedded via iframes. You can get the regarding link or code by clicking Link in the above menu.
See the difference: link to a query и link to a result or the embed code:
<iframe style="width:80vw; height:50vh;" scrolling="yes" frameborder="0" src="http://tinyurl.com/zwf4k2w">
Скачать результаты

There are several ways to export the results of a query.
JSON, TSV and CSV are three different open-standard formats to download the data, offered under the Download tab. To get results in XML format, click on Link > SPARQL endpoint.
You can also download some of the graphic views as a SVG file: this feature works with all the views except table, image grid, timeline, graph builder, map, and graph.
Вид по умолчанию
The default view can be change for each SPARQL query by using a comment:
#defaultView:[NAME]
For example:
#defaultView:ImageGrid
Result view options
Result views can be configured with various options, which are specified in JSON (Q2063) format,
either following the defaultView
comment (see previous section)
or following a separate view
comment.
#defaultView:Map{"layer": "?typeLabel"}
#view:ImageGrid{"hide": "?coords"}
Title
Result views can show a title. The title can be set via a title
comment.
#title:A title of your choice
Auto language
When using the magic keyword [AUTO_LANGUAGE]
it is replaced by the users language when submitting the query. This allows writing a query with where the result is display in the users language.
Пример:
#<span lang="en" dir="ltr" class="mw-content-ltr">Use language of the user for display labels and fallback to english as default</span>
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
}
Auto coordinates
When using the magic keyword [AUTO_COORDINATES]
it is replaced by the users location when submitting the query. This allows writing a query with the users' location.
Пример:
SERVICE wikibase:around {
?place wdt:P625 ?coordinate_location.
bd:serviceParam wikibase:center "[AUTO_COORDINATES]".
bd:serviceParam wikibase:radius "1".
bd:serviceParam wikibase:distance ?dist.
}