Database Reference
In-Depth Information
metadata
Description
Document key/value metadata functions
Namespace
md="http://exist-db.org/metadata"
Type/default status
Java; enabled in
$EXIST_HOME/conf.xml
; enabled in
$EXIST_HOME/extensions/
build.properties
Class
org.exist.storage.md.xquery.MetadataModule
This module incudes functions for associating key/value metadata pairs with a docu‐
ment, rerieving key/value pairs associated with documents, and searching for docu‐
ments based on key/value pairs.
While useful, the
metadata
module should be considered highly
experimental and not yet ready for production use.
For example, say you wish to store a key/value pair of metadata for the docu‐
ment
/db/my-docs/doc1.xml
. You can do this as follows:
xquery
version
"1.0"
;
import
module
namespace
md
=
"http://exist-db.org/metadata"
;
md:set-value
(
doc
(
"/db/my-docs/doc1.xml"
),
"roll-number"
,
12345
)
Each time you set a metadata key/value pair, you are also returned a UUID (univer‐
sally unique identifier) that represents the intersection of
document
,
key
, and
value
.
You can find all of the metadata keys set for a document like so:
xquery
version
"1.0"
;
import
module
namespace
md
=
"http://exist-db.org/metadata"
;
md:keys
(
doc
(
"/db/my-docs/doc1.xml"
))
And you can retrieve the document(s) with the metadata key
roll-number
and the
value
12345
like this:
Search WWH ::
Custom Search