Database design : xml or relational

Started by
0 comments, last by joanusdmentia 19 years, 4 months ago
I am working on a project in C++ that uses more complicated data than I have ever used before. I am looking for some helping in chosing the right type of database. I am mostly looking into XML and relational databases (or some kind of hybrid). The data is stored locally. It doesn't need to be modified (at least not by the user). However, I will be updating the data for everyone on a regular basis. The first problem I am having with it is that it is semi-structured. For instance, in a database of spells (i'm not working on a game, but a program about a game), each spell will have some structed elements, such as the name of the skill and its casting cost, but each skill will a varied number and type of effects.

<Spells>
 <Spell>
  <SkillName>Flame</SkillName>
  <CastingCost>10 Energy</CastingCost>
  <Effect>
   <EffectType>Direct Dmg</EffectType>
     ... other aspects of Effect1...
  </Effect>
  <Effect>
   <EffectType>Incendiary</EffectType>
     ... other aspects of Effect2...
  </Effect>
 </Spell>
 
 <Spell>
  <SpellName>Heal</SpellName>
  <Effect>
   <EffectType>Heal Self</EffectType>
     ... other aspects of Effect1...
  </Effect>
 </Spell>
</Spells>


Each skill has a varied number of effects. The number and type of elements characteristic of each effect type vary widely. I am new to relational modeling, but I can not see how this can be effeciently modeled in a relational database. So, I have been inteding to use XML. However, the second problem is that the data will need to be queryed and resorted in many different ways. SQL would do the job very well. I have thought about using sqlite for a relational database, or DBXML for an xml database. Anybody have any suggestions about how to best store and access the data?
Advertisement
For a relational db design you'll end up having several tables with only a couple of fields each. Something like this:
SpellTypesTable---------------ID : autoincrName : stringEffectTypesTable----------------ID : autoincrType : stringAspectsTable------------ID : autoincrName : stringValue : numberEffectAspectsTable------------------Effect_ID : numberAspect_ID : numberSpellEffectsTable-----------------Spell_ID : numberEffect_ID : number

"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V

This topic is closed to new replies.

Advertisement