Update of /cvsroot/monetdb/pathfinder/tests/BugTracker/Tests
In directory 
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19325/tests/BugTracker/Tests

Added Files:
      Tag: M5XQ
        slow_compilation.SF-2898944.mod1.xq 
Log Message:
propagated changes of Thursday Nov 19 2009
from the XQFT branch to the M5XQ branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/11/19 - sjoerd:
          tests/BugTracker/Tests/slow_compilation.SF-2898944.mod1.xq,1.2.2.1
  file slow_compilation.SF-2898944.mod1.xq was added on branch XQFT on 
2009-11-19 12:15:58 +0000
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/11/19 - sjoerd:
          tests/BugTracker/Tests/slow_compilation.SF-2898944.mod1.xq,1.2.2.2
  propagated changes of Thursday Nov 19 2009
  from the development trunk to the XQFT branch
  
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2009/11/19 - sjoerd:
            tests/BugTracker/Tests/slow_compilation.SF-2898944.mod1.xq,1.2
    propagated changes of Wednesday Nov 18 2009 - Thursday Nov 19 2009
    from the Nov2009 branch to the development trunk
  
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      2009/11/18 - stmane:
              tests/BugTracker/Tests/slow_compilation.SF-2898944.mod1.xq,1.1.2.1
  
      added test (compilation via pf, only) for
      ID: 2898944 "pf takes 'forever' (> 1 hour) to compile particular query"
      
https://sourceforge.net/tracker/?func=detail&aid=2898944&group_id=56967&atid=482468
  
      Seems to work fine, now;
      compiling both queries with both `pf -A` & `pf -M`
      takes less than 2 secs on my machine with a debug build.
      Set timeout to 6 secs.
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- NEW FILE: slow_compilation.SF-2898944.mod1.xq ---
module namespace ecv = "http://www.cs.utwente.nl/~belinfan/ecv";;
(: this file contains code to apply a given view  :)


declare function ecv:print-eprint($entries as element()*) as element()*
{
        $entries//fmt/div
};

(: ======================================================================= :)

declare function ecv:generate($doc as xs:string)
   as element(tuple)*
{
   for $ep in doc($doc)//tuple
   where (
          ( some $c in $ep//assistant_supervisors_family satisfies 
contains(upper-case($c),  "RENSINK"))
          or
          ( some $c in $ep//supervisors_family satisfies 
contains(upper-case($c),  "RENSINK"))
   )
   return $ep
};

declare function ecv:apply-view()
   as element()
{
        ecv:view-from-save("eprints-export-conv.xml")
};

declare function ecv:view-from-save($doc as xs:string)
   as element()
{
           let $eplvl0 := ecv:generate($doc)

    ,$human_type := <m>      <e k="mastersthesis">Master's Thesis</e>
           <e k="article">Article</e>
           <e k="inaugural_lecture">Inaugural lecture</e>
           <e k="thesis">PhD Thesis</e>
           <e k="conference_item">Conference or Workshop Paper</e>
           <e k="book_review">Review</e>
           <e k="book_section">Book Section</e>
           <e k="intreport">Internal Report</e>
           <e k="manual">Manual</e>
           <e k="book">Book</e>
           <e k="patent">Patent</e>
           <e k="extreport">External Report</e>
     </m>
 

    ,$grpvals0  := for  $ep  in distinct-values($eplvl0//type/text())
                               order by $ep descending
                               return $ep

    ,$grpvals1  := for  $ep  in distinct-values($eplvl0//year/text())
                               order by $ep descending
                               return $ep
                      


   ,$head := (
   )
 
 
 

          ,$toc := (: ecv:grouped-toc($eplvl0) :)
                             

    let  $grpitems0 := for $g0 in $grpvals0
                          let $eplvl1 := for $ep in $eplvl0
                                                  where $ep//type = $g0
                                                  return $ep
                          where not(empty($eplvl1))
                          return
                          (

    let  $grpitems1 := for $g1 in $grpvals1
                          let $eplvl2 := for $ep in $eplvl1
                                                  where $ep//year = $g1
                                                  return $ep
                          where not(empty($eplvl2))
                          return
                          (

                          )
    return if (not(empty($grpitems1)))
           then  $grpitems1
           else  ()
                          )
    return if (not(empty($grpitems0)))
           then  $grpitems0
           else  ()
 



        ,$items :=  (: ecv:grouped-view($eplvl0) :)

    for $g0 in $grpvals0
    let $eplvl1 := for $ep in $eplvl0
                            where $ep//type = $g0
                            return $ep
    where not(empty($eplvl1))
    return
           <div class="type" id="{$g0}"> { (
             <h1>{ecv:to-human($g0, $human_type)}</h1>,

    for $g1 in $grpvals1
    let $eplvl2 := for $ep in $eplvl1
                            where $ep//year = $g1
                            return $ep
    where not(empty($eplvl2))
    return
           <div class="year" id="{$g0}::{$g1}"> { (
             ecv:print-eprint($eplvl2)
           ) } </div>
           ) } </div>
 
                                      
           return
                <div>{
  
                                ( if (empty($toc))
                                   then ()
                                   else <div class="toc">{$toc}</div>
                                ,
                                   if (empty($items))
                                   then ()
                                   else <div class="items">{$items}</div>
                                )
                }</div>
};


(:
 declare function try($v as xs:string) as xs:string { let $a := <t><n t="a">Aap 
jaap</n><n t="b">Beep piep piep</n></t> , $r := for  $x in $a//n where $x/@t eq 
$v return $x/text() return if (empty($r)) then $v  else 
string-join($r/string(), "") } ; 
<div><p>{try("a")}</p><p>{try("b")}</p><p>{try("c")}</p></div>
  :)

 declare function ecv:to-human($val as xs:string, $m as element())
   as xs:string
{
   let $r := for $x in $m//e where $x/@k eq $val
           return $x
  return
      if (empty($r)) 
      then $val
      else string-join($r/string(), "")
};



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to