Since I got an email asking what all my thinking turned out to, I want to give everyone some information about what I have done.
At the end everything turned out to this picture:
Product { {language, name, description} .... some more}
Content {{language, title, content} ... some more}
This results in the FDs and constructing the hull and the generic system looks like this:
Product -> PK, langauge, name, description,
Product -> PK, price, cost (price+cost are not language depending)
Content -> PK, language, title, content, x, y
Content -> PK, x, y
So it ends with two tables each for product and content. Well at the end it turned out that both tables look quite similar. So it can be unified by adding a type information:
Product -> PK, price, cost
Content -> PK, x, y
Document -> PK, language, type, title, content
So a product name is the document title associated to a product with the same type and thats it. So each product has a list of its associated language related content. This was merely the big problem and the center of my consideration. Having to access a list to get the appropriated product.
But this isn't a big problem. Most of the modification use-cases center only on a product or its language related names/description (not likely both). So this is not a big problem. The web pages are generated by using a middle tier having its own cache and which is synchronized with the database servers on a timely manor or a message channel (mission critical). So this is not much a problem either. The middle tier (for caching) was introduced to be able using a Lucene based searching solution. But it was blown up to cache some more (not much more). Itself uses plain HSQL/SQL constructs to read more then one entry at once.
The idea behind this is not to use something sophisticated like a distributed cache or something alike. Its more like using a distributed database (replication mostly) and use the database and the associated manager (repository+factory aspects) as a synchronization layer.
Since all is archived by using a wiki style system (who did what change and when etc.) the Document is actually a DocumentVersion and here things got even trickier. Imagin adding a version to all of this stuff. What a waste and all those sql MAX calls or having the need to add current_version informations to the product just to keep track with the latest language id (dude you need a version per language and product).
At the end I remembered the WikiMedia solution (check it out worth a read) and simply uncoupled the version history and the current state. So there is now an additional table called document_history.
So that is really all to say about. Ah well wait, something most interesting to all of you: this system is currently not in production use, but was load tested in its alpha state. And it was not suffering by the language depending stuff, compared to another not language aware solution, which is currently pushed towards finalized and going through a beta test state but two compontents are still alpha (automatic information synchronization with 3rd party external information sources). The language aware solution will trail it once it is final. There isn't much to change. The single language solution only has the document version solution... .
So I guess you understand the solution. Any comments welcome... .
Cheers,
Martin (Kersten)
|