David, that approach works as long as your directory has a corresponding directory fragment (either with directory-creation=automatic or with manually-created directories). But it's also possible - and fairly common - to use xdmp:directory() without having any directory fragments (directory-creation=manual). Most large database applications set directory-creation=manual for efficiency reasons. So any general-purpose code should be written to work for both cases.
You might think of these as explicit vs implicit directories. A webdav client will only see explicit directories: it needs the directory fragment for locking purposes. But any database query can make use of implicit directories. For most purposes I would use lock-free code to check for a directory uri: xdmp:exists(xdmp:directory($uri, 'infinity')) -- Mike On 2010-08-31 07:38, Lee, David wrote: > I'm not sure what a "tenant database" is, but if you want to query if a > directory exists, you can use this code > (copied from the MarkLogic extension to xmlsh, command "direxists" > www.xmlsh.org) > > > > declare variable $uri external ; > exists(xdmp:document-properties($uri)//prop:directory) > > > > > From: [email protected] > [mailto:[email protected]] On Behalf Of Vishnu Raaj > Sent: Tuesday, August 31, 2010 3:11 AM > To: [email protected] > Subject: [MarkLogic Dev General] Query on directories > > Hi All, > > I’m new to MarkLogic. > > Is there any way to check whether a tenant database exists in a MarkLogic > database? > > As per my understanding, MarkLogic treats tenant db as directory. Currently > there are only functions for CreateDirectory and DeleteDirecotory. I would > like to know is there any facility to check whether a directory exists. > > Please help. > > Regards, > VishnuRaaj R|Senior Engineer : Microsoft-Global Practices|MindTree Ltd.|TP > 2/2, Ascendas Mahindra IT Park, Mahindra World City - SEZ, Natham Sub Post, > Chengalpet, Chennai - 603002, INDIA|Voice +91 44 67497150 / Mobile +91 > 9994109328|email: > [email protected]<mailto:[email protected]>|www.mindtree.com<http://www.mindtree.com/>| > > [cid:[email protected]] Save a tree > > > ________________________________ > http://www.mindtree.com/email/disclaimer.html > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
