[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Testing by counting or positional predicate

Subject: Re: Testing by counting or positional predicate
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 11 Jan 2001 04:29:44 -0800 (PST)
efficient superset testing
Hi Jeni,

I'd try something else -- while in all provided expressions you have to
compute the union of the two node-sets, why not try to find the set
difference b/n $superset and $subset.

That is, 

not($subset[count(. | $superset) > count($superset)])

In case of a "smart" processor it will stop evaluating the above
expression immediately when the first node from $subset that does not
belong to $superset is found.

In the best case just one node may be tried.

In the worst case, the time must be similar to the time for uniting the
two node-sets.


Cheers,
Dimitre.

Jeni Tennison wrote:

David C. and I have both brought this up recently, but hidden away in
the depths of other messages and I don't think anyone has commented on
it. So, I was wondering: which is more efficient for testing whether a
$subset node set is a subset of a $superset node set?

  count($subset|$superset) = count($superset)

or:

  not(($subset|$superset)[count($superset) + 1])

Does it make any difference if the $subset is just one node?

  count($node|$node-set) = count($node-set)

or:

  not(($node|$node-set)[count($node-set) + 1])

Does this extend to testing for identity or is the unioned set so
small that it doesn't make any odds?

  count($node1|$node2) = 1

or:

  not(($node1|$node2)[2])
  
Thanks,

Jeni
---
Jeni Tennison
http://www.jenitennison.com/



__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.