commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject RE: [JXPATH] Formatting xpath syntax with Hashtable and iterators
Date Fri, 02 Aug 2002 17:40:27 GMT
Eric,

--- EPugh@upstate.com wrote:
> Ah well..  I was hoping it would somehow prove faster to use xpath
> versus
> actual java code, but I guess since everything is running through
> introspection/reflection then it needs to do more processing.  I was
> hoping
> that on a complex xpath query you could somehow filter out all the
> wrong
> paths..
It would indeed be nice to add some heuristics to JXPath that would
eliminate some hopeless searches based on the introspection data.

> I will take your approach of using xpath (so much cleaner and
> tighter!) and
> then fix the holes later!
Should work.  Let me know if you run into performance problems.
Depending on what the problem is, we might be able to optimize JXPath
rather than rewrite the path to Java.

> Also, I read about using the compiled xpaths, what are the downsides
> of just
> always using a compiled xpath query, versus letting xpath do it
> itself?
There are no downsides.  It makes sense to cache compiled paths if your
application uses the same path repeatedly.

> Eric
- Dmitri


> -----Original Message-----
> From: Dmitri Plotnikov [mailto:dplotnik@yahoo.com]
> Sent: Friday, August 02, 2002 11:22 AM
> To: Jakarta Commons Developers List
> Subject: RE: [JXPATH] Formatting xpath syntax with Hashtable and
> iterators
> 
> 
> Eric,
> 
> --- EPugh@upstate.com wrote:
> > And will this then return my Standard96WellPlate object because the
> > entire
> > path only returns a single top level value?  If I did
> > well[reaction/atpConc='10']/reaction then it would return the
> > matching
> > Reaction object, correct?
> This is correct.  Also, if you need to find _all_ wells that match
> the
> criteria, not just the first one, you can call context.iterate(path).
> 
> > Also, are there any statistics on the overhead compared to doing
> all
> > the
> > java yourself?
> I haven't collected such statistics, but evaluation of an XPath is
> guaranteed to be _significantly_ (orders of magnitude) slower than
> direct Java code.  My suggestion is: use JXPath until you run into an
> actual performance problem, then identify the paths that cause the
> problem and rewrite them to Java.
> 
> > Eric
> - Dmitri
> 
> > 
> > -----Original Message-----
> > From: Dmitri Plotnikov [mailto:dplotnik@yahoo.com]
> > Sent: Thursday, August 01, 2002 4:47 PM
> > To: Jakarta Commons Developers List
> > Subject: Re: [JXPATH] Formatting xpath syntax with Hashtable and
> > iterators
> > 
> > 
> > Your XPath does indeed have a syntax problem. There should be no
> > slash
> > before the predicate.  If I understand your requirement correctly,
> > the
> > correct syntax is:
> > 
> > "well[reaction/atpConc='10']" 
> > 
> > I hope this helps,
> > 
> > - Dmitri
> > 
> > 
> > --- EPugh@upstate.com wrote:
> > > Hi all,
> > > 
> > > I am trying to use the latest version of JxPath, and am having
> some
> > > trouble
> > > understanding how iterators and lists are supported.  My java
> code
> > > (fully
> > > expanded) is:
> > > 			
> > > 			String atpConc = data.getParameters().get( "atpConc"
> > > );
> > > 			List masterPlates = (List) pageData.get(
> > > "masterPlates" );
> > > 			Standard96WellPlate plate = null;
> > > 			for ( Iterator i = masterPlates.iterator();
> > > i.hasNext();  ) {
> > > 				plate = (Standard96WellPlate) i.next();
> > > 				PlateWell plateWell = (PlateWell) plate.get(
> > > 0 );
> > > 				Reaction reaction = plateWell.getReaction();
> > > 				if ( reaction.getAtpConc().equals( new
> > > BigDecimal( atpConc ) ) ) {
> > > 					break;
> > > 				}
> > > 			}
> > > 
> > > I am attempting to find a Standard96WellPlate whose first well
> has
> > a
> > > reaction with the property Atpconc = a passed in atpConc.  My
> xPath
> > > expression is:
> > > Standard96WellPlate plate = (Standard96WellPlate)
> > > JXPathContext.newContext(
> > > masterPlates ).
> > > 			   getValue( "well[1]/reaction/[atpConc='10']/" );
> > > 
> > > However, I keep generating errors about the syntax after
> > > well[1]/reaction/....  I think my problem is that I don't have
> the
> > > properly
> > > xpath for find my first plate in the list of masterPlates...  And
> I
> > > am not
> > > properly return a Standard96WellPlate, but something else....
> > > 
> > > Thanks,
> > > Eric
> > > 
> > > --
> > > To unsubscribe, e-mail:  
> > > <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <mailto:commons-dev-help@jakarta.apache.org>
> > > 
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Health - Feel better, live better
> > http://health.yahoo.com
> > 
> > --
> > To unsubscribe, e-mail:
> > <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-dev-help@jakarta.apache.org>
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:commons-dev-help@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:  
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message