Research Article

Pipelined XPath Query Based on Cost Optimization

Algorithm 3

PipeStage(pName[], tName[], i[], j[], , , , ).
Input: primitive name list pName, tag name list tName, input position index list i, and output position index list j in history record of unit data, blocking queue in following query primitive , 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)s ← primitiveName.size;//get the number of primitives contained in stage.
(2) ← CreateQueue(s);//create s local blocking queues.
(3)run(){//the start of the executive body
(4)  while(true)//processing of the 1st query primitive
(5)   .dequeue();
(6)   if()
(7)    .enqueue();
(8)    break;
(9)   PipedPrimitive(pName[0],,,tName[0],i[0],j[0], , , );
(10)   while(true)//processing of the 2nd query primitive
(11)    if() break;
(12)    else.dequeue();
(13)     PipedPrimitive(pName[1],,,tName[1],i[1],j[1], , , );
(14)    while(true)//processing of the 3rd query primitive
(15)     ... ...//omit the remaining processing steps
(16)}//the end of the executive body