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
18
votes
6 answers

Efficient and user-friendly way to present slow-loading results

I have read many similar questions concerning cancelling a POST request with jQuery, but none seem to be close to mine. I have your everyday form that has a PHP-page as an action:
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
7
votes
1 answer

Java error: Unable to initialize main class

I am trying to run this code but I get the following error. package practicaXML; import javax.xml.xquery.*; import org.w3c.dom.Node; import net.xqj.basex.BaseXXQDataSource; public class App { public static void main(String[] args) { try…
winter
  • 207
  • 1
  • 4
  • 13
7
votes
1 answer

Most efficient way to count occurrences in XQuery for multiple values

I have 1581 words that I need to look up in an XML corpus of Dutch (500 million words). This corpus itself is split up in many databases. (You can read why here.) We use BaseX as a server (version 7.9), which uses XQuery as input. I am interested in…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
6
votes
1 answer

Insertion of an data in an XML using Basex

I am storing two XML documents, namely hospital and office, in BaseX. The following is the office xml: 666-66-6666
Sadesh Kumar N
  • 1,962
  • 7
  • 19
  • 26
6
votes
1 answer

xquery insert node from external xs:string variable (basex)

I am attempting to insert new elements into an xml document using BaseX. declare variable $part external; insert nodes $part as first into db:open("PARTDB")/assembly[@name="ZB09010"] I am using the BaseX GUI for my testing and have defined the…
mikee
  • 335
  • 3
  • 11
6
votes
2 answers

Should cast of xs:double to xs:decimal be implemented as BigDecimal.valueOf(double) or new BigDecimal(double)?

XQuery, shared with XSLT and XPath 2.0 and later, supports various number data types, two of them are xs:double and xs:decimal. It is possible to cast an xs:double to an xs:decimal, as defined in…
Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
6
votes
2 answers

Reading Multiple XML Files with BaseX

Hi I am new to BaseX and I am trying to read a bunch of XML files from a folder. After reading those files I will output the data into the database table (some RDBMS). But I am lost as to where to start as I am not able to find much tutorials about…
user1188611
  • 945
  • 2
  • 14
  • 38
5
votes
2 answers

Querying XML files using BaseX

I am using BaseX native XML database to query XML files. I am using the BaseXClient.java file provided in the BaseX documentation. I am starting the basex server and connecting to server using BaseXClient.java. // create session final BaseXClient…
Anup Warnulkar
  • 773
  • 1
  • 8
  • 25
5
votes
2 answers

Benchmarking in BaseX: how to set up

Currently I am an intern at a research group that makes large sets of texts (corpora) searchable. Not only can one search for literal strings, but more importantly it is also possible to look for similar syntactical dependency structures as the…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
5
votes
3 answers

Refer to a specific document in a BaseX DB using XQuery

If I add two documents to a BaseX DB, let's say normal.xml and normal2.xml, is there a way to refer to each one individually? I know about the doc() function, but it looks at the filesystem for their location, rather than in the database itself. For…
Ryan Lewis
  • 365
  • 6
  • 15
5
votes
3 answers

Remove duplicates from return XQuery

My XQuery is: declare namespace xsd="http://www.w3.org/2001/XMLSchema"; for $schema in xsd:schema for $nodes in $schema//*, $attr in $nodes/xsd:element/@name where fn:contains($attr,'city') return $attr return: name="city" name="city"…
Peter Fašianok
  • 153
  • 1
  • 1
  • 8
5
votes
1 answer

BaseX: where to declare the XML document on which to perform a query

With the program BaseX I was able to use XPath and XQuery in order to query an XML document located at my home directory, but I have a problem with doing the same in XSLT. The document I'm querying is BookstoreQ.xml. XPath version, running totally…
4
votes
1 answer

XQuery: look for node with descendants in a certain order

I have an XML file that represents the syntax trees of all the sentences in a book: I
sheesania
  • 237
  • 3
  • 8
4
votes
1 answer

XQuery Update: insert or replace depending if node exists not possible?

I am trying to build simple XML database (inside BaseX or eXist-db), but I have trouble figuring how to modify values in document : content is simple as this for test :

6>

I am trying to build something…
PetrV
  • 1,368
  • 2
  • 15
  • 30
4
votes
1 answer

Most effective and efficient way to store tree with co-indexed nodes in XML

I am picking up an older project of mine where effectiveness and efficiency are key. I have 100's of GB of XML data that I parse. For each XML tree (millions of them) some XML attributes are used from which patterns are deducted. For this question,…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
1
2 3
32 33