On 2010-04-27 23.48, Stanislav Muhametsin wrote:
If one wants to use it as primary storage, it is possible to construct
an entity based on information in tables - I think I might even some
code for that. And even if I don't, it should be possible to implement
though, because according to all logic, as long as transformation "Qi4j
Entity" => "Data in SQL Tables" is accurate enough for arbitrary
queries, the transformation should be two-way, ie also "Data in SQL
Tables" => "Qi4j Entity".

The problem here is that if an entity A has a property X, and that X is in a mixin, then if B has the same property X, then the usual implementation is to make one table "A" with X and another "B" with X. But effectively those two X's are not going to be the same, so querying for "all objects where X is 123" won't work.

That's why RDF is better, because the property X has its own identity, and can be used in any number of entities, and you can make queries like "gimme all entities where X is 123".

If you then instead make one table for X, and which has columns <id,X> where id can point to A or B, then you can query for it, but it becomes very tricky to assemble an A or B, because you have to look in so many tables, and RDBMS's are not really built for it. Graph databases do this much better because you always start with 'id' and look at "what has been associated with 'id'" which you can then trivially access.

It's just a matter of performance - will it just be much faster to use
some other method for storing the entity (JDBM or single table in
another RDB schema to store JSONized entity state) than use complex
algorithm to construct entity based on various bits of information
scattered over many tables in RDBMS. Especially nested collections cause
trouble (and possible baldness ;) ) in this process.

No kidding :-)

To me it seems like doing mapping from entities to tables is like trying to squeeze a square through a round hole. With a lot of effort and hacking it can be done, but what's the point?

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to