Babu,
URIs uniquely identify documents in a database, similar to a primary key in a 
relational database table. I’m not sure about your use case, but, like Mike 
outlined, I’d suggest creating the user document XCCDemo/user1 and the 
associated image at XCCDemo/user1/image. There are various ways you can 
associate the image with the related users. You could put both of those 
documents in the same collection (user1) or directory (as Mike indicates 
below). You could also put a reference to the image URI in the user1 XML 
document. If you could provide more details on what you’re trying to do, 
someone on the list might be able to give you some more specific advice. 

Justin



On Oct 26, 2011, at 9:05 AM, Babu Moshay wrote:

> Hi Michael/All,
> 
> I have managed to get XCC/Java samples working. Objective initially is to 
> insert two documents i.e. one xml and one image at common uri e.g. 
> XCCDemo/user1/ .
> 
> I tried following:
> Loop for 2 files:
>  contents[i] = ContentFactory.newContent(uris[i], files[i], options);
> 
> then,
> Session.insertContent(Content[])
> 
> But this overwrites the previous file and retains the last written file.
> 
> Which API would help achieving this? 
> 
> 
> Thanks
> BM
> 
> ----- Original Message -----
> From: Michael Blakeley <m...@blakeley.com>
> To: General MarkLogic Developer Discussion <general@developer.marklogic.com>
> Sent: Mon, 24 Oct 2011 21:46:53 +0530 (IST)
> Subject: Re: [MarkLogic Dev General] XML content and binary file needs to be 
> joined and rendered on web page..
> 
> You have a problem with that requirement "not to use XQuery". That's sort of 
> like saying "don't use SQL" with an RDBMS. Sure, you can encapsulate it so 
> that you cannot see it from your Java code - but it's still there. The XCC 
> connector doesn't write XQuery for you.
> 
> Thinking in terms of low-level RDBMS tools like foreign keys and tables won't 
> get you very far. Back up. Start from the use cases instead, and do some 
> top-down work. Think about per-user documents and directories. For example, 
> you might model each user as a URI prefix ('/user/' + USERID + '/') and store 
> each user's XML in a well-known URI with that prefix. Multiple XML or BLOB 
> documents might also share that prefix. You could then use xdmp:directory() 
> to query all of a user's documents, or doc() to retrieve a specific document. 
> I don't know if that really suits your use-cases, but it might.
> 
> Keep in mind that the XML data model does not provide for binary nodes: those 
> are a MarkLogic extension, and they are allowed only as root nodes. You can 
> store and retrieve both types of nodes in one update or query, though, so you 
> should be able to implement your use cases. You can probably implement 
> inserts without using XQuery, but you will have to write some XQuery to query 
> the database. That's what it's for.
> 
> -- Mike
> 
> On 24 Oct 2011, at 08:05 , Babu Moshay wrote:
> 
>> Dear all,
>> I am new to Marklogic setup as well as NoSQL way of doing things..I have a 
>> use-case which would have been very straightforward to implement in J2EE 
>> patterns using RDBMS but now that I am expected to evaluate MarkLogic I 
>> wonder if this mailing list can help me out with it....
>> 
>> I have looked through the documentation PDFs but haven't been able to figure 
>> out what exactly needs to be done to get going...
>> 
>> I have 2 tables...1 user details e.g. name of the user, contact etc 
>> etc..plus it has a BLOB which stores his picture...then there is another 
>> table which stores user's published articles(all BLOBs) which has userId as 
>> foreign key referencing user table's primary key..
>> 
>> I take input from frontend which accepts all these inputs from HTML form and 
>> create necessary entries in database..
>> 
>> I am told not to use XQuery ..Just use XCC/Java connector and see if that 
>> works...
>> I am looking for a tutorial or precise peace of document which discusses 
>> these activities...
>> 
>> I can store XML content....agreed..
>> I can store Binary content....agreed.
>> 
>> Can I write something which joins XML and Binary together and forms a single 
>> unit while reading/writing from Marklogic?
>> 
>> 
>> 
>> Thanks and regards,
>> BM
>> 
>> _______________________________________________
>> General mailing list
>> General@developer.marklogic.com
>> http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general

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

Reply via email to