Hi Jay,
You are asking for advice, so here is mine :
Working with BaseX, you shall get rid of any entity/relationship model (or stick to java JPA plumbing), and focus on the
documents or the messages your application will exchange.
Each document might be identified - either by path and/or an unique attribute or element, for cross references (maybe
with xml:base attribute ?).
At first glance, one could think of the following document types :
-
Artist or Band (auto referencing Artists)
-
Album (including Songs)
-
Tour
As I write, I just realize that your question could be all about the distinction between aggregation and reference relations
in the object world (just think of the Eiffel expanded keyword).
Good designing !
Best regards,
Fabrice ETANCHAUD
SPI Informatique
De : basex-talk-bounces@mailman.uni-konstanz.de [mailto:basex-talk-bounces@mailman.uni-konstanz.de]
De la part de Jay Straw
Envoyé : mercredi 29 mars 2017 03:16
À : basex-talk@mailman.uni-konstanz.de
Objet : [basex-talk] Performance: associating one with many, or many with one?
Hi List!
I'm building an application in base-x that's sort of like a local music wiki: bands, members, venues, promoters, and albums and songs are some of what I'm representing in XML.
And what I'm wondering is that, in a situation where there's one of something (a musician), and a bunch of something else they're associated with (song writting or performance credits), which node should get the reference?
The numerous node gets the reference back to the one:
<album name="We Might Rock You" by="The Quesadillas">
<track number="1" name="Hot Cross Buns" written-by="Joe Schmoe" />
<track number="2" name="Bicycle" written-by="Joe Schmoe" />
</album>
[ etc ]
Or the one refers to the many:
<person name="Joe Schmoe">
<songs-written>
<song name="Hot Cross Buns" />
<song name="Bicycle" />
</songs-written>
</person>
Example 1, I could use something like:
track[@written-by="Joe Schmoe"]
Example 2:
person[@name="Joe Schmoe"]/songs-written/song
My other thought was putting the references in both, but I'll have to do this with many types of objects I'm representing and I don't want things to get out of control (then again, if I go to export an <album/> or <band/>
and I'm using the second method, I'll have to do a join)
I have a feeling in a large set, the second way wins out. Even where I live, with only around 750,000 people in our entire state (Alaska), we have easily 100 - 200 acts, including bands, solo performers, traditional acts,
etc, with thousands of individuals that compose them. But I want bands that are extinct, bands that are on hiatus, etc, and I hope my software is useful to others in larger cities as well.
So, maybe a pointless question because my db will be so tiny compared to some folks who post on here, but just curious :-)
Also, if this problem has a name I can research myself, that'd be great!
Be well,
Jay Straw