简体   繁体   English

在BaseX中从命令行使用xquery外部变量时出现问题

[英]Issue when using xquery external variables from the command line in BaseX

I have the following query in a XQ file named "consulta.xq" 我在名为“ consulta.xq”的XQ文件中有以下查询

declare namespace xs = "http://www.w3.org/2001/XMLSchema";
declare variable $word as xs:string+ external;

for $entry in doc("cni_es_cushimariano2008")//e 
where $entry//l[matches(., $word)] 
return <e>{$entry//r//text()} --> {$entry//l//text()}</e>

My database "cni_es_cushimariano2008" has the following structure/data: 我的数据库“ cni_es_cushimariano2008”具有以下结构/数据:

<?xml version="1.0" encoding="UTF-8"?>
<dictionary>
<alphabet>aeiobchjmnñprsty</alphabet>
<section id="main" type="standard">
    <!-- cuidarse (de alguien). aamaantsi. -->
    <e>
        <p>
            <l>cuidarse (de alguien)</l>
            <r>aamaantsi<s n="verbo intransitivo"/>
                <s n="infinitivo"/>
            </r>
        </p>
    </e>
    <!-- celoso. aamaantsi. -->
    <e>
        <p>
            <l>celoso</l>
            <r>aamaantsi<s n="adjetivo"/>
            </r>
        </p>
    </e>
    <!-- traer. aamaantsi. -->
    <e>
        <p>
            <l>traer</l>
            <r>aamaantsi<s n="verbo transitivo"/>
                <s n="infinitivo"/>
            </r>
        </p>
    </e>
</section>
</dictionary>

I am trying to execute the following command line instruction 我正在尝试执行以下命令行指令

$ basex -b$word=celoso consulta.xq

but I don't receive the expected result and receive the following message: 但我没有收到预期的结果并收到以下消息:

[XPDY0002] No value assigned to $word as xs:string+.

I am not an expert using Basex and XQuery so I will be grateful for any answer that might help me. 我不是使用Basex和XQuery的专家,所以对于可能对我有帮助的答案将不胜感激。 Thanks in advance. 提前致谢。

The $ character presumably is interpreted by your command shell, such that $word does not reach its destination. $字符大概是由命令shell解释的,因此$word不会到达其目的地。 It might need to be escaped, 它可能需要逃脱,

$ basex -b\$word=celoso consulta.xq

or even omitted, 甚至省略

$ basex -bword=celoso consulta.xq

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM