shashi prakash
shashi prakash

Reputation: 71

Marklogic Linking/Modelling Documents

I am trying to model my documents in MarkLogic.The data I am talking here are reference data.

e.g. I have two sets of data say "LOB" and "SUBLOB". I can have multiple data elements in LOB and same is the case with SUBLOB. Also there is going to be relationship between LOB and SUBLOB, like for LOB 1 these are 4 sublobs.

I am thinking to have each LOB data put in separate document and create LOB collection. same for SUBLOB. Not sure if this is the good way or all LOB data should be put in one document and sublob in another. I see putting them in separate will help me in update.

Another problem is how to link and then eventually query them? Can I link using some key or semantics are the way to go?

Upvotes: 2

Views: 100

Answers (1)

In MarkLogic, you should think of each record as a document on it's own. Understanding fragments and unfiltered queries goes a long way to helping you see why.

For relating documents, yes, think of some element to relate them (like a foreign key in a relational database. Specifically in MarkLogic, if you build these elements with large integers and put the right range index on it, then some super fast joins (essentially done as set notation against in-memory indexes) occur.

Lastly, do not be afraid of denormalized data as part of your possible modelling exercise.

So, I could pick apart all of your question and hand you 5-10 links to give you specific guidance to the points you raise. However, I think it is better that you take a step back and gather some information ahead of trying to make a decision on data modelling. For this, here is a single link that should be of value for you:

http://info.marklogic.com/nosql-for-dummies.html

It is the noSQl for Dummies Book. Yes, it is published by MarkLogic. However, much of the information is generic by design. For you, I think Chapter 2 will be an absolute benefit.

Upvotes: 4

Related Questions