The semantic search page, which can be found at special page "Ask"Provides an interface that assists users with creating and executing semantic queries is a special page providing an interface that assists users with creating and executing semantic queries.
Contents
Query construction[edit]
On the top of the page there are two text area fields. The first one, titled 'Query', is meant for the portion of the query for selecting pages. The second one, titled 'Additional data to display', is meant to hold the set of properties that are displayed for each queried page - see the help page on displaying information. Each property should be prepended with a question mark, just as is done in regular #ask queries.
As of Semantic MediaWiki 1.5.2Released on 30 August 2010 and compatible with MW 1.14.x - 1.17.x. this field has autocompletion on property names, meaning that you can start typing the beginning of a property name, and a set of completions will show up. You can also just type a question mark, and you will see the list of all properties defined on the wiki at once.
Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. introduced an input assistance in the query conditions field, meaning that you can prompt for suggestions.1 Depending on the suggestion prefix chosen you can trigger suggestions for:
- prefix
p:
for properties - prefix
c:
for categories, and - prefix
con:
for concepts.
Query parameters[edit]
As of Semantic MediaWiki 1.5.0Released on 7 March 2010 and compatible with MW 1.14.x - 1.17.x., additional controls are shown under the text fields, which allow the user to pass parameters to the query that give extra control over how the data is displayed. The controls shown change according to the result format selected, as different formats support different parameters.
Running the query[edit]
You can run the query by hitting the 'find results' button in the lower left corner of the page, after which the results will be shown.
Downloading the results[edit]
Semantic MediaWiki 2.4.0Released on 9 July 2016 and compatible with MW 1.19.0 - 1.27.x. introduced quick download links shown above the queried results to the right allowing to download them immediately in JSON, CSV, RSS and RDF.2 See the screenshot on this page.
Customizing[edit]
Starting with Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1). and Semantic MediaWiki 1.9.1Released on 9 February 2014 and compatible with MW 1.19.0 - 1.22.x. respectively 3 options for further customization were introduced:
- CSS classes
.smw-ask-parameter-description
can be used to change the parameter text display behaviour, e.g. font-size etc. (since Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).).smw-ask-query
can be used to change the query interface containing the following "sub-classes": (since Semantic MediaWiki 1.9.1Released on 9 February 2014 and compatible with MW 1.19.0 - 1.22.x.).smw-ask-query-condition
can be used to change the input field "Query" for entering query conditions (since Semantic MediaWiki 1.9.1Released on 9 February 2014 and compatible with MW 1.19.0 - 1.22.x.).smw-ask-query-printout
can be used to change the input field "Additional data to display" for entering the query printouts (since Semantic MediaWiki 1.9.1Released on 9 February 2014 and compatible with MW 1.19.0 - 1.22.x.).smw-ask-query-format
can be used to change the query interface containing the following "sub-class": (since Semantic MediaWiki 1.9.1Released on 9 February 2014 and compatible with MW 1.19.0 - 1.22.x.).smw-ask-query-format-selector
can be used to change the appearance of the drop-down menue used for selecting the result format (since Semantic MediaWiki 1.9.1Released on 9 February 2014 and compatible with MW 1.19.0 - 1.22.x.)
- A setting to allow toggling between the standard parameter text or a compact info tooltip based display (since Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).) - A setting to enable the option box to be collapsed by default (since Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).)
Notes[edit]
- Configuration parameter
$smwgLinksInValues
Sets whether internal links in values for properties of datatype "Text" may be stored within property values set to "true
" (SMW < 2.5) or "SMW_LINV_PCRE
" (SMW ≥ 2.5)
Results of a query displayed on this special page are not parsed further. This means that results for properties of datatype "Text"Holds text of arbitrary length containing links will be displayed as-is, i.e. links like SMW Project within the data value will be displayed as [[Help:SMW Project|SMW Project]]
even if this configuration parameter is enabled.
- Note: Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x. and later offers the "
SMW_LINV_OBFU
" option (recommended setting) for best experience with links in values.
- Property lookup cache
Since Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x. the search form with autocompletion for the printout statements, i.e. the field labeled "Additional data to be displayed" is using the lookup cache for properties due to performance considerations. This is governed by the configuration parameter $smwgCacheUsage
Sets how the caching behaviour or special pages related to Semantic MediaWiki is controlled.
See also[edit]
- Help page on browsing interfaces - introduces all simple browsing interfaces of Semantic MediaWiki, including the factbox
- Help page on semantic search - covers advanced semantic queries, as are also used for inline queries
- Help page on input assistance
References
- ^ | Semantic MediaWiki: GitHub pull request gh:smw:2699
- ^ | | | Semantic MediaWiki: GitHub pull request gh:smw:1407
- ^ | | | Semantic MediaWiki: GitHub pull request gh:smw:180