Hi Christian --

I can't give you a real example because it's the client's health care data, and I would be fed to the rippy fish if I posted any of it.

I've created an example with trivial data, zipped that up, and attached it.  (Create a database from example.xml, and run threePartMatchesEG.xq against that DB.)

(I think) the difficult part is:

let $found := //*[@name eq $match(1)][./descendant::*[@name eq $match(2)][./descendant::*[@name eq $match(3)]]]

This works, but it's going over the entire database for every three part class-operation-specifier compound name.  I can't shake the feeling that there's a more efficient way to do this, but I can't see what it might be.

Thanks!
Graydon

On Fri, Apr 1, 2016 at 12:04 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Graydon,

Do you think there’d be a chance for us to get a minimized,
self-contained example, which demonstrates the n^2 solution?

Thanks  in advance,
Christian



On Fri, Apr 1, 2016 at 5:24 PM, Graydon Saunders <graydonish@gmail.com> wrote:
> Hello -
>
> I've got a problem I'm not sure how to best approach.
>
> I've got triplets of names -- class.operation.specifier -- that I need to
> match against much longer sequences of names. (Which are in attributes in an
> XML hierarchy; each sequence of names derives from a path to a leaf
> element.)
>
> If there is a match (as there usually is not) one of the names in the
> sequence of names will match to the class, a subsequent name to the
> operation,  and a name subsequent to that match to the specifier. (All
> simple string values.)
>
> The naive n^2 version is much too slow for the amount of data involved.
>
> Is there an efficient way to do this kind of matching?
>
> Thanks!
> Graydon