I moved the suggestion to an extra GitHub issue:

  https://github.com/BaseXdb/basex/issues/988

Edits are welcome,
Christian


On Wed, Sep 3, 2014 at 8:53 PM, Christian Grün
<[email protected]> wrote:
>> 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