Hi Kendall,
One popular approach is to maintain an additional metadata.xml
document, which contains all metadata for the documents stored in a
database. Here is a simple example for maintaining a timestamp:
* Creation:
db:create('db', , 'metadata.xml')
* Insertion:
let $path := 'new-doc.xml'
let $doc :=
let $meta := element doc {
attribute path { $path },
element timestamp { current-dateTime() }
}
return (
db:add('db', $doc, $path),
insert node $meta into db:open('db', 'metadata.xml')/meta
)
* Retrieval:
let $path := 'new-doc.xml'
return db:open('db', 'metadata.xml')/meta/doc[@path = $path]
* Deletion:
let $path := 'new-doc.xml'
return (
db:delete('db', $path),
delete node db:open('db', 'metadata.xml')/meta/doc[@path = $path]
)
Cheers,
Christian
On Sat, Feb 13, 2016 at 8:28 PM, Kendall Shaw wrote:
> Unless there is now a standard way to associate metadata with documents and
> collections, is there a preferred method?
>
> I could try to ensure that there is always a unique id that can be derived
> from combination of an id attribute or element in the document + the
> document’s document uri, then have separate metadata documents that are
> associated with the unique id. Is there an obviously better approach?
>
> Kendall