Research Article

Pipelined XPath Query Based on Cost Optimization

Algorithm 2

PipedPrimitive (pName, , , tName, i, j, , , ).
Input: primitive name pName, input unit data , blocking queue in following query primitive , tag name tName, input position index i, and output position index j in history record of unit data, region encoding , relation index , and global result .
Output: none. The local results are processed in the algorithm: either put into the queue or output directly to the global result.
(1)switch(pName)
(2)  caseGetDescendant”:
(3)  if(tName = “”) nodeTest ← true;
(4)  else nodeTest ← false;
(5)  ;
(6)  foreach index
(7)   if((nodeTest = true ∨ .tagName = tName)∧(s.r = DE ∨ s.r = CH))
(8)    if()
(9)    ; ←CreateUnit (, ); .enqueue ();
(10)   else;
(11)  return
(12)caseFilterInput1byInput2”:
(13)  ;
(14)  foreach index
(15)   if(()∧(s.r = DE ∨ s.r = CH))
(16)    if()
(17)     ;  ← CreateUnit(, ); .enqueue();
(18)    else;
(19)   break;
(20)  return