Questions tagged [basex]

BaseX is a robust, high-performance XML database engine and a highly compliant XQuery 3.1 processor with full support of the W3C Update and Full Text extensions. It serves as excellent framework for building complex data-intensive web applications.

BaseX focuses on storing, querying, and visualizing large XML and JSON documents and collections. A visual frontend allows users to interactively explore data and evaluate queries in realtime (i.e., with each key click). BaseX is platform-independent and distributed under the free BSD License.

BaseX provides several methods of accessing a database and executing queries, among them:


Workflow (when using the native BaseX Java API)

More examples can be found in the BaseX Documentation

  • First of all, a BaseX database server must be running, which will process the client requests.
  • Each client provides a session class or script with methods to connect to and communicate with the database server. A socket connection will be established by the constructor, which expects a host, port, user name and password as arguments.
  • The execute() method is called to launch a database command. It returns the result or throws an exception with the received error message.
  • The query() method creates a query instance. Variables can be bound to that object, and the result can either be requested via execute(), or in an iterative manner with the more() and next() functions. If an error occurs, an exception will be thrown.
  • The create(), add(), replace() and store() method pass on input streams to the corresponding database commands.
  • To speed up execution, an output stream can be specified by some clients; this way, all results will be directed to that output stream.
  • Most clients are accompanied by some example files, which demonstrate how database commands can be executed or how queries can be evaluated.
486 questions
0
votes
2 answers

XQuery: Select a node in the context of a variable

In order to learn XQuery I tried to run the following XQuery command in BaseX let $x := doc("test.xq")//h2/following-sibling return $x::h2 I supposed it should be equivalent to let $x := doc("test.xq")//h2/following-sibling::h2 return $x But it…
Ahmad
  • 8,811
  • 11
  • 76
  • 141
0
votes
1 answer

Finding unique local-names of nodes (as well as unique node structure)

I'm trying to dynamically sense the structure of an xml file to determine unique nodes present i.e. if I had
David K
  • 213
  • 1
  • 2
  • 12
0
votes
1 answer

How can I duplicate a document in my BaseX database without first outputting it into XML

I have a BaseX database with 3 documents in it. The third one is generated by operating on the first two. I need to do some additional operations to generate a 4th document and was hoping I could generate a copy of my third document and then modify…
David K
  • 213
  • 1
  • 2
  • 12
0
votes
2 answers

Why does my query report "Steps within a path expression must yield nodes"?

I'm relatively new to XQuery and I'm using a XML with the following format (MODSXML):
0
votes
1 answer

How to run a xquery with xml-file (containing value) as one of the bound variable

I am new to using xquery and baseX. I am using the standalone prompt of baseX. I want to run an xquery, contained in abc.xq which can accept an input from a file, say, data.xml. Basically, abc.xq has a bound variable 'request' which it will extract…
MiKu
  • 385
  • 1
  • 5
  • 16
0
votes
1 answer

Writing updates to xml file with XQuery and BaseX

I have a file.xml storing protocols whose structure is the following: 1 2014-12-15 Trasmissione prospetti di…
SagittariusA
  • 5,289
  • 15
  • 73
  • 127
0
votes
1 answer

How to return directory (Xquery path) as a value and not as a string of that path?

When writing this code for Basex { for $hotel in doc("tourism.xml")/tourism/hotel let $r:=$hotel/room let $g:=doc("tourism.xml")/tourism/guest where $g/@name="Udo Lindenberg" and $g/customer/@hotel=$hotel/@id and…
0
votes
1 answer

How do I get BaseX to return multiple elements in a nested XQuery?

BaseX is complaining about a nested query of mine. I do not understand why it cannot return multiple lines like it did in the first query. The error says, "Expecting }, found >" and the > it is referring to is the > after name under trips. It works…
L. Becker
  • 59
  • 1
  • 9
0
votes
1 answer

Tomcat multiple services - startup problems

I'm trying to run two instances of BaseX in Tomcat with the following server.conf. I'm running into an odd problem: both are available on their respective ports, but the webapp itself is the same WAR; i.e. a link that is only in the webapps/ WAR…
CanOfBees
  • 93
  • 12
0
votes
0 answers

XQUERY to delete a node with an ID property in BaseX

I am using BaseX to store XML data with multiple nodes in the following format: Name of my node on the tree The code above is…
0
votes
1 answer

Need help executing an XQuery from basex standalone

I'm using Basex 8.0 beta on ubuntu 14.04 My database contains XML documents with elements that look like this 20141004
0
votes
0 answers

XQuery: file:is-file() returns false

I am executing the following XQuery code on BaseX 7.9 and the result is false even when I know it is a file (the dots are an abbreviation). file:is-file("C:\Users\...\books2.xml") According to http://docs.basex.org/wiki/File_Module#file:is-file I…
popen_2
  • 43
  • 5
0
votes
1 answer

BaseX: Slow XQuery

I've got a BaseX XML database with ~20 XML files. These files are different in size and structure. The biggest file has got 524 MB. It consists of a parent ARTICLE tag with 267685 ART subtags. This is my XQuery: "/ARTICLE/ART[PRDNO=12345]" (pretty…
Matthias Wuttke
  • 1,982
  • 2
  • 21
  • 38
0
votes
2 answers

Why does BaseX not modify the file upon an insert node command?

I am executing the following XQuery code on BaseX 7.9 and am able to see the insertion on the results window. I even see the new node after closing and reopening the collection. However, when I go to the file directory I see it hasn't been modified.…
popen_2
  • 43
  • 5
0
votes
2 answers

Iteration in Ant, command line xquery function call

I have an xml-file - call it myXML.xml - like this: