Hi There,

I have very large set of data, and this has to be quick enough because it is on 
the first page. Looks like loop is the way to go. I'll do it.

Thanks everyone.

Helen


On Nov 17, 2010, at 1:22 PM, Jason Hunter wrote:

> A couple things that would be interesting to know.  How many articles are 
> there?  And how quickly does this have to run?
> 
> The brute force way is with simple XPath and distinct-values() loops.  It'll 
> work for a smallish number of articles or if you have plenty of time (i.e. 
> just running this once).
> 
> The fastest way is to use range indexes on coden, volume, and issue.  Do 
> loops at each of the three layers using cts:element-values() with a passed in 
> cts:query constraint, and cts:max() to pull out max values to feed the next 
> loop.  That should let you generate a fast result even against a large number 
> of articles.
> 
> -jh-
> 
> 
> On Nov 17, 2010, at 8:08 AM, helen chen wrote:
> 
>> Hello there,
>> 
>> I have data structure like the following, and each <article> means a xml 
>> file or fragment
>> 
>> <article>.....  <coden>A</coden>  <volume>1</volume>  
>> <issue>1</issue>.....</article>
>> 
>> <article>.....  <coden>A</coden>  <volume>2</volume>  
>> <issue>6</issue>.....</article>
>> 
>> <article>.....  <coden>B</coden>  <volume>2</volume>  
>> <issue>10</issue>.....</article>
>> 
>> <article>.....  <coden>B</coden>  <volume>3</volume>  
>> <issue>5</issue>.....</article>
>> 
>> <article>.....  <coden>C</coden>  <volume>3</volume>  
>> <issue>10</issue>.....</article>
>> 
>> <article>.....  <coden>C</coden>  <volume>5</volume>  
>> <issue>8</issue>.....</article>
>> 
>> I want to do a query that similiar with group by and max in sql:  I want to 
>> group by coden, and for each coden, I want to get max volume number out, 
>> also with the max issue for this volume.   so the result looks like:
>> 
>> 
>> <coden>A</coden>  <volume>2</volume>  <issue>6</issue>
>> 
>> <coden>B</coden>  <volume>3</volume>  <issue>5</issue>
>> 
>> <coden>C</coden>  <volume>5</volume>  <issue>8</issue>
>> 
>> Does anyone have any suggestions?
>> 
>> Thanks, Helen
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

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

Reply via email to