Pentru a putea vota, modifica pagini sau abona la modificările unei pagini trebuie să fiți autentificați. Cu această ocazie scăpați și de acest mesaj deranjant.

Ajutor:How can i find close matches?

De la
Salt la: navigare, căutare
Question:=How can i find close matches?
Description:=Use the tilde symbol in front of a property value.
Example query showing a use case for near matches in ASK-queries

A good example for a near match in ask queries is to overcome the language problem introduced by british english vocabulary vs. american english vocubalary such as color vs. colour! Therefore, the following ASK syntax can be used:


The number of '~' signs in the syntax denotes the number of 'typos' that are allowed and taken into account. Regarding the given example, all attribute values with distance of "1" to colour are considered as correct matching, positive results! That means, 'colour', 'Color', 'culor' and so on would deliver results.

The near matches are not only limited to mistyped string attributes but also useful regarding float numbers.

Inofficial support of units

Inofficially and not fully tested is the support for near matches using these units:


Regarding the 'date' unit, the number of '~' signs denotes the deviation in days That means a query such as

<ask>[[Category:Person]] [[*:=*]] [[wasBorn:~~~2007-05-11]]</ask>

would result in a list showing all attributes of all persons that were born between 2007-05-08 and 2007-05-14 (3 days deviation due to 3 '~' signs.

Regarding integer units, the number of '~' signs denotes the factor of a fixed tolerance of 5%.


This query would match all pages that contain the hasPopulation attribute with a value of at least 90000 or at most 110000 (10% deviation due to 2 '~' signs).

Admins please note (Installation instruction)

A new function calculating the editdistance needs to be added to the existing MySQL server. Therefore, a detailed installation instruction and the necessary file containing the needed method is available in the CVS: extensions/SemanticMediaWiki/libs/INSTALL.TXT