Changes

Jump to navigation Jump to search
21 bytes added ,  11:44, 28 February 2017
no edit summary
This page is part of the [[Getting Started]] Section.
In BaseX, a ''database'' is a pretty light-weight concept and can be comparedto a ''collection''. It contains an arbitrary number of '''resources''',which are addressed by their a unique database path. There is no explicit layer for collections. Instead, collections are implicitly created and deleted once you add and remove resources to a database. Resources can either be'''XML documents''' or '''raw files''' (binaries).Some information on [[Binary Data|binary data]] can be found on an extra page.
=Create Databases=
New databases can be created via commands, via XQuery, in the GUI, or with any of our[[Developing|APIs]]. If some initial input is specified along with the create operation, some time can be saved, as it will be added to the database in a bulk operation:
* [[Startup#BaseX Standalone|Console]]: <code>CREATE DB db /path/to/resources</code> will add initial documents to a database
* [[Startup#BaseX GUI|GUI]]: Go to ''Database'' → ''New'', press ''Browse'' to choose an initial file or directory, and press ''OK''
Database must follow the [[Valid Names|valid names constraints]].Various [[parsers]] can be chosen to influence the database creation, or to convert different formats to XML.
'''Note:''' A main-memory only database can will be created using if the the <code>SET {{Option|MAINMEM true</code> command before calling <code>CREATE DB</code> }} option is enabled ([[Databases#In Memory Database|see below]] for more).
=Access Resources=
* WebDAV: Locate the database directory (or a sub-directory of it) and copy all contents to another location
=In Main-Memory DatabaseInstances=
* In the standalone context, a main-memory database can be created (using <code>CREATE DB</code>), which can then be accessed by subsequent commands.
* You can force an ordinary database to being copied to memory by using <code>db:open('some-db') update {}</code>
'''Note:''' main-memory database instances are also created by the invocation of If you address a URI with <code>fn:doc(...)</code> or <code>fn:collection(...)</code>for which no database exists, if the argument resulting internal representation is not aidentical to those of main-memory database instances (no matter which value is set for {{Option|MAINMEM}}). In other words:the same internal representation is used for main-memory databases anddocuments/collections generated via XQuery.
=Changelog=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu