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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Text Retrieval<br />

In <strong>Tamino</strong>, you can use the function tf:stem to retrieve occurrences of all word forms belonging<br />

to the same word stem. Similarly to tf:phonetic, it works only in the scope of one of the search<br />

functions:<br />

let $text :=<br />

<br />

Die Bank eröffnete drei neue Filialen im Verlauf der letzten fünf ↩<br />

Jahre.<br />

Ermüdet von dem Spaziergang setzte sich die alte Dame erleichtert auf die<br />

gepflegt wirkende Bank mitten im Stadtpark.<br />

Die aktuelle Bilanz der Bank zeigt einen Anstieg der liquiden Mittel im<br />

Vergleich zum Vorjahresquartal.<br />

<br />

for $a in $text//para<br />

let $check :=<br />

for $value in ("Geld", "Bilanz", "Filiale", "monetär", "Aktie")<br />

return tf:containsNearText($a, 10, tf:stem($value), tf:stem("Bank"))<br />

where count($check[. eq true()]) > 0<br />

return $a<br />

This returns all para elements whose text contains at least one word which is related to a specific<br />

reading of the German word "Bank". The resulting document contains the first and the third para<br />

element, but not the second, since it does not contain any of the words defined in the sequence<br />

("Geld", "Bilanz", "Filiale", "monetär", "Aktie") in a distance of less than ten words from<br />

"Bank".<br />

<strong>Tamino</strong> uses a set of rules to determine whether a word token belongs to some stem. There is a<br />

pre-defined rule set that works reasonably well for German. However, you can create your own<br />

set of rules. See the section Rules for Searches Using Phonetic Values and Stemming below. You<br />

can reach the pre-defined rules set using the following query:<br />

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

collection("ino:vocabulary")/ino:stemrules<br />

Note: Do not use tf:stem standalone; use it only in the context of one of the following<br />

functions: tf:containsText, tf:containsAdjacentText, tf:containsNearText,<br />

tf:createAdjacentTextReference, tf:createNearTextReference,<br />

tf:createTextReference. The result of calling this function in any other context is unspecified<br />

and might change in a future <strong>Tamino</strong> version.<br />

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

93

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

Saved successfully!

Ooh no, something went wrong!