Hi Nunny,
Nunny wrote: > > Hi, > > On 3/24/07, Brian Thompson <[EMAIL PROTECTED]> wrote: >> >> Comments interleaved below: >> >> Oh, one other thing: In your model, do you ever expect the same image >> to be attached to multiple BlogEntries? > > > Nope, Same image will not be attached to multiple Blog Entires. But if it > is the case, as I understood I should use property of reference type in > the > blog entry which references to a image attachment. Is that the way to > handle > it ? > > >> I went through the Node Type sections of the Jackrabbit site and also >> 6.7Node Types of the JSR 170 specification. As I understood, > > A node type defines the Child nodes and properties it may ( or must ) > have. > > Primary node type must be subtype of either primary or a mixin type and > mixin type may have a super type and it is not a must. > > I have few questions and some of them may be obsolete. But I listed them > down as it is always better have a discussion and get things clarified. > > 1.) In naming node types and properties, do we follow the naming > conventions > used in Java ? > Eg. myFristType > > IMO, Yes. It's better to follow it. > > 2.) What is purpose mixin node type ? Purpose of primary node is to > define > the structure of the node as I understood. What is the advantage of adding > some properties or child nodes via mixin types to a node ? > > I think primary and mixin in JCR are much like class and interface in > Java. > Node must have ONE primary type: Class can only extend one class > Node can have many mixin types: Class can implements many interfaces > In one word, interface provides a function ability, same as mixin and > think > mixin as the interface. You should only define functional properties and > child nodes to mixin > ,for example: uuid to mix:referenceable. uuid is a must property to > achieve that reference ability/funciton > ,so define uuid in the mixin, while cotent (for example) property is > irrelated to that, keep it out of the mixin. > I think you should treat them as you treat class and interface in Java. > Think about when should extend a class > and when should implement an interface and when use interface instead of > extending a class. > > 3.) What is the purpose of primary item of a node type? > IMO, just for the convenient mehtod, it privodes a way to get the primary > item without knowing its name. > > 4.) In a property definition, in Required Type, what does NAME, PATH types > mean ? > > 5.) Is int supported as a property type ? It is not listed under the > property_type in the grammer. > Use long instead of int > > 6.) How to we constraint a property of a node to be unique ( like a > primary > key in RDBMS ) ? > No way. Make your unique entity as a referenceable node A, then make a > node B a property C with reference type, C stores the A's uuid. So you > can get it: Node B -- > > |__C -----> Node A > Thus node B only points to one unique Node A > > > > As you proposed, if we change the hierarchy like this, > > - Users > - Year > - Month > > - Date > > - Blog Entry > > - Comment > > - Rate > > - Image Attachment > > > > In CND notation, > > <blog = 'http://jackrabbit.apache.org/jackrabbit-jcr-demo/1.0'> > > <mix = 'http://www.jcp.org/jcr/mix/1.0'> > > [blog:user] > mix:referenceable > > - blog:userID (long) mandatory > > - blog:nickName (string) mandatory > > - blog:email (string) mandatory > > - blog:password (string) mandatory > > + blog:year [blog:year] multiple > > > [blog:year] > > - blog:year (long) mandatory > > + blog:month [blog:month] multiple > > > [blog:date] > > - blog:date (date) > > + blog:blogEntry [blog:blogEntry] multiple > > > [blog:blogEntry] > > - blog:blogEntryID (long) mandatory > > - blog:content (string) mandatory > > - blog:image (binay) multiple > > - blog:rate (long) > > - blog:dateCreated (date) mandatory > > + blog:comment [blog:comment] multiple > > > > [blog:comment] > > - blog:commentID (long) mandatory > > - commenterID (reference) mandatory < blog:user > > - blog:content (string) mandatory > > - blog:dateCreated (date) mandatory > > -- View this message in context: http://www.nabble.com/How-to-start-thinking-in-JCR-tf3452522.html#a9687041 Sent from the Jackrabbit - Users mailing list archive at Nabble.com.