This file contains 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 "3.1"; | |
import module namespace xbow="http://line-o.de/xq/xbow"; | |
let $length := 100000 | |
let $sequence-of-maps := (1 to $length) ! map { "n": ., "values": ("a" || util:random(100), "b" || util:random(100), "c" || util:random(100)) } | |
let $keyed-sequence := |
This file contains 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 "3.1"; | |
declare | |
function local:find($path, $document-id as xs:integer) as xs:string* { | |
local:find-in-collection($path, (), $document-id) | |
}; | |
declare | |
function local:resource ($collection as xs:string, $resource as xs:string, $document-id as xs:integer) as xs:string? { | |
let $path := $collection || '/' || $resource |
This file contains 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 "3.1"; | |
import module namespace xbow = "http://line-o.de/xq/xbow"; | |
declare namespace xqdoc="http://www.xqdoc.org/1.0"; | |
declare variable $local:length-category-rules := [ | |
xbow:le(2), xbow:le(4), xbow:le(8), xbow:le(12), xbow:gt(12) ]; | |
declare function local:gather-and-count ($names) { | |
$names |
This file contains 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 "3.1"; | |
declare function local:random-number () { | |
util:random(1000000000) div 1000000000 | |
}; | |
declare function local:random-number-generator () { | |
map { | |
'number': local:random-number(), | |
'next': local:random-number-generator#0, |
This file contains 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 "3.1"; | |
import module namespace imfd='http://existsolutions.com/apps/imfd' at '/db/temp/imfd.xqm'; | |
let $now := current-dateTime() | |
let $tz := timezone-from-dateTime($now) | |
let $imfd := imfd:format($now) | |
let $gmt := imfd:to-dateTime($imfd) | |
let $reversed := adjust-dateTime-to-timezone($gmt + $tz, $tz) |
This file contains 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 "3.1"; | |
declare namespace io = "http://io"; | |
(: IO version of get-char :) | |
declare function local:get-char() as map(*) { | |
local:create-io(function($realworld as element(io:realworld)) { | |
($realworld, 123) | |
}) | |
}; |
This file contains 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 "3.1"; | |
(:~ | |
these tests were created because of | |
https://github.com/eXist-db/exist/issues/2308 | |
~:) | |
module namespace boolseq="http://exist-db.org/xquery/xqsuite/boolseq"; | |
declare namespace test="http://exist-db.org/xquery/xqsuite"; | |
declare variable $boolseq:sequence := (true(), false(), true()); |
This file contains 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 "3.1"; | |
module namespace xg="http://existdb.org/xq/grammar"; | |
declare namespace test="http://exist-db.org/xquery/xqsuite"; | |
declare | |
%test:pending | |
%test:assertEquals("<root a='a'/>") | |
function xg:literalString() { | |
(: | |
: since the line below raises a static error, it cannot be tested this way |
This file contains 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
__=`${![]}` | |
___=`${!![]}` | |
____=`${''[[]]}` | |
_____=`${{}}` | |
$={_:[]|[],$:!![]|[],$_:!![]<<!![],$$:!![]<<!![]|!![],$__:!![]<<!![]<<!![],$_$:!![]<<!![]<<!![]|!![],$$_:!![]<<!![]<<!![]|!![]<<!![],$$$:!![]<<!![]<<!![]|!![]<<!![]|!![],$___:!![]<<!![]<<!![]<<!![],$__$:!![]<<!![]<<!![]<<!![]|!![],$_$_:__[!![]|[]],$_$$:_____[!![]<<!![]],$$__:_____[!![]<<!![]<<!![]|!![]],$$_$:____[!![]<<!![]],$$$_:__[!![]<<!![]<<!![]],$$$$:__[[]|[]]} | |
$_=_$=>_$[`${_____[$.$$]}${_____[$.$]}${____[$.$_$]}${____[$.$]}`]('') | |
$$=$_([_____[$.$_$],_____[$.$],____[$.$],__[$.$$],___[$._],___[$.$],____[$._],_____[$.$_$],___[$._],_____[$.$],___[$.$]]) | |
_=_$=>[][$$][$$]($_([___[$.$],__[$.$__],___[$._],___[$.$_],___[$.$],____[$.$],'"\\',___[$.$_],'{',$_(_$),'}"']))() | |
![][$$][$$]($_([_____[$.$_$],_____[$.$],____[$.$],__[$.$$],_____[$.$],__[$.$_],__[$.$__],'.',__[$.$_],_____[$.$],_([$.$$_,$.$$$]),'(',_([$.$$$,$._]),___[$.$],_____[$.$],_____[$.$_$],___[$.$$],__[$.$$],__[$.$$],',"',_([$.$,$.$$$$,$.$__,$.$$$,$.$_$$]),'",$,`${_}`,`${$_}`)']))() |
This file contains 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 '3.1'; | |
(:~ | |
this script must be run with a user in the DBA group | |
add this line to your post-install script or run it manually | |
it will set the GID sticky bit | |
chown('/path/to/this/script.xq', 'admin', 'dba') | |
chmod('/path/to/this/script.xq', 'rwxr-S---') | |
:) |