Help:Debug format

From semantic-mediawiki.org
Jump to: navigation, search
Debug format
Debugging information for analysing problems in query answering.
Available languages
deenzh-hans
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.
yes
Authors: Markus Krötzsch
Categories: misc
Group:
Table of Contents

↓ INFO ↓

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

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

Parameter Type Default Description
sep text , The separator for values
template text empty The name of a template with which to display the printouts
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 <smw-paramdesc-import-annotation>

Example

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

This produces the following output:

Debug Output by SQLStore

Ask query

[[Category:City]] [[Located in::Germany]]

SQL Query

SELECT DISTINCT
  t6.smw_id AS id,t6.smw_title AS t,t6.smw_namespace AS ns,t6.smw_iw AS iw,t6.smw_subobject AS so,t6.smw_sortkey AS sortkey
FROM
  `smw_object_ids` AS t6
INNER JOIN
  `smw_fpt_inst` AS t1 ON t6.smw_id=t1.s_id
INNER JOIN
  `t2` AS t2 ON t1.o_id=t2.id
INNER JOIN
  `smw_di_wikipage` AS t3 ON t1.s_id=t3.s_id
INNER JOIN
  `t4` AS t4 ON t3.p_id=t4.id
WHERE
  ((t3.o_id='779')) AND t6.smw_iw!=':smw' AND t6.smw_iw!=':smw-delete' AND t6.smw_iw!=':smw-redi'
ORDER BY
  t6.smw_sortkey ASC
LIMIT
  55
OFFSET
  0

SQL Explain

IDselect_typetabletypepossible_keyskeykey_lenrefrowsExtra
1SIMPLEt4ALLPRIMARY2Using temporary; Using filesort
1SIMPLEt3refs_id,p_id,o_idp_id9DB0231020151216.t4.id,const2
1SIMPLEt1refs_id,o_ids_id4DB0231020151216.t3.s_id1Using where
1SIMPLEt2eq_refPRIMARYPRIMARY4DB0231020151216.t1.o_id1
1SIMPLEt6eq_refPRIMARY,smw_id,smw_iwPRIMARY4DB0231020151216.t3.s_id1Using where

Auxilliary Tables Used

  • Temporary table t2
      Recursively computed hierarchy for element(s) ('490').
  • Temporary table t4
      Recursively computed hierarchy for element(s) ('86').

Query Metrics

Query-Size:3
Query-Depth:1

Errors and Warnings

None

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.

Remarks

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

Help:Debug format en 0.7