XQuery/Loading data

From Wikibooks, open books for an open world
Jump to: navigation, search

Motivation[edit]

You want to load your data into a native XML database.

Methods[edit]

There are several methods available. The one you use depends on the number of files you want to load and the loading rules.

Use the web browser user interface[edit]

  1. ideal for a quick single file upload

Use a IDE tool such as oXygen[edit]

  1. just right click on any collection and select "Import file" or "Import Folders"


Use a WebDAV client[edit]

  1. ideal for bulk loads
  2. also allows you to move, copy and rename collections and files
  3. some IDE's like oXygen also have a WebDAV client built-in

Accessed through the http://localhost:8080/exist/webdav/db URL

List of WebDAV clients

  1. Builtin MAC WebDAV client
  2. Transmit for the MAC
  3. Windows WebDAV client

eXist WebDAV documentation http://www.exist-db.org/exist/apps/doc/webdav.xml

Use the Java client[edit]

  1. the client has a tool to add files as well as to restore a backup

Use an XQuery program[edit]

Use the http client GET to get a remote XML file and store it in the database

  1. Use HTTP Get
  2. Use the ft-client (FTP, SFTP etc.)

Use an Apache Ant script[edit]

Many native XML databases have a set of Apache Ant scripts for doing things such as:

  1. bulk loading data
  2. creating collections
  3. setting permissions
  4. executing an XQuery
  5. running a backup
  6. restoring a backup file

These are usually the consistent and allow filtering of files as you load.

A sample ant "loader" is listed here: http://en.wikibooks.org/wiki/Apache_Ant/Store_XML_data

Note that some XQuery scripts that are loaded into the database collections may require post-installations steps to make them executable by some users.

References[edit]

eXist documentation page on uploading files: http://exist-db.org/exist/apps/doc/uploading-files.xml