$smwgSparqlQFeatures

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgSparqlQFeatures
Description Sets the SPARQL query features that are expected to be supported by the repository of the identifier (graph) of the SPARQL database
Default setting See below
Software Semantic MediaWiki
Since version
Until version still available
Configuration Store settings
Keyword sparqlstore · store · rdf · sparql · query features · query performance


$smwgSparqlQFeatures is a configuration parameter that is used to define the SPARQL query features that are expected to be supported by the repository of the identifier (graph) of the SPARQL database. The configuration parameter was introduced in Semantic MediaWiki 2.3.0Released on 29 October 2015 and compatible with MW 1.19.0 - 1.25.x..1 Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. introduced the SMW_SPARQL_QF_COLLATION constant as configurable setting.2

Starting with Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. this parameter accepts an array of plain string keys instead of the SMW_SPARQL_QF_* constants. The constant form still works but is deprecated and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki..3

Default setting[edit]

$smwgSparqlQFeatures = [ 'redirects', 'subproperties', 'subcategories' ];

The default setting means that the SPARQL database supports finding redirects using inverse property paths as well as resolving subproperties and subcategories.

Available options[edit]

The options enabled by default are highlighted bold.
  • 'redirects' (formerly SMW_SPARQL_QF_REDI) − Sets that the SPARQL database supports finding redirects using inverse property paths (can only be used for repositories with full SPARQL 1.1 support (e.g. Fuseki or Sesame Current: May 2015)
  • 'subproperties' (formerly SMW_SPARQL_QF_SUBP) − Sets that the SPARQL database supports resolving subproperties
  • 'subcategories' (formerly SMW_SPARQL_QF_SUBC) − Sets that the SPARQL database supports resolving resolve subcategories
  • 'collation' (formerly SMW_SPARQL_QF_COLLATION) − Sets that the SPARQL database supports the sorting collation as maintained in configuration parameter $smwgEntityCollationSets which collation entities in Semantic MediaWiki should sort with. It is not enabled by default as the uca-<langcode>-* collation generates a UTF-8 string that contains unrecognized UTF codepoints that may not be understood by the back-end hence the collator prevents and armors those unrecognized characters by replacing them with a ? to avoid a cURL communication failure. Of course this means that not all elements of the sort string can be transfered to the back-end and can therefore cause a sorting distortion for close matches as in case of for example "Ennis, Ennis Hill, Ennis Jones, Ennis-Hill, Ennis-London".
  • 'no-case' (formerly SMW_SPARQL_QF_NOCASE) − Sets that the SPARQL database supports case-insensitive pattern matches.

Changing the default setting[edit]

To modify the setting to this configuration parameter, add one of the following lines to your "LocalSettings.php" file:

Cater for repository providers that do not fully support SPARQL 1.1
$smwgSparqlQFeatures = [];

This means that a repository provider may be used that does not fully support SPARQL 1.1.

Disable the finding of redirects using inverse property paths
$smwgSparqlQFeatures = [ 'subproperties', 'subcategories' ];
Enable the sorting collation as maintained configuration parameter $smwgEntityCollationSets which collation entities in Semantic MediaWiki should sort with
$smwgSparqlQFeatures = [ 'redirects', 'subproperties', 'subcategories', 'collation' ];
Maintenance script "updateEntityCollation.php"Allows mass updates of database field "smw_sort" on the occasion that setting for the entity collation was changed has to be run after adding this option to the stetting of this configuration parameter.

Legacy constant form (deprecated since 7.0.0)[edit]

The constant form below is deprecated since Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki.. Use the string-array form shown above instead. It is documented here for wikis still running the constant form. SMW_SPARQL_QF_NONE corresponds to an empty array.

The default expressed with constants:

$smwgSparqlQFeatures = SMW_SPARQL_QF_REDI | SMW_SPARQL_QF_SUBP | SMW_SPARQL_QF_SUBC;

A specific feature can be removed with a bit-operation, e.g.:

$smwgSparqlQFeatures = ( $smwgSparqlQFeatures & ~SMW_SPARQL_QF_REDI );
NoteNote: Please use parentheses4 when combining different bit-operations to avoid a possible mismatch.

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub issue gh:smw:467
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:2429
  3. ^  | | | | | | | | |  Semantic MediaWiki: GitHub pull request gh:smw:6793
  4. ^  Bitwise Operators to use parentheses to ensure the desired precedence ...