QuiP - command line question

I would like to know which is the command line syntax in QuiP for

- an input XML file
- an output XML file
- a XQuery query

Since Quip consists of two parts, one written in Java and one
written in Clean, there are also two sets of command line options.

Just start the script runQuip.cmd with option --help and you get:

E:\QuiP>./runQuip.cmd --help
-v, --verbose Prints additional output.
-o, --output FILENAME prints the output to the specified file.
--quilt use the quilt syntax.
--xquery use the xquery syntax(default).
--abql generates only the ABQL.
--cmdquip EXEPATH sets the path for the ‘quip.exe’.
--heapquip HEAPSIZE sets the heap size for the ‘quip.exe’.
--helpquip shows the help for the ‘quip.exe’.
-h, -?, --help shows this help.

As you see, the outfile is specified by -o filename, the XQuery file is the
last command argument

Further options are provided by the part of Quip written in Clean. You can
get help on these by the --helpquip option. Then you get:

E:\QuiP>./runQuip.cmd --helpquip
usage: quip inAbqlFile.xml outXmlFile.xml [options]
where options are:
-file_system : read documents from the file system (starts from current directory)
-non_strict : evaluate user defined Quilt function lazily (default is strict evaluation)
-server name : use the server ‘name’ as Tamino server
-data_base name : use the data base ‘name’ on Tamino server
-home dirName : find documents in subdirectories of ‘dirName’
for ‘fromCollection’ and ‘document’ function
-logging_off : turns logging off (default: logging is made)
-log_file name : write log to file ‘name’ (default: log.txt)
-input file_name: use xml file ‘file_name’ as input document
-quip_heap size : set the integer ‘size’ for quip’s maximal heap space
-value_output : do not output the XML result but its text value

As you can see, here you can specify you data base, but also a input file name,
which is taken as implicit document. This document is used for XPath expression in XQuery,
which do not start with a function call of either ‘document(.)’ or 'fromCollection(.).

so a command line call to Quip you are looking for might be:

./runQuip.cmd -input myDoc.xml -o myResult.xml myQuery.xquery

Hope this helps

Sven Eric

If I want to pass a variable to an xquery from the command line, how would this be done ?

The most effective way with Quip 2.2 probably is to call quip.exe from the command line, using the -include option to pass the generic query as a function, and to call the function with concrete parameters using the -query option.

Let me refrase my question … what Udo explained doesn’t quite cover my needs. I have a textbased interface in C++/perl from where I want to execute a query with a parameter… therefore my question is:

How do I pass a variable from a promp to my XQuery ? Im using Quip from a windows prompt, and would like to set the “search” argument in the following query from the prompt:

let $search := "net"
for $i in document(“projekt/courses.xml”)/courses/course
where contains($i/keywords/text(), $search)

something like:
quip.exe -o testresults.xml projekt\find.xquery -variable search net

would be great - thanks :slight_smile:


Sorry if I wasn’t clear enough. I thought of a file search.xquery containing your query as a function, something like:

define function search($keyword) {
for $i in document(“project/courses.xml”)/courses/course
where contains($i/keywords/text(), $keyword)
return {$i}

Then you can call this function from the command line as follows:

quip.exe -include search.xquery -query "search(‘expert’)"

That’s probably the closest you can get.

I guess I simply didn’t understand you the first time … thank you very much for the excelent answer ! :slight_smile: