From: Sergej R. <ser...@gm...> - 2008-06-05 11:57:22
|
Hi Wouter, I've browsed one fine book answering your dilemma (data modelling in XML): http://www.charlesriver.com/books/BookDetail.aspx?productID=126129 - Creating Content Management Systems In Java, Arron Ferguson, 2006 Basically, for solving many-to-many relationships you do the same with XML as in RDBMS - create additional resource (additional XMLSchema vs. table) e.g. transaction linking orders and products etc. Maybe this link will give you more clue: http://www.tdan.com/view-articles/5046 - Many-To-Many Relationships in XML Schema: Hints and Tips For the Busy E-R Modeler Max Gaerber has mentioned the solution using XInclude/XPointer but I think it mixes order with customer data in the same file while I would rather use only reference ID of the customer to find all his orders in transaction collection having his ID for customer field (this could be also defined as XPath like /db/customers/12345.xml etc). Several XQuery queries would then be enough for data management including referential integrity (e.g. find and delete all orders with customer ID, find and delete transactions data with his ID and finally delete customer data etc). And to Ananth Raghuraman: maybe http://vanx.org/presentations/Creating-CMSs-in-Java.ppt (presentation from mentioned book's author) would give you some benefits of XML vs. RDBMS for document-centric data. Sergej 2008/5/31 <exi...@li...>: > Wouter Hartog wrote: > > How can I best setup my DB in terms of collections and documents in relation > to my XML Schema? > For example: my XML Schema defines Orders, Customers and Products. Orders > have links to both customers and products. > ... > It wouldn't be hard if there were no links between the main elements Order, > Customer and Products. But in my XML Schema, I defined key and keyref > elements to link the elements. > > How do I design my database best so I maintain the referential integrity and > get the best flexibility and performance? |