Mercurial > hg > mpdl-group
comparison software/eXist/webapp/mpdl/lt/lex.xql @ 7:5589d865af7a
Erstellung XQL/XSL Applikation
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 08 Feb 2011 15:16:46 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:2396a569e446 | 7:5589d865af7a |
---|---|
1 xquery version "1.0"; | |
2 | |
3 import module namespace mpdl-time = "http://www.mpiwg-berlin.mpg.de/ns/mpdl/util/time" at "../util/time.xql"; | |
4 | |
5 declare namespace request="http://exist-db.org/xquery/request"; | |
6 | |
7 let $language := request:get-parameter("language", "") | |
8 let $formName := request:get-parameter("form", "") | |
9 let $luceneQuery := request:get-parameter("query", "") | |
10 | |
11 let $currentTimeBegin := util:system-time() | |
12 | |
13 let $lexica := | |
14 if ($formName != '') | |
15 then mpdltext:get-lex-entries-by-form-name($language, $formName) | |
16 else mpdltext:get-lex-entries-by-lucene-query($language, $luceneQuery) | |
17 let $htmlLexica := | |
18 if (empty($lexica)) | |
19 then ("no lexical entries found for your query") | |
20 else | |
21 for $lexicon in $lexica/lexica/lexicon | |
22 let $lexDescription := $lexicon/description | |
23 let $lexEntries := $lexicon/entries | |
24 let $liLexEntryContent := | |
25 for $lexEntry in $lexicon/entries/entry | |
26 let $lexEntryContent := $lexEntry/content | |
27 let $lexEntryXmlValid := $lexEntryContent/xml-valid | |
28 let $lexEntryOriginalContent := $lexEntryContent/original-entry | |
29 let $lexEntryRepairedContent := $lexEntryContent/repaired-entry | |
30 let $lexEntryContentParsed := | |
31 if ($lexEntryXmlValid = "true") | |
32 then util:parse($lexEntryRepairedContent) | |
33 else <bla><text>[<i>Remark: lexical entry in lexicon has no valid XML, so only the Betacode text version of the entry could be displayed</i>]</text><p></p>{$lexEntryOriginalContent}</bla> | |
34 return <li>{($lexEntryContentParsed)}</li> | |
35 let $lexiconLi := | |
36 <li><b>{$lexDescription}</b> | |
37 <ul>{$liLexEntryContent}</ul> | |
38 </li> | |
39 return $lexiconLi | |
40 | |
41 let $queryResultHeaderStr := | |
42 if ($formName != '') | |
43 then <h3>Mpdl-Pollux: Result of your query: Language={$language}, Form={$formName}</h3> | |
44 else <h3>Mpdl-Pollux: Result of your query: Language={$language}, Query={$luceneQuery}</h3> | |
45 | |
46 let $currentTimeEnd := util:system-time() | |
47 let $neededTime := mpdl-time:duration-as-ms($currentTimeEnd - $currentTimeBegin) | |
48 | |
49 let $retHtmlResult := | |
50 <html> | |
51 <head> | |
52 <title>Mpdl-Pollux</title> | |
53 </head> | |
54 <body> | |
55 {$queryResultHeaderStr} | |
56 <table align="right"> | |
57 <td align="right">[<i>This is a MPDL <a href="http://archimedes.fas.harvard.edu/pollux">Pollux</a> service</i>] <a href="../info.xql?info=pollux" onclick="window.open("../info.xql?info=pollux", "InfoWindow", "menubar=no,width=500,height=500,toolbar=no");return false"><img src="../images/info.png" valign="bottom" width="15" height="15" border="0" alt="MPDL Pollux service"/></a></td> | |
58 </table> | |
59 <text> </text> | |
60 <p/> | |
61 {$htmlLexica} | |
62 <hr/> | |
63 <p/> | |
64 Elapsed time: {$neededTime} ms, see the <a href="/exist/xquery.xml">XQuery documentation</a> and the <a href="lex.xql?_source=yes">XQuery source</a> of this page, if you find a bug <a href="https://itgroup.mpiwg-berlin.mpg.de:8080/tracs/mpdl-project-software/newticket">let us know</a> | |
65 </body> | |
66 </html> | |
67 | |
68 return $retHtmlResult |