-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Node selection expressions
PostPosted: Sun Aug 15, 2004 10:02 pm 
Regular
Regular

Joined: Fri Aug 29, 2003 12:48 pm
Posts: 63
Hi guys. This is only tangentially related to Hibernate, hope it's okay in the Miscellaneous section. I'm finding myself in need of a little expression language for selecting nodes in my object graph. Since my object graph happens to be a tree, I was thinking that xpath might make a good choice. I might be able to write a custom object model interface for Apache Commons JXPath or Jaxen and use them to interpret xpath expressions. If I was really clever, I might even be able to make it so that predicate expressions were implemented using collection filters. That would be really cool.

Has anyone else done anything similar? Anyone else use jaxen or jxpath for this? I hesitate to commit to one of those projects, since they've apparantly not seen active development in some time, but since the xpath spec has been final for quite some time, maybe that's a good thing.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 1:40 pm 
Regular
Regular

Joined: Fri Aug 29, 2003 12:48 pm
Posts: 63
Answering my own question, but hey, why not.

Turns out jxpath wasn't really doing it for me, but jaxen is a dream to work with, and this pattern is just absurdly useful in so many contexts. Now, given a node in my object tree, I can select other nodes and/or their values using lovely little xpath expressions, e.g.:

Code:
entity[@name='foo']/panel[field[@name='bar' and @value='bat']]


suitable for embedding in metadata, or run-time scripts written in javascript or python or whatever. The only thing I want now is the ability to implement predicate expression evaluation using hibernate filters so this stuff is super fast as well as crazy useful.

Has no one else ever experimented with this kind of thing?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 3:31 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check that one http://www.ognl.org/
I used it successfully on a small project, I was a bit overkill however

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.