Hi Harry,
When I tried this, I could only get it to work wrapping
an extra cts:search in there:
cts:search(/document-a,
cts:element-value-query(xs:QName("filename"),
cts:search(/document-b,
cts:element-value-query(xs:QName("workflow-status"), "pending",
"exact"))/filename,
"exact")
)
I'm using an old version (4.2). Is
your syntax a feature of the newer versions? Is it just syntactically
different?
Thanks,
Gidi
Harry B. schreef op 2013-04-04 17:13:
>
The most common way to do a join will be to create a cts query construct
like this:
>
> If my documents were like this-
>
> <document-a>
>
<filename>3223235432.jpg</filename>
> <title>This is a simple
example</title>
> <caption>whatever other data can be in the doc, but
we will use filename as the key</caption>
> </document-a>
>
>
<document-b>
> <filename>3223235432.jpg</filename>
>
<workflow-status>pending</workflow-status>
> <comment>Needs approval
from Mr. Brown</comment>
> </document-b>
>
> I could join my metadata
in document-a to workflow-status in document-b with this query
construct-
>
>
cts:search(/document-a,cts:element-value-query(xs:QName("filename"),cts:element-value-query(xs:QName("workflow-status"),"pending","exact")/filename,"exact"))
>
> To make this easier to read/explain, here it is with line breaks
and spaces to show the query...
>
> cts:search(/document-a,
>
cts:element-value-query(xs:QName("filename"),
>
cts:element-value-query(xs:QName("workflow-status"),"pending","exact")/filename,
> "exact")
> )
>
> As you can see, I have a query construct with an
XPath
CTS:ELEMENT-VALUE-QUERY(XS:QNAME("WORKFLOW-STATUS"),"PENDING","EXACT")/FILENAME
inside another query as the search term for it.
>
> On Thu, Apr 4,
2013 at 7:32 AM, Sudhir Bisht <[email protected]> wrote:
>
>> Hi
All,
>>
>> This is my first mail in the group and am new to MarkLogic
as well.
>>
>> I want to run an xquery code which joins two relational
tables.
>> Both these tables have got a column of XMLType data but they
are joined on the basis of a non relational column i.e. using PK-FK
relation.
>> So using Xquery alone I can save the XMLType data as an
XMLFile and then query it.
>> But how do I work on this PK-FK thing
now.
>>
>> - Do I need to add these in XML files only.
>> Or
>> -
Use something like suggested in - "SQL Data Modelling Guide of MarkLogic
" through ODBC server.
>>
>> Thanks..
>>
_______________________________________________
>> General mailing
list
>> [email protected]
>>
http://developer.marklogic.com/mailman/listinfo/general [1]
>
>
_______________________________________________
> General mailing list
>
[email protected]
>
http://developer.marklogic.com/mailman/listinfo/general [1]
Links:
------
[1]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general