2025-03-21 14:14:03 +03:00
|
|
|
|
declare default element namespace "http://www.tei-c.org/ns/1.0";
|
|
|
|
|
declare namespace tei = "http://www.tei-c.org/ns/1.0";
|
|
|
|
|
declare namespace abv = "http://ossetic-studies.org/ns/abaevdict";
|
|
|
|
|
|
2025-03-22 00:08:52 +03:00
|
|
|
|
import module namespace abv-m = 'http://ossetic-studies.org/ns/abaevdict-mod' at './abv-mod.xqm';
|
|
|
|
|
|
2025-03-21 14:14:03 +03:00
|
|
|
|
declare function local:genLookupEntry($doc as document-node())
|
|
|
|
|
as element()?
|
|
|
|
|
{
|
|
|
|
|
let $node := $doc/tei:TEI/tei:text/tei:body/tei:entry
|
2025-03-22 00:08:52 +03:00
|
|
|
|
let $phon := normalize-space(data($node/tei:form[1]/tei:orth[1]))
|
2025-03-21 14:14:03 +03:00
|
|
|
|
|
|
|
|
|
return element entry {
|
|
|
|
|
attribute xml:id { $node/@xml:id },
|
|
|
|
|
attribute filename { db:path($doc) },
|
|
|
|
|
if ($node/@n) then attribute n {$node/@n} else (),
|
|
|
|
|
text { $phon }
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-22 00:08:52 +03:00
|
|
|
|
let $entries := for $doc in collection('abaevdict')
|
|
|
|
|
return local:genLookupEntry($doc)
|
|
|
|
|
|
|
|
|
|
let $subentries := for $doc in collection('abaevdict')
|
|
|
|
|
for $re in $doc//re
|
|
|
|
|
let $etext := normalize-space(data($re/form[1]/orth[1]))
|
|
|
|
|
where $etext != '' and not($etext = $entries/text())
|
|
|
|
|
and not(starts-with($etext,','))
|
|
|
|
|
and string-to-codepoints($etext)[1] != string-to-codepoints(' ')
|
|
|
|
|
return <re corresp="{$doc/tei:TEI/tei:text/tei:body/tei:entry/@xml:id}">{$etext}</re>
|
|
|
|
|
|
2025-03-21 14:14:03 +03:00
|
|
|
|
let $tbl := <table>
|
2025-03-22 00:08:52 +03:00
|
|
|
|
{for $e in ($entries,$subentries)
|
|
|
|
|
order by abv-m:sortKey($e/text())
|
|
|
|
|
return $e}
|
2025-03-21 14:14:03 +03:00
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
return db:put('abaevdict_index', $tbl, 'lookup.xml')
|