RE: Comments on XPath Filter 2.0 draft (2002-06-20)

Merlin,

> r/gregor.karlinger@iaik.at/2002.07.08/12:48:30
> >I have the following comment on the current XPath filter 2.0 draft:
> >
> >The first bullet of the inner list in the performance paragraph in 
> >section 3.4 says:
> > 
> >  "Any time a node is encountered that is in any evaluated node
> >   set S, update Z ..."
> >
> >I think this is incorrect. The flag Z must be updated for 
> each node of the input node set.

<merlin>
> I think that the flag Z can only change state if a node from 
> a filter node set is encountered.
</merlin>

Merlin, maybe I misunderstand what is said in the draft, but let me
work out the specified algorithm with the following example:

  Sample input: <Root><Select/><DontSelect/></Root>
  Transform params: single intersect filter, xpath="//Select"

Step 1: For each XPath expression X, in sequence, evaluate the 
        expression and store the resulting node set, S

  We only have one filter, whose node set S is {Elem(Select)}
  Filter("Intersect", {Elem(Select)})

Step 2: Prepend a node set consisting of just the document node, 
        along with the operation union. 

  So we have another filter
  Filter("Union", {Doc}

Step 3: Create a new, empty filter node set. 

  OK, denote it FilterNodeSet({})

After the first three init steps we have the following setting:

  InputDocument({Doc, Elem{Root}, Elem{Select}, Elem{DontSelect})
  FilterList
  (
    Filter("Union", {Doc}
    Filter("Intersect", {Elem(Select)})
  )
  FilterNodeSet({})
  FlagZ(undefinded)

Step 4: Iterate through the input document in document order, 
        adding each node that is encountered to the filter node
        set F if a flag Z is true. This flag is computed as 
        follows: Any time a node is encountered that is in any 
        evaluated node set S, update Z ...

  first iteration: Doc

    - Doc is in first filter node set, therefore update flag Z:
        - Last "Union" filter is our first filter
        - Doc is not in subsequent expanded "Intersect" filter node 
          set => FlagZ(false)

    - Doc will not make it in the FilterNodeset
      => FilterNodeSet({})

  second iteration: Elem(Root)

    - Elem(Root) is in no filter node set, so do not update FlagZ
      => FlagZ(false)

    - Elem(Root) will not make it in the FilterNodeset
      => FilterNodeSet({})

  third iteration: Elem(Select)

    - Elem(Select) is in the second filter node set, therefore 
      update flag Z:
        - Last "Union" filter is our first filter 
        - Elem(Select) is in the subsequent expandend "Intersect" 
          filter node set => FlagZ(true)

    - Elem(Select) is our first member of FilterNodeSet
      => FilterNodeSet({Elem(Select)})

  fourth iteration: Elem(DontSelect)

    - Elem(DontSelect) is in no filter node set, so do not update 
      FlagZ => FlagZ(true)

    - Elem(DontSelect) will make it in the FilterNodeset, since
      FlagZ is still true.
      => FilterNodeSet({Elem(Select), Elem(DontSelect)})

So, if this interpretation of the specified algorithm is correct,
we have a FilterNodset({Elem(Select), Elem(DontSelect)}, although
the intention of the filter should be to select Elem(Select) only.

Am I missing something here?

Regards, Gregor      

Received on Monday, 8 July 2002 12:44:51 UTC