jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: Multi-Value properties of type REFERENCE
Date Thu, 15 Nov 2007 13:45:01 GMT
On Nov 13, 2007 4:40 PM, Brian Thompson <elephantium@gmail.com> wrote:
> Could you explain more about the data you need to model and why the MODEL,
> MCODE, and TOPIC types have the relationships you described?  In my
> experience, it's usually not necessary to use a lot of references in a
> repository.  If you're used to modeling things in a DB, it's natural to look
> at references to link nodes, but most use-cases are pretty well handled by a
> good node structure.

i absolutely agree with brian.

>
> As for using multi-valued REFERENCE properties, I think you could do that in
> the same way as you'd use any other multi-valued property.  Just construct
> an array of Value objects holding the REFERENCES and pass that into
> setProperty().

that's correct. heres's an example (using String[] instead):

            // creating references
            Node target1 = ...;
            Node target2 = ...;
            Property refs = node.setProperty("refs", new
String[]{target1.getUUID(), target2.getUUID()},
PropertyType.REFERENCE);
            session.save();

            // dereferencing
            ...
            Value[] values = refs.getValues();
            for (int i = 0; i < values.length; i++) {
                Node target = session.getNodeByUUID(values[i].getString());
               ...
            }


cheers
stefan

>
> I haven't actually tried this, so there might be a problem I don't
> foresee...I'm sure more knowledgeable members of the community will chime in
> shortly :)
>
> -Brian
>
>
>
>
>
> On Nov 13, 2007 9:02 AM, Kisu San <Kishore.san@gmail.com> wrote:
>
> >
> > Dear All,
> >
> > I want to implement many to many relationship between nodes.  I have the
> > following scenario
> >
> > I have three nodes MODEL, MCODE, TOPIC.
> >
> > relation between MCODE and TOPIC are many to many. A MCODE 'P1202' can
> > have
> > relationship to TOPIC 'RX003' and 'RX0054'. TOPIC 'RX0054' can have
> > relationship with MCODE 'P1202' and 'P1206'
> >
> > In this case, I have property called tpCode on TOPIC node, which I want to
> > REFER to MCODE nodes  'P1202' and 'P1206'.
> >
> > Would this be possible in Jackrabbit?
> >
> > Does Jackrabbit support Multi-value properties of type Reference?
> >
> > If yes, how can I implement this? If no, what is the work around for this?
> >
> > Thanks in advance
> > -Kishore
> >
> >
> >
>

Mime
View raw message