Skip to content

LabelledEntriesXQuery

Christian Lück edited this page Jul 25, 2022 · 1 revision

de.wwu.scdh.teilsp.extensions.LabelledEntriesXQuery

The plugin de.wwu.scdh.teilsp.extensions.LabelledEntriesXQuery is used to generate completion suggestions via XQuery.

Arguments

xquery

Required: The path to the XQuery script. This must be a valid URL. Use the right editor variables to get such an URL, e.g. ${pdu}/resources/xql/witnesses.xql to point to resources/xql/witnesses.xql relative to your project directory URL.

external

Optional: Arbitrary external variables passed to your XQuery script. This has the form

VARIABLE1_NAME=VALUE1,VARIABLE2_NAME=VALUE2

functionLName

Optional: The local name of the XQuery function to call.

functionPrefix

Optional: The prefix of the XQuery function to call.

functionNamespace

Optioal: The namespace of the function to call.

Requirements for the XQuery script

  • The plugin calls a function with the arity 0 (no arguments).

  • By default it is obt:generate-entries(), where the prefix obt is bound to http://scdh.wwu.de/oxbytei.

  • The name of this function can be choosen by plugin arguments.

  • The function must return map(xs:string, xs:string)*, i.e. a sequence of maps, where keys and values are strings. Cf. Saxonica's documentation of maps.

  • There should (must) be a key named key and a key named label for the key and label of the labelled entries.

  • See witnesses.xql to get an idea.

Sample configuration

        <plugin>
            <class>de.wwu.scdh.teilsp.extensions.LabelledEntriesXQuery</class>
            <type>de.wwu.scdh.teilsp.services.extensions.ILabelledEntriesProvider</type>
            <configurations>
                <configuration>
                    <conditions>
                        <condition domain="context">self::*:lem | self::*:rdg</condition>
                        <condition domain="priority">10</condition>
                        <condition domain="nodeName">wit</condition>
                        <condition domain="nodeType">attributeValue</condition>
                    </conditions>
                    <arguments>
                        <argument name="xquery">${pdu}/resources/xql/witnesses.xql</argument>
                        <argument name="external">witness-catalog=${pdu}/WitnessCatalogue.xml</argument>
                    </arguments>
                </configuration>
            </configurations>
        </plugin>
Clone this wiki locally