Help:Debug format

Jump to: navigation, search
Debug format
Debugging information for analysing problems in query answering.
Further Information
Provided by: Semantic MediaWiki
Added: 0.7
Removed: still supported
Requirements: none
Format name: debug
Enabled by default: 
Indicates whether the result format is enabled by default upon installation of the respective extension.
Authors: Markus Krötzsch
Categories: misc
Table of Contents

The result format debug is used to obtain background information on how Semantic MediaWiki has processed a query. This information helps to understand why a query might return unexpected results, and it is vital for developers to fix bugs in query answering.


There are no inline query parameters specific to the debug format.

Parameter Type Default Description
sep text empty The separator for values
template text empty The name of a template with which to display the printouts
template arguments text empty Sets how the named arguments are passed to the template
named args yes/no no Name the arguments passed to the template
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
import-annotation yes/no no Additional annotated data are to be copied during the parsing of a subject


{{#ask: [[Category:City]] [[located in::Germany]] 
| ?population
| ?area#km² = Size in km²
| format=debug

This produces the following output:

SQLStore debug output
ASK Query
[[Category:City]] [[Located in::Germany]]
SQL Query
  t0.smw_id AS id,
  t0.smw_title AS t,
  t0.smw_namespace AS ns,
  t0.smw_iw AS iw,
  t0.smw_subobject AS so,
  t0.smw_sortkey AS sortkey, t0.smw_sortkey
  `smw_object_ids` AS t0
  `smw_fpt_inst` AS t2 ON t0.smw_id=t2.s_id
  `t3` AS t3 ON
  `smw_di_wikipage` AS t4 ON t2.s_id=t4.s_id
  `t5` AS t5 ON
  AND t0.smw_iw!=':smw'
  AND t0.smw_iw!=':smw-delete'
  AND t0.smw_iw!=':smw-redi'
  t0.smw_sortkey ASC
SQL Explain
1SIMPLEt5ALLPRIMARY2Using temporary; Using filesort
1SIMPLEt0eq_refPRIMARY,smw_id,smw_iwPRIMARY4DB0231020151216.t4.s_id1Using where
1SIMPLEt2refs_id,o_ids_id4DB0231020151216.t4.s_id2Using where; Distinct
Auxilliary Tables
  • Temporary table t3
      Recursively computed hierarchy for element(s) ('490').
  • Temporary table t5
      Recursively computed hierarchy for element(s) ('86').
Query Metrics
Errors and Warnings

How to read the debug output

The debug output contains some information that is only useful to developers, but it also gives some information that can be instructive to editors in a wiki for debugging a query.

The more readable parts are shown on top. This is usually a version of the wiki query as understood by SMW. The displayed query might be different from the user input. This may be due to SMW simply expressing some queries in different ways (different style of writing) but it may also show that some parts of the query were not understood or were wrongly understood by SMW.

Some statistical information on query size and query depth, and the encountered error messages are also shown. The size and depth are internal parameters used by SMW to limit the complexity of queries. The administrator of a wiki site may restrict queries to some maximal query size or depth (this will then be shown as an error if problematic), and this output may help to understand how size and depth work with certain queries.

The rest of the debug output is usually related to the internal storage functions executed by SMW to answer the query. This part also depends on the particular storage implementation and version of SMW, and usually developers will be the only ones to have any use for this.


The details of the debug output depend on the version of SMW and the storage engine used. This information should be included into debug reports.

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

Help:Debug format en 0.7