Help:Remote request

From semantic-mediawiki.org
(Redirected from Help:Remote request)
Remote request
Describes how to consolidate query results from remote sources
Keywords
Table of Contents

The remote request is a feature that was introduced with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. to make it easy to share and consolidate query results from remote sources.1

Remote source[edit]

The feature requires configuration parameter $smwgQuerySourcesSets a list of sources, i.e. query back-ends that can return query results to be configured. The following entry schema for targets to be selectable as remote sources must be followed:

$smwgQuerySources = [
	'exampleorg' => [
		'\SMW\Query\RemoteRequest',
		'url' => 'https://example.org/w/index.php',
		'cache' => 3600
	]
];
  • The source name can be an arbitrary string. Above example identifies exampleorg as the source.
  • The url parameter to the remote destination.
  • The cache parameter indicating the "time to live" in seconds ensures that requests to a remote destination are cached and avoid creating unnecessary requests to the source for the specified duration. In the above example it is set to 1 hour (60 x 60 = 3600 seconds).
  • This configuration parameter can be used to define multiple remote sources.
For best results the website configured needs run Semantic MediaWiki however it is also possible to configure a website not using Semantic MediaWiki but providing results in a compatible format.2

Remote request[edit]

Once a list of sources is available, embedded queries as well as queries executed via special page "Ask"Provides an interface that assists users with creating and executing semantic queries will have access to the source parameter and can request a remote execution. For example:

{{#ask:
 [[Has number::+]]
 |?Has number
 |format=table
 |limit=20
 |source=exampleorg
}}
  • Queries fetched from a remote source will inform the user about the context of the execution and is controlled by option SMW_REMOTE_REQ_SHOW_NOTE to configuration parameter $smwgRemoteReqFeaturesSets the behaviour of the features provided for remote requests.
  • Paging of results is not supported but using the @deferred query marker and the @control query marker can enable (if supported by the format to change the limit/offset parameters dynamically after results have been retrieved from a source without the need to alter the query manually.
  • In cases where a remote source does not support a selected format, the default result format "broadtable"Outputs the results in a broad table. is used instead.

Remote response[edit]

By default any public wiki using Semantic MediaWiki is able to respond to a remote request which can be disabled, if necessary. It should be noted that disabling has only an administrative blocking effect with any public wiki allowing access to the special page "Ask"Provides an interface that assists users with creating and executing semantic queries despite being disabled for a remote request.

Removing option MW_REMOTE_REQ_SEND_RESPONSE from configuration parameter $smwgRemoteReqFeaturesSets the behaviour of the features provided for remote requests will block remote requests.

Note[edit]

The remote request feature provided by extension "Semantic MediaWiki"Allows to store and query data annotated to pages uses direct raw access to special page "Ask"Provides an interface that assists users with creating and executing semantic queries while the extension "Semantic External Query Lookup"Allows to seamlessly integrate query results from an external query source to a local repository or wiki uses the API modules.2

See also[edit]

Configuration parameters
Implementations


References

  1. ^  |  Semantic MediaWiki: GitHub pull request gh:smw:3167
  2. a b  Semantic MediaWiki: GitHub issue comment gh:smw:3167:451687962
  3. ^  Semantic MediaWiki: GitHub issue gh:smw:3168