Try this:

    Request request = session.newAdhocQuery(" 
collection('imageCollection')/document-uri() ");



----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
d...@epocrates.com<mailto:d...@epocrates.com>
812-482-5224

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Amar Wakkar
Sent: Monday, November 14, 2011 9:27 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Retrieving file name/document URI of binary 
content

Dear all,

I am learning ways of doing things in Marklogic server. I have managed to save 
a collection to Marklogic server which consists of few .gif images. The 
document URI's are the actual file names when I stored them in collection e.g. 
image1, image2 etc..The collection is named "imageCollection". I can query for 
"imageCollection" and it does return 3 images in result set. Unfortunately, I 
am unable to figure out how to get "file name" or Document URI of these images ?


            createOptions = ContentCreateOptions.newBinaryInstance();
            createOptions.setCollections(new String[]{"imageCollection"});

            createOptions.setFormatBinary();

            content = 
ContentFactory.newContent(someContent.getAttachmentsFileNames()[i], 
someContent.getAttachments()[i], createOptions);
            System.out.println("Inserting contents..");
            session.insertContent(content);


The call to

    Request request = session.newAdhocQuery(" collection(\"imageCollection\") 
");

            ResultSequence rs = session.submitRequest(request);

while(rs.hasNext()){
                        System.out.println("Inside contentDao 44444444");

                        ResultItem item = rs.next();


Following call returns null
       System.out.println(item.getDocumentURI());

Please help me understand how to get the file names of the images so that I can 
use them to render back on screen.


Thanks
Amaresh Wakkar


_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to