Hello
After some feedback from Christina I got the advice that I can use the %basex:inline annotation to force inlining. When I gave this a try everything was working fine, but after some more modifications to my code I know get this nice error message:
Improper use? Potential bug? Your feedback is welcome
This error does not appear any longer if I remove the %basex:inline annotation again.
Let me know if you need some more information, in the meantime I’ll try to rearrange some code and see if this will make the problem disappear.
Thanks Clemens
------------------------------------- So this is the complete output regarding the error etc:
Error: Improper use? Potential bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 8.6.1 Java: Oracle Corporation, 1.8.0_112 OS: Mac OS X, x86_64 Stack Trace: java.lang.RuntimeException: $year_183 index: 4, slot: 4 at org.basex.util.Util.notExpected(Util.java:62) at org.basex.query.var.QueryStack.pos(QueryStack.java:101) at org.basex.query.var.QueryStack.set(QueryStack.java:123) at org.basex.query.QueryContext.set(QueryContext.java:756) at org.basex.query.expr.gflwor.Let$LetEval.next(Let.java:184) at org.basex.query.expr.gflwor.GFLWOR.value(GFLWOR.java:71) at org.basex.query.expr.TypeCheck.value(TypeCheck.java:131) at org.basex.query.func.Closure.item(Closure.java:288) at org.basex.query.func.Closure.item(Closure.java:34) at org.basex.query.expr.ParseExpr.toItem(ParseExpr.java:488) at org.basex.query.expr.ParseExpr.toFunc(ParseExpr.java:628) at org.basex.query.func.StandardFunc.checkArity(StandardFunc.java:363) at org.basex.query.func.map.MapForEach.value(MapForEach.java:22) at org.basex.query.func.map.MapForEach.iter(MapForEach.java:17) at org.basex.query.QueryContext.iter(QueryContext.java:394) at org.basex.query.scope.MainModule.iter(MainModule.java:117) at org.basex.query.QueryContext.iter(QueryContext.java:330) at org.basex.query.QueryContext.cache(QueryContext.java:609) at org.basex.query.QueryProcessor.cache(QueryProcessor.java:113) at org.basex.core.cmd.AQuery.query(AQuery.java:86) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.gui.GUI.exec(GUI.java:471) at org.basex.gui.GUI.access$300(GUI.java:44) at org.basex.gui.GUI$6.run(GUI.java:413) Compiling: - rewriting descendant-or-self step(s) - rewriting descendant-or-self step(s) - type check removed: xs:string - type check removed: xs:string - type check removed: xs:string - inlining Q{http://com.semfinder.code-utils%7Dnormalize-icd-10-code#1 - type check removed: $code_99 as xs:string - inlining $code_99 - simplifying flwor expression - inlining Q{http://com.semfinder.code-utils%7Dnormalize-morphological-code#1 - type check removed: $code_100 as xs:string - inlining $code_100 - simplifying flwor expression - inlining Q{http://com.semfinder.code-utils%7Dnormalize-pcs-code#1 - type check removed: $code_101 as xs:string - inlining $code_101 - simplifying flwor expression - type check removed: xs:string - inlining Q{http://com.semfinder.code-utils%7Dnormalize-code#2 - inlining $classification_103 as xs:string? - inlining $normalized_67 - inlining $codes-for-classification_68 - inlining $acc_69 - type check removed: map(*) - marking as tail call: Q{http://com.semfinder.proof.final-valid%7Dget-codes-impl(map:put($map_63, $classification_66, (map:get($map_63, $classification_66), let $code_106 as xs:string := $code_65/Code return switch(((: xs:string?, true :) $classification_66)) case "es-dg-cm" return if(contains($code_106, ".")) then $code_106 else concat(substring($code_106, 1, 3), ".", substring($code_106, 4)) case "es-dg-morph" return if(contains($code_106, "/")) then $code_106 else concat(substring($code_106, 1, 4), "/", substring($code_106, 5)) case "es-op-pcs" return $code_106 default return $code_106)), tail($codes_64)) - rewriting descendant-or-self step(s) - rewriting descendant-or-self step(s) - pre-evaluating { } - inlining $dg_61 - inlining $op_62 - simplifying flwor expression - type check removed: map(*) - marking as tail call: Q{http://com.semfinder.proof.final-valid%7Dget-codes-impl(map { }, ($json_60/descendant::Diagnoses/*, $json_60/descendant::Procedures/*)) - rewriting descendant-or-self step(s) - type check removed: xs:string - type check removed: xs:string - atomic evaluation of (name() = concat("condition.rule.", $name_21)) - inlining Q{http://com.semfinder.proof.shared%7Dmsg-or-missing-lang#2 - type check removed: $lang_108 as xs:string - inlining $lang_108 - atomic evaluation of (name() = concat("condition.message.", $name_21)) - inlining Q{http://com.semfinder.proof.shared%7Dmsg-or-missing-lang#2 - type check removed: $lang_110 as xs:string - inlining $lang_110 - pre-evaluating string($rule_22) - pre-evaluating string($rule_22) - pre-evaluating string($msg_23) - pre-evaluating string($msg_23) - inlining $rule_22 - atomic evaluation of (name() = concat("condition.rule.", $name_21)) - inlining $msg_23 - inlining $with-rule_24 - type check removed: map(*) - atomic evaluation of (name() = $lang_16) - rewriting descendant-or-self step(s) - inlining Q{http://com.semfinder.proof.shared%7Dadd-messages#3 - type check removed: $messages_114 as node()* - type check removed: $lang_116 as xs:string - inlining $messages_114 - atomic evaluation of (name() = concat("condition.rule.", $name_117)) - atomic evaluation of (name() = concat("condition.message.", $name_117)) - inlining $lang_116 - flattening nested GFLWOR expression: $name_117 - type check removed: (map(*))* - atomic evaluation of (@year = $year_81) - atomic evaluation of (@source = $classification_80) - rewriting ((@year = $year_81) and (@source = $classification_80)) to predicate(s) - pre-evaluating boolean((@year = $year_81)) - pre-evaluating boolean((@source = $classification_80)) - inlining $known-codes_83 - rewriting where clause(s) - type check removed: item()* - type check removed: xs:anyAtomicType* - pre-evaluating ((: (map(*))*, true :) ()) - type check removed: (map(*))* - type check removed: (map(*))* - inlining Q{http://com.semfinder.proof.final-valid%7Dfind-valid-codes#4 - type check removed: $db-name_120 as xs:string - type check removed: $codes_121 as xs:string* - type check removed: $classification_122 as xs:string - type check removed: $year_123 as xs:int - inlining $db-name_120 - inlining $codes_121 - inlining $classification_122 - atomic evaluation of (@source = $classification_72) - inlining $year_123 - atomic evaluation of (@year = $year_73) - simplifying flwor expression - inlining Q{http://com.semfinder.prelude%7Dvalue-except#2 - type check removed: $a_125 as xs:anyAtomicType* - inlining $a_125 - pre-evaluating false() - pre-evaluating function($code_77) { ($code_77/final = false()) } - inlining Q{http://com.semfinder.proof.shared%7Dstore-forbidden-codes-for-json#2 - type check removed: $forbidden-codes_127 as xs:string* - type check removed: $name_128 as xs:string - inlining $forbidden-codes_127 - inlining $name_128 - simplifying flwor expression - inlining Q{http://com.semfinder.proof.shared%7Dstore-forbidden-codes-for-json#2 - type check removed: $name_130 as xs:string - inlining $name_130 - inlining $non-final_76 - type check removed: (map(*))* - inlining Q{http://com.semfinder.proof.shared%7Dget-year#1 - type check removed: $json_131 as item() - inlining $json_131 - simplifying flwor expression - type check removed: item()? - inlining Q{http://com.semfinder.proof.shared%7Dget-lang#1 - type check removed: $json_133 as item() - inlining $json_133 - simplifying flwor expression - type check removed: xs:string? - inlining Q{http://com.semfinder.proof.final-valid%7Dget-codes#1 - type check removed: $json_134 as item() - inlining $json_134 - simplifying flwor expression - inlining Q{http://com.semfinder.proof.shared%7Dget-country#1 - type check removed: $json_135 as item() - inlining $json_135 - simplifying flwor expression - type check removed: xs:string? - type check removed: $db-name_93 as xs:string - inlining Q{http://com.semfinder.proof.final-valid%7Dcheck-codes#4 - type check removed: $db-name_136 as xs:string - inlining $db-name_136 - atomic evaluation of (@year = $year_139) - atomic evaluation of (@source = $classification_138) - flattening nested GFLWOR expression: $valid_140 - inlining Q{http://com.semfinder.proof.shared%7Denrich-messages#3 - type check removed: $db_145 as xs:string - type check removed: $results_146 as (map(*))* - inlining $db_145 - atomic evaluation of (name() = $lang_147) - inlining $results_146 - flattening nested GFLWOR expression: $messages_148 - inlining $year_87 as item()? - inlining $lang_88 as xs:string? - inlining $codes_89 - removing variable $country_90 as xs:string? - simplifying flwor expression - inlining Q{http://com.semfinder.proof.final-valid%7Dexecute#2 - type check removed: $json_162 as item() - type check removed: $db-name_163 as xs:string - inlining $json_162 - inlining $db-name_163 - simplifying flwor expression - inlining $text_96 - pre-evaluating json:parse("{
 ""Data"": {
 ""Client"": {
 ""Country"": ""test"",
 ""Lang"": ""test""
 },
 ""PatientData"": {
 ""Sex"": ""2"",
 ""AgeInYears"": 14,
 ""DischargeDate"": ""2016-10-31""
 },
 ""Diagnoses"": {
 ""P"": {
 ""Comment"": ""Exists and final"",
 ""Code"": ""I63.331"",
 ""Classification"": ""es-dg-cm""
 },
 ""1"": {
 ""Comment"": ""Exists, not final"",
 ""Code"": ""S90.929"",
 ""Classification"": ""es-dg-cm""
 },
 ""2"": {
 ""Comment"": ""Does not exist"",
 ""Code"": ""I10"",
 ""Classification"": ""es-dg-cm""
 }
 },
 ""Procedures"": {
 ""0"": {
 ""Comment"": ""Exists"",
 ""Code"": ""0D164Z4"",
 ""Classification"": ""es-op-pcs""
 },
 ""1"": {
 ""Comment"": ""Exists, but not complete"",
 ""Code"": ""0LBD4__"",
 ""Classification"": ""es-op-pcs""
 },
 ""2"": {
 ""Comment"": ""Does not exist"",
 ""Code"": ""0DJD8ZZ"",
 ""Classification"": ""es-op-pcs""
 }
 }

 
 }
}") - inlining $json_97 - inlining $db_98 - pre-evaluating db:open("basic-proof") - atomic evaluation of (name() = $lang_184) - converting descendant::*:messages to child steps - pre-evaluating db:open("basic-proof") - atomic evaluation of (@*:year = $year_188) - atomic evaluation of (@*:source = $classification_187) - applying text index for $code_190 - simplifying flwor expression Optimized Query: declare %private function fv:get-codes-impl($map_63 as map(*), $codes_64 as node()*) as map(*) { if(empty($codes_64)) then $map_63 else let $code_65 := head($codes_64) let $classification_66 := $code_65/Classification/text() return Q{http://com.semfinder.proof.final-valid%7Dget-codes-impl(map:put($map_63, $classification_66, (map:get($map_63, $classification_66), let $code_106 as xs:string := $code_65/Code return switch(((: xs:string?, true :) $classification_66)) case "es-dg-cm" return if(contains($code_106, ".")) then $code_106 else concat(substring($code_106, 1, 3), ".", substring($code_106, 4)) case "es-dg-morph" return if(contains($code_106, "/")) then $code_106 else concat(substring($code_106, 1, 4), "/", substring($code_106, 5)) case "es-op-pcs" return $code_106 default return $code_106)), tail($codes_64)) }; map:for-each(Q{http://com.semfinder.proof.final-valid%7Dget-codes-impl(map { }, (document { }/descendant::Diagnoses/*, document { }/descendant::Procedures/*)), ((: inline-closure :) let $year_167 := ((: item()?, true :) let $year_183 := document { }/descendant::PatientData/DischargeDate cast as xs:date? return if(empty($year_183)) then () else year-from-date($year_183) cast as xs:int?) let $lang_168 := ((: xs:string?, true :) document { }/descendant::Client/Lang) return function($key_164, $val_165) { let $lang_184 as xs:string := $lang_168 let $messages_185 := (db:open-pre("basic-proof",0), ...)/*:messages/*[(name() = $lang_184)] return (let $codes_186 as xs:string* := $val_165 let $classification_187 as xs:string := $key_164 let $year_188 as xs:int := $year_167 let $valid_189 := for $code_190 in $codes_186 return db:text("basic-proof", $code_190)/parent::*:value/parent::*:code[parent::*:classification/parent::document-node()][..[(@*:year = $year_188)][(@*:source = $classification_187)]] let $b_191 as xs:anyAtomicType* := ($valid_189 ! value/text()) let $invalid_192 := distinct-values(($codes_186)[not((. = $b_191))]) return ((: (map(*))*, true :) (if(empty($invalid_192)) then () else { "ForbiddenCodes":[($invalid_192)], "Rule":"invalid_code" }, let $forbidden-codes_193 as xs:string* := (filter($valid_189, function($code_77) as xs:boolean {...}) ! value/text()) return if(empty($forbidden-codes_193)) then () else { "ForbiddenCodes":[($forbidden-codes_193)], "Rule":"final_code" })) ! let $result_194 as map(*) := . let $name_195 := map:get($result_194, "Rule") return map:put(map:put($result_194, "Name", let $msg_196 as xs:string? := $messages_185/*[(name() = concat("condition.rule.", $name_195))]/text() return if(empty($msg_196)) then concat("No translations for lang: ", $lang_184) else ((: xs:string, true :) $msg_196)), "Msg", let $msg_197 as xs:string? := $messages_185/*[(name() = concat("condition.message.", $name_195))]/text() return if(empty($msg_197)) then concat("No translations for lang: ", $lang_184) else ((: xs:string, true :) $msg_197))) })) Query: import module namespace final-valid = 'http://com.semfinder.proof.final-valid'; let $text := '{ "Data": { "Client": { "Country": "test", "Lang": "test" }, "PatientData": { "Sex": "2", "AgeInYears": 14, "DischargeDate": "2016-10-31" }, "Diagnoses": { "P": { "Comment": "Exists and final", "Code": "I63.331", "Classification": "es-dg-cm" }, "1": { "Comment": "Exists, not final", "Code": "S90.929", "Classification": "es-dg-cm" }, "2": { "Comment": "Does not exist", "Code": "I10", "Classification": "es-dg-cm" } }, "Procedures": { "0": { "Comment": "Exists", "Code": "0D164Z4", "Classification": "es-op-pcs" }, "1": { "Comment": "Exists, but not complete", "Code": "0LBD4__", "Classification": "es-op-pcs" }, "2": { "Comment": "Does not exist", "Code": "0DJD8ZZ", "Classification": "es-op-pcs" } } } }' let $json := json:parse($text) let $db := 'basic-proof' return final-valid:execute($json, $db) Query plan: <QueryPlan compiled="true"> <StaticFunc name="fv:get-codes-impl" arg0="map" arg1="codes"> <If> <FnEmpty name="empty(items)"> <VarRef> <Var name="$codes" id="64" as="node()*"/> </VarRef> </FnEmpty> <VarRef> <Var name="$map" id="63" as="map(*)"/> </VarRef> <GFLWOR> <Let> <Var name="$code" id="65"/> <FnHead name="head(items)"> <VarRef> <Var name="$codes" id="64" as="node()*"/> </VarRef> </FnHead> </Let> <Let> <Var name="$classification" id="66"/> <IterPath> <VarRef> <Var name="$code" id="65"/> </VarRef> <IterStep axis="child" test="Classification"/> <IterStep axis="child" test="text()"/> </IterPath> </Let> <StaticFuncCall name="fv:get-codes-impl" tailCall="true"> <MapPut name="put(map,key,value)"> <VarRef> <Var name="$map" id="63" as="map(*)"/> </VarRef> <VarRef> <Var name="$classification" id="66"/> </VarRef> <List> <MapGet name="get(map,key)"> <VarRef> <Var name="$map" id="63" as="map(*)"/> </VarRef> <VarRef> <Var name="$classification" id="66"/> </VarRef> </MapGet> <GFLWOR> <Let> <Var name="$code" id="106" as="xs:string"/> <IterPath> <VarRef> <Var name="$code" id="65"/> </VarRef> <IterStep axis="child" test="Code"/> </IterPath> </Let> <Switch> <TypeCheck type="xs:string?" function="true"> <VarRef> <Var name="$classification" id="66"/> </VarRef> </TypeCheck> <SwitchCase> <If> <FnContains name="contains(string,sub[,collation])"> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <Str value="." type="xs:string"/> </FnContains> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <FnConcat name="concat(atom1,atom2[,...])"> <FnSubstring name="substring(string,start[,len])"> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <Int value="1" type="xs:integer"/> <Int value="3" type="xs:integer"/> </FnSubstring> <Str value="." type="xs:string"/> <FnSubstring name="substring(string,start[,len])"> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <Int value="4" type="xs:integer"/> </FnSubstring> </FnConcat> </If> <Str value="es-dg-cm" type="xs:string"/> </SwitchCase> <SwitchCase> <If> <FnContains name="contains(string,sub[,collation])"> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <Str value="/" type="xs:string"/> </FnContains> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <FnConcat name="concat(atom1,atom2[,...])"> <FnSubstring name="substring(string,start[,len])"> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <Int value="1" type="xs:integer"/> <Int value="4" type="xs:integer"/> </FnSubstring> <Str value="/" type="xs:string"/> <FnSubstring name="substring(string,start[,len])"> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <Int value="5" type="xs:integer"/> </FnSubstring> </FnConcat> </If> <Str value="es-dg-morph" type="xs:string"/> </SwitchCase> <SwitchCase> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> <Str value="es-op-pcs" type="xs:string"/> </SwitchCase> <SwitchCase> <VarRef> <Var name="$code" id="106" as="xs:string"/> </VarRef> </SwitchCase> </Switch> </GFLWOR> </List> </MapPut> <FnTail name="tail(items)"> <VarRef> <Var name="$codes" id="64" as="node()*"/> </VarRef> </FnTail> </StaticFuncCall> </GFLWOR> </If> </StaticFunc> <MapForEach name="for-each(map,function)"> <StaticFuncCall name="fv:get-codes-impl" tailCall="false"> <Map size="0"/> <List> <CachedPath> <FDoc base=""/> <IterStep axis="descendant" test="Diagnoses"/> <IterStep axis="child" test="*"/> </CachedPath> <CachedPath> <FDoc base=""/> <IterStep axis="descendant" test="Procedures"/> <IterStep axis="child" test="*"/> </CachedPath> </List> </StaticFuncCall> <Closure arg0="key" arg1="val"> <Var name="$year" id="167"/> <TypeCheck type="item()?" function="true"> <GFLWOR> <Let> <Var name="$year" id="183"/> <Cast type="xs:date?"> <CachedPath> <FDoc base=""/> <IterStep axis="descendant" test="PatientData"/> <IterStep axis="child" test="DischargeDate"/> </CachedPath> </Cast> </Let> <If> <FnEmpty name="empty(items)"> <VarRef> <Var name="$year" id="183"/> </VarRef> </FnEmpty> <Empty size="0"/> <Cast type="xs:int?"> <FnYearFromDate name="year-from-date(date)"> <VarRef> <Var name="$year" id="183"/> </VarRef> </FnYearFromDate> </Cast> </If> </GFLWOR> </TypeCheck> <Var name="$lang" id="168"/> <TypeCheck type="xs:string?" function="true"> <CachedPath> <FDoc base=""/> <IterStep axis="descendant" test="Client"/> <IterStep axis="child" test="Lang"/> </CachedPath> </TypeCheck> <GFLWOR> <Let> <Var name="$lang" id="184" as="xs:string"/> <VarRef> <Var name="$lang" id="168"/> </VarRef> </Let> <Let> <Var name="$messages" id="185"/> <IterPath> <DBNodeSeq size="8"> <DBNode name="basic-proof" pre="0"/> <DBNode name="basic-proof" pre="84"/> <DBNode name="basic-proof" pre="43648"/> <DBNode name="basic-proof" pre="501117"/> <DBNode name="basic-proof" pre="958586"/> </DBNodeSeq> <IterStep axis="child" test="*:messages"/> <IterStep axis="child" test="*"> <CmpG op="="> <FnName name="name([node])"/> <VarRef> <Var name="$lang" id="184" as="xs:string"/> </VarRef> </CmpG> </IterStep> </IterPath> </Let> <IterMap> <GFLWOR> <Let> <Var name="$codes" id="186" as="xs:string*"/> <VarRef> <Var name="$val" id="165"/> </VarRef> </Let> <Let> <Var name="$classification" id="187" as="xs:string"/> <VarRef> <Var name="$key" id="164"/> </VarRef> </Let> <Let> <Var name="$year" id="188" as="xs:int"/> <VarRef> <Var name="$year" id="167"/> </VarRef> </Let> <Let> <Var name="$valid" id="189"/> <GFLWOR> <For> <Var name="$code" id="190"/> <VarRef> <Var name="$codes" id="186" as="xs:string*"/> </VarRef> </For> <CachedPath> <ValueAccess data="basic-proof" type="text" name="*:value"> <VarRef> <Var name="$code" id="190"/> </VarRef> </ValueAccess> <CachedStep axis="parent" test="*:code"> <CachedPath> <IterStep axis="parent" test="*:classification"/> <IterStep axis="parent" test="document-node()"/> </CachedPath> <CachedPath> <IterStep axis="parent" test="node()"> <CmpG op="="> <CachedPath> <IterStep axis="attribute" test="*:year"/> </CachedPath> <VarRef> <Var name="$year" id="188" as="xs:int"/> </VarRef> </CmpG> <CmpG op="="> <CachedPath> <IterStep axis="attribute" test="*:source"/> </CachedPath> <VarRef> <Var name="$classification" id="187" as="xs:string"/> </VarRef> </CmpG> </IterStep> </CachedPath> </CachedStep> </CachedPath> </GFLWOR> </Let> <Let> <Var name="$b" id="191" as="xs:anyAtomicType*"/> <IterMap> <VarRef> <Var name="$valid" id="189"/> </VarRef> <CachedPath> <IterStep axis="child" test="value"/> <IterStep axis="child" test="text()"/> </CachedPath> </IterMap> </Let> <Let> <Var name="$invalid" id="192"/> <FnDistinctValues name="distinct-values(items[,collation])"> <IterFilter> <VarRef> <Var name="$codes" id="186" as="xs:string*"/> </VarRef> <FnNot name="not(items)"> <CmpG op="="> <ContextValue/> <VarRef> <Var name="$b" id="191" as="xs:anyAtomicType*"/> </VarRef> </CmpG> </FnNot> </IterFilter> </FnDistinctValues> </Let> <TypeCheck type="(map(*))*" function="true"> <List> <If> <FnEmpty name="empty(items)"> <VarRef> <Var name="$invalid" id="192"/> </VarRef> </FnEmpty> <Empty size="0"/> <CMap> <Str value="ForbiddenCodes" type="xs:string"/> <CArray> <VarRef> <Var name="$invalid" id="192"/> </VarRef> </CArray> <Str value="Rule" type="xs:string"/> <Str value="invalid_code" type="xs:string"/> </CMap> </If> <GFLWOR> <Let> <Var name="$forbidden-codes" id="193" as="xs:string*"/> <IterMap> <FnFilter name="filter(items,function)"> <VarRef> <Var name="$valid" id="189"/> </VarRef> <FuncItem type="function(item()*) as xs:boolean"> <Var name="$code" id="77"/> <CmpG op="="> <CachedPath> <VarRef> <Var name="$code" id="77"/> </VarRef> <IterStep axis="child" test="final"/> </CachedPath> <Bln value="false" type="xs:boolean"/> </CmpG> </FuncItem> </FnFilter> <CachedPath> <IterStep axis="child" test="value"/> <IterStep axis="child" test="text()"/> </CachedPath> </IterMap> </Let> <If> <FnEmpty name="empty(items)"> <VarRef> <Var name="$forbidden-codes" id="193" as="xs:string*"/> </VarRef> </FnEmpty> <Empty size="0"/> <CMap> <Str value="ForbiddenCodes" type="xs:string"/> <CArray> <VarRef> <Var name="$forbidden-codes" id="193" as="xs:string*"/> </VarRef> </CArray> <Str value="Rule" type="xs:string"/> <Str value="final_code" type="xs:string"/> </CMap> </If> </GFLWOR> </List> </TypeCheck> </GFLWOR> <GFLWOR> <Let> <Var name="$result" id="194" as="map(*)"/> <ContextValue/> </Let> <Let> <Var name="$name" id="195"/> <MapGet name="get(map,key)"> <VarRef> <Var name="$result" id="194" as="map(*)"/> </VarRef> <Str value="Rule" type="xs:string"/> </MapGet> </Let> <MapPut name="put(map,key,value)"> <MapPut name="put(map,key,value)"> <VarRef> <Var name="$result" id="194" as="map(*)"/> </VarRef> <Str value="Name" type="xs:string"/> <GFLWOR> <Let> <Var name="$msg" id="196" as="xs:string?"/> <CachedPath> <VarRef> <Var name="$messages" id="185"/> </VarRef> <IterStep axis="child" test="*"> <CmpG op="="> <FnName name="name([node])"/> <FnConcat name="concat(atom1,atom2[,...])"> <Str value="condition.rule." type="xs:string"/> <VarRef> <Var name="$name" id="195"/> </VarRef> </FnConcat> </CmpG> </IterStep> <IterStep axis="child" test="text()"/> </CachedPath> </Let> <If> <FnEmpty name="empty(items)"> <VarRef> <Var name="$msg" id="196" as="xs:string?"/> </VarRef> </FnEmpty> <FnConcat name="concat(atom1,atom2[,...])"> <Str value="No translations for lang: " type="xs:string"/> <VarRef> <Var name="$lang" id="184" as="xs:string"/> </VarRef> </FnConcat> <TypeCheck type="xs:string" function="true"> <VarRef> <Var name="$msg" id="196" as="xs:string?"/> </VarRef> </TypeCheck> </If> </GFLWOR> </MapPut> <Str value="Msg" type="xs:string"/> <GFLWOR> <Let> <Var name="$msg" id="197" as="xs:string?"/> <CachedPath> <VarRef> <Var name="$messages" id="185"/> </VarRef> <IterStep axis="child" test="*"> <CmpG op="="> <FnName name="name([node])"/> <FnConcat name="concat(atom1,atom2[,...])"> <Str value="condition.message." type="xs:string"/> <VarRef> <Var name="$name" id="195"/> </VarRef> </FnConcat> </CmpG> </IterStep> <IterStep axis="child" test="text()"/> </CachedPath> </Let> <If> <FnEmpty name="empty(items)"> <VarRef> <Var name="$msg" id="197" as="xs:string?"/> </VarRef> </FnEmpty> <FnConcat name="concat(atom1,atom2[,...])"> <Str value="No translations for lang: " type="xs:string"/> <VarRef> <Var name="$lang" id="184" as="xs:string"/> </VarRef> </FnConcat> <TypeCheck type="xs:string" function="true"> <VarRef> <Var name="$msg" id="197" as="xs:string?"/> </VarRef> </TypeCheck> </If> </GFLWOR> </MapPut> </GFLWOR> </IterMap> </GFLWOR> </Closure> </MapForEach> </QueryPlan>