Created
March 5, 2015 11:54
-
-
Save ableasdale/8878025d998df9641db6 to your computer and use it in GitHub Desktop.
Limits, Sizes and Ratios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare namespace admin = "http://marklogic.com/xdmp/admin"; | |
declare variable $strings := ( "size", "ratio", "threshold", "max", "min", "limit", "rate", "throttle" ); | |
declare variable $dir-base as xs:string := "C:\Program Files\MarkLogic\Config\"; | |
declare function local:display($it as item()*) { | |
( | |
" ******************* ", | |
if( exists($it/@name)) then (concat("Name: ", $it/@name )) else (), | |
if( exists($it//xs:documentation/text()) ) then(concat("Documentation: ", normalize-space(string-join($it//xs:documentation/text(), ''))) (: replace(replace($it//xs:documentation/text(),'\s+$',''),'^\s+','') :) ) else (), (: concat("Documentation: ", :) | |
if( exists($it//xs:appinfo/admin:help/text()) ) then (concat("Help text: ",normalize-space(fn:string($it//xs:appinfo/admin:help)))) else (), | |
(: then concat("Help text: ", normalize-space(string-join($it//xs:appinfo/admin:help/text(),''))) else (), :) | |
if( exists($it//xs:appinfo/admin:default/text()) ) then (concat("Default: ", $it//xs:appinfo/admin:default/text())) else (), | |
if( exists($it/xs:restriction/@base) ) then ( concat("Restriction base: ", $it/xs:restriction/@base ) ) else (), | |
if( exists($it/xs:restriction/xs:minInclusive/@value)) then (concat("Min Inclusive: ", $it/xs:restriction/xs:minInclusive/@value)) else (), | |
if( exists($it/xs:restriction/xs:maxInclusive/@value)) then (concat("Max Inclusive: ", $it/xs:restriction/xs:maxInclusive/@value) ) else (), | |
" ******************* ", | |
$it | |
) | |
}; | |
declare function local:process($name as xs:string) { | |
(concat("Filename: ", $name), | |
for $x in xdmp:document-get($name)/node()/node() | |
where fn:exists($x/@name) | |
return | |
if ( | |
some $str in $strings | |
satisfies contains($x/@name, $str ) | |
) | |
then (local:display($x)) | |
else () | |
) | |
}; | |
for $d in xdmp:filesystem-directory($dir-base)/dir:entry[1 to 50] | |
where contains($d/dir:filename/text(), "xsd") | |
return local:process($d/dir:pathname/text()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment