Help:Semantic search

From HackerspaceWiki
Jump to: navigation, search

SMW user manual


Browsing interfaces

Semantic search

Selecting pages

Displaying information


Inline queries



Properties and types

Custom units

Semantic templates

Service links

Semantic Web

OWL/RDF export

External tools

Importing vocabulary

Ontology import

SMW admin manual

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: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:

  • Help: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.
  • Help:Displaying information: introduces printout statements as a way of showing additional information in queries, such as property values or category assignments.
  • Help:Concepts: shows how queries can be saved in concepts, which are a kind of «dynamic categories» offerend by SMW.
  • Help: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.
  • Help: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: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: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.

This documentation page applies to all SMW versions from 1.2 to the most current version.
Other versions: ≥ 1, 0.1, 1.3, 1.2,_≥ 1       Other languages: nl