> Possibly add signatures to allow removing a previously set property:
>
> db:set-property($db as xs:string, $path as xs:string, $key as xs:string)
as empty-sequence()
> PROP SET [path] [key]

Thanks, I missed that! An empty string, or an empty sequence would be an
alternative:


db:set-property($db
, "file.xml", "version", ()
)

> Allowing arbitrary strings as keys is definitely helpful.

I see advantages and drawbacks for both approaches. Maybe it is also
sufficient to restrict the character set of keys to those of element names
(i.e., NCNames)?

> Thinking of possible use cases, one might use something like the below
example to find all documents with a specific property value:
>
> for $a in db:properties('testdb')[properties/property[@name =
'prop1'][string() = 'value1']
> return if (db:is-xml('testdb', $a/@resource)) then db:open('testdb',
$a/@resource) else ()

Right. Here's one (of many) more way(s) to put it:

  let $db := 'testdb'
  let $path := db:properties($db)[prop1 = 'value1']/@resource[db:is-xml($db,
.)]
  return db:open('testdb', $path)

C.

Reply via email to