Originally posted by Gabor Bator:
My problem is that I have to put them into 'something'. A simple collection is not enough, as I will need indices to speed up operations.
The first idea was to create an object to store them in, and this is what I have done. It is based on an interface called Storage. I have designed another interface called Storeable, which can be added to a Storage and I have also modified the concept class to implement it.
Now the problem is, that some functionalities I need cannot be described by interfaces. For example, if an indexed attribute were changed in the concept, the storage class would have to update the index. That is maybe where abstract classes come in, but I am afraid it may upset the inheritence model. Furthermore, I have to write all index functions myself, and that becomes more difficult as the "key" may include more than one field.
Databases would provide an alternative, I guess; however, I feel insecure about how to map an object to sql tables, if I have to use them as objects. I have also considered to use them as simple rows in the database, but I think that is not a solution: the problem is inherently OO-like, why change it?
Originally posted by Gabor Bator:
I am currently working on a system that builds and manages an ontology. It has concepts, each having attributes like name, real world name, constraints, etc. It would be useful to have methods as well (at least comparison and formatting methods). Therefore I decided to have a class for them.
My problem is that I have to put them into 'something'. A simple collection is not enough, as I will need indices to speed up operations.
Originally posted by Gabor Bator:
Databases would provide an alternative, I guess; however, I feel insecure about how to map an object to sql tables, if I have to use them as objects. I have also considered to use them as simple rows in the database, but I think that is not a solution: the problem is inherently OO-like, why change it?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Gabor Bator:
1. In case an index contains more than one field (like name, variant), the code quickly becomes quite complicated.
2. If I think about the generic problem (management of data objects), the only viable way I can think of would be to access the fields via reflection. I suspect this might result in some performance decrease, but the main issue is how can I access multiple-field indices in this way.
Originally posted by Gabor Bator:
Secondly, there are some 65000 entries, which I have to manage. Therefore indices are a must.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Frank Carver:
How complex/flexible are the objects you build when you load the data - what methods do they expose?
Originally posted by Gabor Bator:
Ilja: I have conducted a small test in which I have added 65000 number entries to a List (both as Strings and as Integers, using Random or just incrementing the value, which is the worst case). Doing it with linear search took up to 40-50x, at worst 100x as much time as with binary search.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
But the *important* question is: is it *too slow* for you? Is it *your bottleneck*,
Originally posted by Ilja Preuss:
or are there more important parts of the code to work on?
Originally posted by Gabor Bator:
Most of the algorithms will use the indices extensively, and they will take quite some time even like this.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|