Skip to content
Johannes Lichtenberger edited this page Jun 19, 2018 · 1 revision

Simple queries

The simplest way to run a query is by passing it via stdin:

echo 1+1 | java -jar sirix-xquery-x.y.z-with-dependencies.jar

=> 2

If the query is stored in a separate file, let's say test.xq, type:

java -jar sirix-xquery-x.y.z-with-dependencies.jar -q test.xq

or use the file redirection of your shell:

java -jar sirix-xquery-x.y.z-with-dependencies.jar < test.xq

or simply type in a query in your shell:

java -jar sirix-xquery-x.y.z-with-dependencies.jar -p -q -

Afterwards type in your query and terminate it by two consecutive newlines.

Simple showcase

We've added a ZIP

For instance

java -jar sirix-xquery.jar -q load.xq

to load an XML-file into a database/resource in Sirix. It's currently stored in your home-directory (sirix-data).

Then do some XQuery Updates with auto-commit (creates a new revision for each update query).

java -jar sirix-xquery.jar -q update-first.xq

java -jar sirix-xquery.jar -q update-second.xq

java -jar sirix-xquery.jar -q update-third.xq

Then do some querying:

Query 1. revision:

java -jar sirix-xquery.jar -p -q query-first.xq

Query 4. revision:

java -jar sirix-xquery.jar -p -q query-fourth.xq

Open last revision but basically query for every revision (all-time):

java -jar sirix-xquery.jar -p -q query-all-time.xq

Open last revision but query the past revisions:

java -jar sirix-xquery.jar -p -q query-past.xq

Open third revision, query for a subtree and then navigate in time (to show a subtree in all revisions):

java -jar sirix-xquery.jar -p -q query-third-subtree-all-time.xq