source: MDRepository/trunk/xquery/cmd-stats.xql

Last change on this file was 827, checked in by vronk, 14 years ago

adding build (for tests) + basic version of the test-queries file;
minor but important correction in cmd-model.xqm

File size: 2.9 KB
Line 
1let $doc-name := xmldb:store("/db/cmdi-mirror", "stats.xml", <result></result>),
2$doc := doc($doc-name),
3$items := (
4<item key="C" label="CMD" >count(//CMD)</item>,
5<item key="C.0" label="CMD without " >count(//CMD[not(.//ResourceType='Resource')][not(.//ResourceType='Metadata')])</item>,
6<item key="C.R+M" label="CMD with MD and Res" >count((//CMD[.//ResourceType='Resource'][.//ResourceType='Metadata']))</item>,
7<item key="C.R" label="CMD with Resource" >count(//CMD[.//ResourceType='Resource'])</item>,
8<item key="C.R.0" label="CMD - with Resource empty">count(//CMD[.//ResourceType='Resource'][.//ResourceRef[. = ""]])</item>,
9<item key="C.R.1" label="CMD with relative Resource (starts-with('.'))" >count(//CMD[.//ResourceType='Resource'][starts-with(.//ResourceRef,'.')])</item>,
10<item key="C.R.2" label="CMD with http-uri Resource" >count(//CMD[.//ResourceType='Resource'][starts-with(.//ResourceRef,'http')])</item>,
11<item key="C.R.1+2" label="CMD - with relative and http Resource">count(//CMD[.//ResourceType='Resource'][starts-with(.//ResourceRef,'.')][starts-with(.//ResourceRef,'http')])</item>,
12<item key="C.R.3" label="CMD - Resource only filename (not empty, no '/')" >count(//CMD[.//ResourceProxy[ResourceType='Resource'][ResourceRef[not(. = "")][not(contains(.,'/'))]]])</item>,
13<item key="RP.R" label="ResourceProxy - Resource" >count(//ResourceProxy[ResourceType='Resource'])</item>,
14
15<item key="C.M" label="CMD with Metadata = Collections" >count(//CMD[.//ResourceType='Metadata'])</item>,
16<item key="C.M.1" label="CMD with relative MD" >count(//CMD[.//ResourceType='Metadata'][starts-with(.//ResourceRef,'.')])</item>,
17<item key="C.M.2" label="CMD with http-uri MD" >count(//CMD[.//ResourceType='Metadata'][starts-with(.//ResourceRef,'http')])</item>,
18
19<item key="RP.M" label="ResourceProxy - Metadata" >count(//ResourceProxy[ResourceType='Metadata'])</item>,
20
21<item key="C..3" label="CMD - only filename (not empty, no '/')" >count(//CMD[.//ResourceRef[not(. = "")][not(contains(.,'/'))]])</item>,
22<item key="RR.3" label="ResourceRef only filename (not empty, no '/')" >count(//ResourceRef[not(. = "")][not(contains(.,'/'))])</item>,
23<item key="C..RR.0" label="CMD - empty ResourceRef">count(//CMD[.//ResourceRef[. = ""]])</item>,
24<item key="RR.0 label="ResourceRef empty">count(//ResourceRef[. = ""])</item>,
25<item key="C..RR.0+1" label="CMD - empty and non-empty ResourceRef">count((//CMD[.//ResourceRef[. = ""]][.//ResourceRef[not(. = "")]]))</item>)
26return
27 for $item in $items
28 let $answer := util:eval($item/text())
29return update insert <item key="{$item/@key}" label="{$item/@label}">{$answer}</item> into $doc/result
30
31(: <item key="C.R.3" label="CMD - Resource not empty, not relative, not http">5100</item>         
32  <item label="CMD - Resource not relative, not http" >count(//CMD[.//ResourceType='Resource'][not(starts-with(.//ResourceRef,'.'))][not(starts-with(.//ResourceRef,'http'))])</item>,
33 :)
Note: See TracBrowser for help on using the repository browser.