Relationships and Relational Databases
Join the DZone community and get the full member experience.
Join For Free
when working with relational databases, the join tables are sometimes
treated as second class citizens. if they are lucky, they’ll get some
additional fields, but are often just placeholder tables connecting your
main object tables together. it leads you to think about objects
first, and relationships second. with graphs, you will want to switch
up your thinking. you want to start thinking about how things are
connected. think about the different ways things are connected. two
people can be friends, co-workers, and neighbors all at the same time.
if you’ve ever been crazy enough to go back to school after your
bachelor’s degree, you know all about research papers, journals, and
citations. so what kind of relationships can we find here? papers are
rarely authored alone. having multiple authors means you can create a
graph of co-authors. which students and scientists work together on
papers, and which should work together. scientific research builds upon
the work of others, and previous work can be used to build a graph of
citations. keywords in the abstracts or extracted from the papers can
be used to build a graph of similar content.
what about a social network like twitter? how about a follower graph, a reply graph, a mention graph, a co-listed graph, a hashtag graph, a co-location graph, a shared-url graph? what about blogs? how about a link graph, a blogroll graph, a tag graph?
you will be surprised by how connected your data is once you start exploring it. don’t be afraid of your model. just start with whatever you have and start adding nodes and relationships as they become apparent to you. your model will probably evolve, so don’t waste your time second guessing yourself.
when folks ask me about modeling, i tell them to start with the questions they want to answer. it doesn’t end there however. once you’ve answered those questions, you’ll discover more. you’ll say, if i had this extra piece of data, i could ask and answer a ton new questions i didn’t think about before.
i’ll spend some time in the next few posts digging in a little deeper.
Published at DZone with permission of Max De Marzi, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments