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 />

perp<br />

whelp<br />

carnivore<br />

<br />

The example file dog.xml<br />

<br />

<br />

carnivore<br />

mammal<br />

<br />

The example file carnivore.xml<br />

These two files establish the thesaurus "animals" for the given database. In the vertical direction<br />

the following hierarchy can be derived: A dog is a carnivore; a carnivore is a mammal. This is because<br />

the ino:broaderTerm contents ("carnivore") in the thesaurus entry for "dog" matches the<br />

ino:termName of another thesaurus entry, namely "carnivore".<br />

Furthermore synonyms are defined for the entry "dog" that denote a dog using colloquial language,<br />

biological terms, pet names, etc.<br />

Examples<br />

Return all paragraphs in the specified document that contain a synonym of "dog":<br />

let $doc := <br />

Have you seen the large dog around the corner?<br />

On the farm nearby, a checkered whelp was playing on the ground with some ↩<br />

cats.<br />

Also, some horses could be seen in the stable.<br />

<br />

for $p in $doc/p<br />

where tf:containsText($p,tf:synonym("dog"))<br />

return $p<br />

As a result, the first two paragraphs are returned. Strictly speaking, only "whelp" is defined as a<br />

proper synonym, but <strong>Tamino</strong> follows the intuitive assumption that you also expect the term itself<br />

to be part of the result set. This holds for other thesaurus functions as well.<br />

The following query returns all superordinate terms of "dog", for which you use the <strong>Tamino</strong><br />

function tf:broaderTerms:<br />

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

97

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

Saved successfully!

Ooh no, something went wrong!