Help:Debug format

From semantic-mediawiki.org
Help:Debug formatDebug format/zh-hans
Debug format
Outputs debugging information for analyzing problems in query answering.
Further Information
Provided by: Semantic MediaWiki
Added: 0.7
Removed: still supported
Requirements: none
Format name: debug
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
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.

Parameters[edit]

There are no inline query parameters specific to the debug format. This result format does not provide format specific parameters.

Example[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?area#km²=Area
 |format=debug
}}
Result
Debug output SQLStore
ASK Query
[[Category:City]] [[Located in::Germany]]
SQL Query
SELECT DISTINCT
  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_sort
FROM
  `smw_object_ids` AS t0
INNER JOIN
  (`smw_fpt_inst` AS t2
INNER JOIN
  `t3` AS t3 ON t2.o_id=t3.id
INNER JOIN
  (`smw_di_wikipage` AS t4
INNER JOIN
  `t5` AS t5 ON t4.p_id=t5.id) ON t2.s_id=t4.s_id) ON t0.smw_id=t2.s_id
WHERE
  (
   (t4.o_id='779')
  )
  AND t0.smw_iw!=':smw'
  AND t0.smw_iw!=':smw-delete'
  AND t0.smw_iw!=':smw-redi'
ORDER BY
  t0.smw_sort ASC
LIMIT
  55
OFFSET
  0
SQL Explain
IDselect_typetabletypepossible_keyskeykey_lenrefrowsfilteredExtra
1SIMPLEt5ALLPRIMARY2Using temporary; Using filesort
1SIMPLEt4refs_id, o_id, p_id, s_id_2, s_id_3, o_id_2, o_id_3o_id_39const, DB9907220070920.t5.id1
1SIMPLEt2refs_id, o_id, s_id_2, o_id_2s_id_24DB9907220070920.t4.s_id1Using where; Using index
1SIMPLEt3eq_refPRIMARYPRIMARY4DB9907220070920.t2.o_id1
1SIMPLEt0eq_refPRIMARY, smw_id, smw_iw, smw_iw_2PRIMARY4DB9907220070920.t4.s_id1Using where
Auxilliary Tables
  • Temporary table t3
      Recursively computed hierarchy for element(s) ('148509').
      SELECT s_id FROM `smw_fpt_subc` WHERE o_id='148509' LIMIT 1
  • Temporary table t5
      Recursively computed hierarchy for element(s) ('148244').
      SELECT s_id FROM `smw_fpt_subp` WHERE o_id='148244' LIMIT 1
Query Metrics
Query-Size:3
Query-Depth:1
Errors and Warnings
None

How to read the debug output[edit]

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.

Remarks[edit]

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