Reputation: 948
I have collection of multidimensional object (e.g class Person = {age : int , height : int, weight : int etc...}
).
I need to query the collection with queries where some dimensions are fixed and the rest unspecified (e.g getallPersonWith {age = c , height = a}
or getAllPersonWith {weigth = d}
...)
Right now i have a multimap with {age, Height,...}
(e.g all dimension that can be fixed) -> List : Person
.To perform a query i first compute the set of keys that verify the query, then merge the corresponding list from the map.
Is there anything better, in terms of query speed ? in particular is there anything closer to using one sorted list by dimension (which i believe to be the fastest solutions, but too cumbersome to manage:) )
Just to be clear, i am not looking for an sql query.
Upvotes: 3
Views: 233
Reputation: 3329
For your purpose you can have a look at: http://code.google.com/p/cqengine/
Should get you in the right direction
Upvotes: 3
Reputation: 44250
You mean something like:
SELECT * FROM person p
WHERE gender = 'F'
AND age >=18
AND age < 30
AND weight > 60 -- metric measures here !!
AND weight < 70
AND NOT EXISTS (
SELECT * from couple c
WHERE c.one = p.id OR c.two=p.id
);
Why do you think I use SQL?
Upvotes: 0