Semantic search

Simplified example to explain the difference between condition and printout result

Semantic MediaWiki includes an easy-to-use query language which enables users to access the wiki's knowledge. The syntax of this query language is similar to the syntax of annotations in Semantic MediaWiki. This query language can be used on the special page Special page "Ask", in concepts, and in inline queries. This page provides a short introduction to semantic search in general. More detailed explanations are found on other pages of this manual:

  • Selecting pages: explains the basic way to describe what pages should appear in a query result. This is the core of SMW's query language.
  • Displaying information: introduces the printout statements as a way of showing additional information for the queried pages, such as their property values or category assignments.
  • Result formats: describes the available formats and shapes for the results as a whole.
  • Concepts: shows how queries can be saved in concepts, which are a kind of «dynamic categories» offered by SMW.
  • Inline queries: explains ways of including query results into wiki pages, and shows how to format the query results for display. This is the purpose of the SMW parser functions #ask and #show.
  • Inferencing: explains how one can specify general schematic knowledge in SMW (and what this is in the first place). This feature is used by SMW to smartly deduce facts that were not directly entered into the wiki.

Naturally, answering queries requires additional resources, and the administrators of some sites can decide to switch off or restrict query features in order to ensure that even high-traffic sites can handle the additional load.


Semantic queries specify two things:

  1. Which pages to select
  2. What information to display about those pages

All queries must state some conditions that describe what is asked for. You can select pages by name, namespace, category, and most importantly by property values. For example, the query

[[Located in::Germany]]

is a query for all pages with the "Located in" property with a value of "Germany". If you enter this in Special page "Ask" and click "Find results", SMW executes the query and displays results as a simple table of all matching page titles. If there are many results, they can be browsed via the navigation links at the top and bottom of the query results, for example a query for all persons on

The second point is important to display more information. In the example above, one might be interested in the population of the things located in Germany. To display that on Special page "Ask", one just enters the following into the printout box on the right:


and SMW displays the same page titles and the values of the Population property on those pages, if any. Printout statements may have some additional settings to further control how the property is displayed.