[MarkLogic Dev General] Inner join
Gaya Rac
modulusinc at gmail.com
Wed Mar 31 07:53:47 PST 2010
The XML fragment is part of larger file.
Database 1 holds sample XML files like below:
<document coll="coll1">
<subdoc coll="coll1">
<grp1>
<doc_key doc_key_context="a">2004120487</doc_key>
<doc_key doc_key_context="b">20487</doc_key>
</grp1>
<grp2>
...
</grp2>
</subdoc>
</document>
Database 2 holds sample XML files like below:
<document coll="coll2">
<subdoc coll="coll2">
<grp1>
<doc_key doc_key_context="a">2004120487</doc_key>
<doc_key doc_key_context="b">20487</doc_key>
</grp1>
<grp3>
...
</grp3>
</subdoc>
</document>
The join should happen on <doc_key doc_key_context="a">2004120487</doc_key>
I'll also look into holding all the XML docs in one database and logically
separate them.
Thanks, Gaya
On Wed, Mar 31, 2010 at 11:35 AM, Geert Josten <Geert.Josten at daidalos.nl>wrote:
> Hi Gaya,
>
> I am a bit confused by your XML fragment. It not well-formed XML. The
> decimal number, is that an attribute name, attribute value or the value of
> the element itself? And is each <doc_key> element stored as a separate
> document or are they part of one large file?
>
> Next to this, it is less optimal to access across databases. You will need
> an xdmp:eval with database-id option to retrieve documents from one database
> to compare them with documents from another. It is better to put all
> documents in one database and logically separate them by putting them in a
> separate directory or collection..
>
> Kind regards,
> Geert
>
> >
>
>
> drs. G.P.H. (Geert) Josten
> Consultant
>
>
> Daidalos BV
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
>
> T +31 (0)10 850 1200
> F +31 (0)10 850 1199
>
> mailto:geert.josten at daidalos.nl
> http://www.daidalos.nl/
>
> KvK 27164984
>
> P Please consider the environment before printing this mail.
> De informatie - verzonden in of met dit e-mailbericht - is afkomstig van
> Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
> bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan
> dit bericht kunnen geen rechten worden ontleend.
>
> > From: general-bounces at developer.marklogic.com
> > [mailto:general-bounces at developer.marklogic.com] On Behalf Of Gaya Rac
> > Sent: woensdag 31 maart 2010 16:32
> > To: General Mark Logic Developer Discussion
> > Subject: Re: [MarkLogic Dev General] Inner join
> >
> > Thanks Lee.
> > If we want to find matching records from all the XMLs in
> > database: DB1 with all the XMLs in database: DB2, then we
> > need to access DB2 from DB1 and then perform the join right?
> >
> > Also the doc_key element, has an attribute field
> > doc_key_context and we want to find matching records based on
> > <doc_key doc_key_context="a" 20021234>
> >
> >
> > On Wed, Mar 31, 2010 at 10:17 AM, Lee, David
> > <dlee at epocrates.com> wrote:
> >
> >
> > for $a = doc("DB1.xml")//doc_key
> >
> > for $b = doc("DB2.xml")//doc_key
> >
> > where $a/doc_key_context eq $b/doc_key_context
> >
> > return ..
> >
> >
> >
> > From: general-bounces at developer.marklogic.com
> > [mailto:general-bounces at developer.marklogic.com] On Behalf Of Gaya Rac
> > Sent: Tuesday, March 30, 2010 12:07 PM
> > To: general at developer.marklogic.com
> > Subject: [MarkLogic Dev General] Inner join
> >
> >
> >
> > Hi,
> >
> > Is there a way to perform joins on Mark logic databases?
> >
> > I've a database:DB1 which has key field
> > <doc_key doc_key_context="a" 20021234>
> > <doc_key doc_key_context="b" 1234>
> >
> > I've a second database:DB2 which has same key field
> > <doc_key doc_key_context="a" 20021234>
> > <doc_key doc_key_context="b" 1234>
> >
> > How can I return all the matching documents from DB1, DB2.
> >
> > Thanks, Gayathri
> >
> >
> > _______________________________________________
> > General mailing list
> > General at developer.marklogic.com
> > http://xqzone.com/mailman/listinfo/general
> >
> >
> >
> >
> >
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20100331/1aa04fbf/attachment.html
More information about the General
mailing list