Semantic Compound Queries

Revision as of 15:55, 8 December 2017 by Lsireta (talk | contribs)


The Semantic Compound Queries extension is meant to work with Semantic MediaWiki and allows for the display of more than one SMW inline query in one results display set. It uses its own parser function, #compound_query, which takes inputs similar to that of #ask but can take in an unlimited number of queries, instead of just one.


Usage[<a href="https://www.mediawiki.org/w/index.php?title=Extension:Semantic_Compound_Queries&action=edit&section=2" title="Edit section: Usage">edit source]

A normal inline query, using the #ask parser function, takes in arguments of three types: (1) a filter that determines the results, (2) the names of properties to be displayed, and (3) arguments that determine the format and other aspects of the display. Here is an example of a normal inline query:

{{#ask:[[Category:Stores]][[Has type::Clothing]]|?Has country=Country|format=table}}

In this query there are three arguments separated by pipes and they belong to argument types 1, 2 and 3, respectively.

For compound queries the first two types of argument are unique to each sub-query and are separated from each other by semicolons instead of pipes; pipes are used to separate one sub-query from the rest. The third type of argument, setting the display of the results, is common across all sub-queries. Here is an example of a call to #compound_query that shows both clothing stores and fast-food restaurants in a table:

{{#compound_query:[[Category:Stores]][[Has type::Clothing]];?Has country=Country |[[Category:Restaurants]][[Has cuisine::Fast food]];?Has country=Country |format=table}}

One important exception to this rule is the limit= parameter, which sets the maximum number of results displayed: it must be used per sub-query, not for the overall compound query.


Source: mediawiki

Attachments

Discussions