Another approach to this is to enable the uri lexicon, then do a bunch
of string maniputation on the URIs (using cts:uris and a bunch of string
functions) to get a listing of the documents and directories.  This can
make it so you do not need to grab all of the fragments in order to get
their URIs.

-Danny

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of McBeath,
Darin W (ELS-STL)
Sent: Thursday, March 26, 2009 5:24 AM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] Finding subdirs in a database
directory?

Actually, you will get a 'properties' back whether it is a directory or
a document within the directory.  So, you need to be a bit careful. For
my situation, my documents are always at the leaf nodes so I can make
some assumptions about whether the values returned are for directories
or for documents contained in a directory.  There might be a function
you can call on the 'properties' document to test whether it is for a
directory or an actual document. 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Geert
Josten
Sent: Thursday, March 26, 2009 8:07 AM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] Finding subdirs in a database
directory?

Great!

The description of the function had put me on the wrong foot. It is
talking about properties of **documents**:

>>>
xdmp:directory-properties(  
 $uri as xs:string,  
 [$depth as xs:string]  
)  as  document-node()* 

Summary: 

Returns a sequence of properties documents, one for each **document** in
the specified directory that has a corresponding properties document. 
<<<

Perhaps the documentation should be updated..

Kind regards,
Geert

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> McBeath, Darin W (ELS-STL)
> Sent: donderdag 26 maart 2009 12:57
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] Finding subdirs in a 
> database directory?
> 
> To get the 'immediate' directories, you can do something like the
> following:
> 
> for $x in xdmp:directory-properties('/content/', '1') return 
> base-uri($x)
> 
> What will be returned will include the '/content/' bit as 
> well but you can easily strip that out.  I also extensively 
> use directories (very helpful when using WebDav as well as 
> scoping search requests) and have used the approach above 
> many times.  There is likely a better way but this serves my purposes.
> 
> Darin.
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of 
> Geert Josten
> Sent: Thursday, March 26, 2009 7:09 AM
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] Finding subdirs in a 
> database directory?
> 
> Hi,
> 
> I am using the directory facilities of MarkLogic Server to 
> store documents with hierarchy. This works nice and all, 
> allowing scoping search actions to subtrees very easily. But 
> it would be nice to be able to provide some kind of directory 
> listing as well. It is very easy to determin which documents 
> exist in a subtree, but (as far as I know) there is no easy 
> way to determin the subdirectories themselves of a certain directory.
> 
> I am looking for something like xdmp:filesystem-directory, 
> though not working on the filesystem, but on a MarkLogic 
> Database itself. Does anyone know of some trick to do this?
> 
> Kind regards,
> Geert
> 
> 
> Drs. G.P.H. Josten
> Consultant
> 
> 
> http://www.daidalos.nl/
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> Tel.: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> http://www.daidalos.nl/
> KvK 27164984
> De informatie - verzonden in of met dit emailbericht - is 
> afkomstig van Daidalos BV en is uitsluitend bestemd voor de 
> geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, 
> verzoeken wij u het te verwijderen. Aan dit bericht kunnen 
> geen rechten worden ontleend.
> 
> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to