I have a query works on one structure but not on another set of structure, I 
couldn't see the clue,

for the working one:  our data is like in the following structure
<article>...<coden></coden><volume></volume><issue></issue><paper></paper>...</article>

the following are examples of the data, each tag <article> means one xml in 
marklogic:

article 1:  
<article>...<coden>AAA</coden><volume>1</volume><issue>1</issue><paper>123</paper>....</article>
article 2: 
<article>....<coden>AAA</coden><volume>1</volume><issue>2</issue><paper>233</paper>....</article>
..

I want to get issue list for the coden and volume, so I use the query

cts:element-values(fn:QName("ns1","issue"),(),  
("collation=http://marklogic.com/collation/en/MO";, "descending"), 
                               cts:and-query((
                               cts:element-range-query(fn:QName("ns1","coden"), 
"=", "AAA",   "collation=http://marklogic.com/collation/en/MO";),
                               
cts:element-range-query(fn:QName("ns1","volume"), "=", "1",   
"collation=http://marklogic.com/collation/en/MO";) 
                                            ))                                  
  )

this one works very good, and it gives me the correct issue list for different 
coden/volume.

------- for the not working one:
I have another situation that I want to use query similar with the above one:
I have xml file structure like : <jps xmlns="nsjps"> <coden></coden> 
<volume></volume> <publication_year></publication_year></jps>

the following every line is one xml file
..
<jps xmlns="nsjps"> <coden>AAA</coden> <volume>12</volume> 
<publication_year>1968</publication_year></jps>
<jps xmlns="nsjps"> <coden>AAA</coden> <volume>11</volume> 
<publication_year>1967</publication_year></jps>
<jps xmlns="nsjps"> <coden>AAA</coden> <volume>10</volume> 
<publication_year>1966</publication_year></jps>
<jps xmlns="nsjps"> <coden>AAB</coden> <volume>15</volume> 
<publication_year>1978</publication_year></jps>
..

here every coden and volume should have unique value as publication_year. I 
thought if I use the following query for coden=AAA and volume=12, I should get 
only 1968 as return, but I got all the values for all the publication_year for 
coden=AAA and volume=12, which is 1968, 1967, 1966...

cts:element-values(fn:QName("nsjps","publication_year"),(),    
("collation=http://marklogic.com/collation/en/MO";, "descending"), 
                               cts:and-query((
                               
cts:element-range-query(fn:QName("nsjps","coden"), "=", "AAA",  
"collation=http://marklogic.com/collation/en/MO";),
                               
cts:element-range-query(fn:QName("nsjps","volume"), "=", "12",   
"collation=http://marklogic.com/collation/en/MO";) 
                                            ))
                                         )


Any one can help me?


Thanks, Helen

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to