Changeset 830 for MDRepository
- Timestamp:
- 11/02/10 12:06:47 (14 years ago)
- Location:
- MDRepository/trunk/xquery
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MDRepository/trunk/xquery/cmd-model.xqm
r827 r830 71 71 API function searchRetrieve. 72 72 :) 73 declare function cmd-model:search-retrieve($cql-query as xs:string, $collections as xs:string+, $format as xs:string, $start-item as xs:integer, $end-item as xs:integer) as item()* { 74 let $collection := collection($cmd-model:cmdiMirrorPath), 75 $decoded-query := xdb:decode($cql-query), 73 declare function cmd-model:search-retrieve($xpath-query as xs:string, $collections as xs:string+, $format as xs:string, $start-item as xs:integer, $end-item as xs:integer) as item()* { 74 let $start-time := fn:current-dateTime(), 75 $collection := collection($cmd-model:cmdiMirrorPath), 76 $decoded-query := xdb:decode($xpath-query), 76 77 $sanitized-query := cmd-model:sanitize-query($decoded-query), 77 78 $results := … … 84 85 $result-seq := fn:subsequence($results, $start-item, $end-item), 85 86 $seq-count := fn:count($result-seq), 87 $end-time := fn:current-dateTime(), 86 88 $result-fragment := 87 89 <searchRetrieveResponse> 88 90 <numberOfRecords>{$result-count}</numberOfRecords> 89 <echoedSearchRetrieveRequest>{if ($decoded-query ne $sanitized-query) then "Rewritten to descendant-or-self::CMD" else $cql-query, $collections, $start-item, $end-item}</echoedSearchRetrieveRequest> 90 <diagnostics>{$seq-count}</diagnostics> 91 <echoedSearchRetrieveRequest>{if ($decoded-query ne $sanitized-query) then "Rewritten to descendant-or-self::CMD" else $xpath-query, $collections, $start-item, $end-item}</echoedSearchRetrieveRequest> 92 <extraResponseData> 93 <returnedRecords>{$seq-count}</returnedRecords> 94 <duration>{$end-time - $start-time}</duration> 95 </extraResponseData> 91 96 <records> 92 97 {$result-seq} -
MDRepository/trunk/xquery/cmd-test.xml
r827 r830 31 31 import module namespace cmd-model = "http://spraakbanken.gu.se/clarin/xquery/model" 32 32 at "xmldb:exist:///db/clarin/cmd-model.xqm"; 33 cmd-model:query-model('Components', ' /db/cmdi-mirror', 'xml', 1)33 cmd-model:query-model('Components', 'root', 'xml', 1) 34 34 </xquery> 35 35 </sequence> … … 39 39 <group name="cmdi-tests-searchRetrieve"> 40 40 <thread name="thread1" connection="con"> 41 <sequence repeat="20" description="query imdi resources (no index)"> 42 <xquery collection="/db/cmdi-mirror" query=""></xquery> 41 <sequence repeat="20" description="actual queries on the mdrecords"> 42 <xquery collection="/db/cmdi-mirror" query=""> 43 import module namespace cmd-model = "http://spraakbanken.gu.se/clarin/xquery/model" 44 at "xmldb:exist:///db/clarin/cmd-model.xqm"; 45 cmd-model:search-retrieve("//title[contains(.,'a')]", 'root', 'xml', 1,10) 46 </xquery> 47 <xquery collection="/db/cmdi-mirror" query="//ft:query(*, <query><term>Language</term></query>)" /> 48 <xquery collection="/db/cmdi-mirror" query="ft:query(descendant::IsPartOf, <query><term>clarin-at:aac-test-corpus</term></query>)" /> 49 <xquery collection="/db/cmdi-mirror" query="//idno[.='4197']" /> 50 <xquery collection="/db/cmdi-mirror" query="//date[.>'1920']" /> 51 <xquery collection="/db/cmdi-mirror" query="//ResourceType[.='Metadata']" /> 52 <xquery collection="/db/cmdi-mirror" query="//sourceDesc/biblStruct/monogr/title[contains(.,'rat')]" /> 53 <xquery collection="/db/cmdi-mirror" query="//CMD/*[.//teiHeader//monogr/title[contains(.,'t')]][.//teiHeader//imprint/date[.>'1930']][.//teiHeader//imprint/date[.<'1935']]" /> 43 54 </sequence> 44 55 </thread>
Note: See TracChangeset
for help on using the changeset viewer.