Querying for queries

From semantic-mediawiki.org
Jump to: navigation, search

This help page describes how to query for information about inline queries. This is possible since Semantic MediaWiki 1.8.0 which introduced a mechanism to the parser functions #ask, #show followed by #concept1 in Semantic MediaWiki 2.5.0 that automatically stores information for the page they are used on as a subobject. This information includes the depth, the format, the size and the string of the respective query. Starting with with Semantic MediaWiki 1.9.0 the duration2 was added and Semantic MediaWiki 2.5.0 brought information about it's parameters3.

This data can be queried as usual, e.g., to find out how many queries on the wiki use a particular format, or what are the largest queries.

Examples

The total number of queries
{{#ask:
[[Query size::+]]
|format=count
}}

Result: 8387


The total number of pages containing queries
{{#ask:
[[Has query::+]]
|format=count
}}

Result: 2514


The number of queries that use the format "count"
{{#ask:
[[Query format::count]]
|format=count
}}

Result: 2334


The number of pages that use queries that use the format "list"
{{#ask:
[[Has query.Query format::list]]
|format=count
}}

Result: 1609


Pages that have a query with format "ul" and one with format "table"
{{#ask:
[[Has query.Query format::ul]]
[[Has query.Query format::table]]
|format=ul
|limit=10
}}

Result:


The 10 largest queries used on the wiki with their size and duration
{{#ask:
[[Has query::+]]
|?Query size
|?Query duration
|sort=Query duration
|order=desc
|limit=10
}}

Result:

Querying for the query duration is not enabled for this wiki.


The 10 largest queries used on the wiki with their size and query string
{{#ask:
[[Query string::+]]
|?Query size
|?Query string
|sort=Query size
|order=desc
|limit=10
}}

Result:

 Query size
"Query size" is a predefined property that collects the number of conditions used in a query and is provided by Semantic MediaWiki.
Query string
"Query string" is a predefined property that describes the conditions of the query as a string and is provided by Semantic MediaWiki.
Semantic MediaWiki Version History/zh-hans12
<q>[[Category:SMW releases/zh-hans]] [[Language code::zh-Hans]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::zh-Hans]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Semantic MediaWiki Version History/zh-hans12
<q>[[Category:SMW releases/zh-hans]] [[Language code::zh-Hans]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::zh-Hans]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Βοήθεια:Ιστορικό εκδόσεων Σημασιολογικού MediaWiki12
<q>[[Category:SMW releases/el]] [[Language code::el]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::el]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Βοήθεια:Ιστορικό εκδόσεων Σημασιολογικού MediaWiki12
<q>[[Category:SMW releases/el]] [[Language code::el]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::el]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Category:Versions SMW12
<q>[[Category:SMW releases/fr]] [[Language code::fr]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::fr]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Help:Historique des versions de Semantic MediaWiki12
<q>[[Category:SMW releases/fr]] [[Language code::fr]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::fr]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Help:Historique des versions de Semantic MediaWiki12
<q>[[Category:SMW releases/fr]] [[Language code::fr]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::fr]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Help:Versionsgeschichte von Semantic MediaWiki12
<q>[[Category:SMW releases/de]] [[Language code::de]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::de]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
Help:Versionsgeschichte von Semantic MediaWiki12
<q>[[Category:SMW releases/de]] [[Language code::de]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::de]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
SMW releases/es12
<q>[[Category:SMW releases/es]] [[Language code::es]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]] OR [[Category:SMW releases]] [[Language code::es]] [[Has release date::+]] [[Version::!Semantic MediaWiki 1.6.2]]</q>
... further results


This documentation page applies to all SMW versions from 1.9.0 to the most current version.
     

Help:Querying for queries en 1.9.0


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:1719
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:30
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:2270