25.12.2013 Views

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Text Retrieval<br />

declare namespace ino="http://namespaces.softwareag.com/tamino/response2"<br />

for $p in collection("ino:vocabulary")/ino:term<br />

where tf:containsText($p/ino:termName,tf:broaderTerms("dog"))<br />

return $p/ino:termName<br />

Here, the two ino:termName instances for dog and carnivore are returned.<br />

Pattern Matching<br />

You can conveniently perform text searches with the help of search patterns. <strong>Tamino</strong>'s text retrieval<br />

system allows for efficient queries using special characters that match one or more characters in<br />

a word. In <strong>Tamino</strong> <strong>XQuery</strong> the following functions support text search using pattern matching:<br />

tf:containsText<br />

tf:containsAdjacentText<br />

tf:containsNearText<br />

tf:createTextReference<br />

tf:createAdjacentTextReference<br />

tf:createNearTextReference<br />

The tokenizer that is being used determines the pattern matching facilities that are available. The<br />

following table gives an overview of the characters that have a special meaning when used in one<br />

of the above functions:<br />

Character<br />

Tokenizer Availability<br />

Effect<br />

? (maskcard)<br />

white space-separated match a single character in a word<br />

* (wildcard) CJK<br />

white space-separated<br />

match zero or more characters in a word<br />

\ (escapecard) white space-separated cancel the special meaning of the following character<br />

The default tokenizer ("white space-separated") supports all types of special characters, whereas<br />

the Japanese tokenizer only supports wildcard characters. The section Wildcard Characters<br />

provides details about the peculiarities when using the Japanese tokenizer.<br />

The table above shows the default settings. However, with the white space-separated tokenizer<br />

you can use a different character for each of these special characters. If, for example, your data<br />

frequently uses the asterisk sign as a regular character, it is more convenient to redefine the<br />

wildcard character instead of having to escape the asterisks using the escapecard character every<br />

time they occur. See the section Customizing Special Character Settings for information on how<br />

to change these settings. The discussion here assumes the default settings as defined in<br />

ino:transliteration and, if not stated otherwise, the usage of the standard white space-separated<br />

tokenizer.<br />

98<br />

<strong>XQuery</strong> <strong>User</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!