Help:Strict comparators

Jump to: navigation, search
SMW user manual
Properties and types
Special properties
Inverse properties
Custom units

Semantic templates

Service links

Browsing interfaces
Semantic search
Selecting pages
Strict comparators
Displaying information
Result formats
Inline queries
Querying for queries
Using the API
Semantic Web
RDF export

Importing vocabulary

SMW admin manual
Table of Contents

In Semantic MediaWiki (SMW), comparators < and > have the meaning "smaller or equal" and "greater or equal". Thus they behave slightly different than some people would expect, because of their inclusion of "... or equal". Perhaps you'd like the comparators to behave like their mathematical counterparts. Since Semantic MediaWiki 1.5.3 this is possible, but with some caveats.

Enabling strict comparators

To enable strict interpretation of comparators add the following line to your "LocalSettings.php" file:

$smwStrictComparators = true;

Comparison between standard and strict comparators

For the different range comparisons, the following comparators are usable, depending on the setting of $smwStrictComparators:

less than or equal <   or  
greater than or equal >   or  
less than << <   or   <<
greater than >> >   or   >>
Note that in SMW prior to 1.5.3 the behaviour of the comparators was a bit simpler
less than or equal <
greater than or equal >
less than
greater than

Caveats with strict comparators

There are two points of attention when switching to strict comparators:

  1. existing queries using < and > may yield different results (this does not hold for < combined with !)
  2. the symbols ≤ and ≥ cannot easily be inserted in a wiki with a standard keyboard. Users may need to
    1. copy & paste the symbols, or
    2. use additional software, like Windows' "Character Map" (Start > Programs > Accessories > System Tools > Character Map, then to font "Symbol"), or
    3. in US Windows English keyboard, you can do "Alt+242" to input ≥ and "Alt+243" for ≤.

This documentation page applies to all SMW versions from 1.5.3 to the most current version.
      Other languages: frruzh-hans

Help:Strict comparators en 1.5.3