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
3
votes
2 answers

How can I configure BaseX for use in VS Code

What's the problem I am trying to get XQuery to work in VS Code using BaseX, but every time I try to execute a query using XML Tools, it fails because its execution in the command is returning an error code. How do I know that is the problem? On the…
Kraigolas
  • 5,121
  • 3
  • 12
  • 37
3
votes
3 answers

Get the reverse order of ancestor nodes with XQuery/XPath

I am searching for a good solution (short expression, best performance) to get the reverse order of all ancestor nodes with XQuery 3.1 on BaseX. Now i'm using this code, to get dirA/dirA3/dirA31 for the given XML example: xquery version "3.1"…
user5924595
3
votes
0 answers

BaseX DBA Gui performance

Running queries via REST BaseX api is just instantaneous compared to running it via Queries screen in DBA console which uses RESTXQ. Has anyone faced this issue? or please could you share your experience resolving it. Second question was do we need…
K Majid
  • 31
  • 1
3
votes
2 answers

BaseX gui or any other gui client to connect and manage a remote BaseX database?

It seems BaseX gui works only for local databases. Is there any way to connect with and manage a remote BaseX server using BaseX gui? If not, is there any 3rd party solution? Thank you in advance.
3
votes
1 answer

How to record task start time and task end time in BaseX

hi i am doing the ingestion and validation but i want to record the start time and end time of the ingestion and validation. below are my code what i am doing wrong please suggest. let $pipelineXml :=
3
votes
2 answers

BaseX - Out of memory when using enclosing xml in XQuery

I've been trying to query a BaseX db which contains more than 1500000 items. When i run this query for $item in collection('coll')//item return $item (: returns an xml element :) it executes in less than a second. But when i try to return the…
unicorn
  • 139
  • 1
  • 9
3
votes
0 answers

How to implement XProc in BaseX

I am working on a project where I must follow multiple steps at the time of data ingestion into the BaseX Database. I want to define these steps in XProc for the ease. Specially we need DOCX to DocBook and DocBook to DOC converstion. My BaseX…
Navin Rawat
  • 3,208
  • 1
  • 19
  • 31
3
votes
1 answer

Is there a way to make BaseX serve an HTML document?

Is there a way to make BaseX's HTTP server serve an HTML document stored either in the db as a raw resource or in the file system, with a text/html content type, so it can be displayed in a browser? The document is a web page that does XHR requests…
ARX
  • 1,040
  • 2
  • 14
  • 20
3
votes
2 answers

Converting xml to csv from XQuery in BaseX

The reason for which I'm writing is because I have a database of approx 1k of xmls in BaseX. I already cleaned it and got the info I wanted. Nevertheless, I want to be able to export that data in the CSV format. When I tried with the code given in…
Antonio López Ruiz
  • 1,396
  • 5
  • 20
  • 36
3
votes
1 answer

How to return results together with update operations in BaseX?

I recognized that (insert/delete)-XQueries executed with the BaseX client always returning an empty string. I find this very confusing or unintuitive. Is there a way to find out if the query was "successful" without querying the database again (and…
Jan
  • 343
  • 2
  • 16
3
votes
2 answers

Why does this XQuery filter return unwanted elements?

I'm using BaseX 8.4.1 which implements XQuery 3.1 I'm trying to do a quite basic thing in XQuery, but I cannot seem to figure it out. I created some example data that illustrates what I am trying to do. My data set looks like this. It is a simple…
wvdz
  • 16,251
  • 4
  • 53
  • 90
3
votes
2 answers

XQuery join result

I have a XML that looks like this: 10001 LAX SFO 10002
Idrizi.A
  • 9,819
  • 11
  • 47
  • 88
3
votes
2 answers

XQuery in BaseX - let statement outside of file:write()

I have the following code: let $fName := "C:\Users\user\Documents\Sitemaps\Updated Pages\Books.xml" file:write($fName, element titles{ for $x in doc("http://www.w3schools.com/xsl/books.xml")/bookstore/book where $x/price>0 order by…
V.S.
  • 55
  • 6
3
votes
1 answer

XPath: What does the «/» operator at the beginning of a rooted path expression exactly match?

In a directory, I have several XML files like this: File #1: File #2: I want to select the first document. For this, I use the following query (assuming the directory is called…
ARX
  • 1,040
  • 2
  • 14
  • 20
3
votes
1 answer

Build dictionary in XQuery for loop and count occurrences of similar nodes

Im trying to count occurrences of a string during a for loop in a dictionary (baseX map). It seems that the contents of the dictionary are cleared after each iteration. Is there a way to keep the info throughout the loop? declare variable $dict as…
bitwise
  • 170
  • 12
1 2
3
32 33