[ome-devel] findObjects or obtainDBH for difficult queries

august august at develop.ment.org
Wed Mar 15 16:20:21 GMT 2006


re all,

I'm trying to figger something out regarding SQL querying in OME.  


I need to make an OR'ed select on two different parts of a query 
that is built using mostly ANDs.  For example,  I have a ST called
@Testing with a bunch of fields such as "name", "type", "description",
etc.   I also have a set of 3 fields called "cell_01", "cell_02",
"cell_03" where each of the entries in that field are from the same list (
"microglia", "muller", "ganglion", etc.) .   I then have another set of
3 fields called "color_01", "color_02", "color_03"  where each of those
fields have the same entries ( either "red", "green", "blue", etc).


So, what I want to do is search @Testing for name AND type AND
description AND ( cell_01 OR cell_02 OR cell_03 ) AND (color_01 OR
color_02 OR color_03)

make sense so far?

in SQL, I beleive I would do something like:

SELECT * from testing WHERE name="something" AND type="something" AND
description="something" AND ( cell_01="microglia" OR cell_02="microglia"
OR cell_03="microglia")  AND ( color_01="red" OR color_02="red" OR
color_03="red" );


Is this possible with findObjects?   I know the docs say no "OR's".   
But, I did see the "*" wildcard criteria:

	$factory->findObjects("OME::Image",
                        *          => "foo",
                        created    => ['like', "2006-01-09%" ],
                        owner.FirstName => 'Josiah');

I've tried it out with some success, but I need to search a 'wildcard'
over 2 sets of 3 OR'd fields.

So, if this is not possible with findObjects,  how could I do it with
obtainDBH?   Or is there something else?

How difficult would it be to rewrite findObjects to support OR's?


thanks a lot -august.





More information about the ome-devel mailing list