2.2 Adding and Deleting Documents

MonetDB/XQuery comes with an Administrative GUI (see The Administrative GUI) that allows to add and delete single documents at a time by point-and-click with a mouse.

Adding and deleting documents also can be done using XQuery queries. As the XQuery standard does not specify anything about this, we added the following extension functions:

  • pf:add-doc($url as xs:string, $alias as xs:string)
  • pf:add-doc($url as xs:string, $alias as xs:string, $coll as xs:string)
  • pf:add-doc($url as xs:string, $alias as xs:string, $coll as xs:string, $perc as xs:integer)
  • pf:del-doc($name as xs:string)

For an easy walk-through of the built-in extension functions (see Document Management Functions), we refer to the Document Management Tutorial. There is also a Administrative GUI Tutorial.

If you must add many (tens, hundreds, thousands..) of documents in one go, please read the instructions in the Performance Tips section (see Bulk Loading a Collection).

The query the database contents (i.e. the catalog: which collections and documents exist?) is also done in XQuery:

  • pf:documents() as node()
  • pf:collections($coll as xs:string) as node()
  • pf:collections($name as xs:string) as node()

These built-in extension functions are called Metadata Functions (see Metadata Functions).