The Artima Developer Community
Sponsored Link

Java Buzz Forum
Database type switching

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Bill de hÓra

Posts: 1137
Nickname: dehora
Registered: May, 2003

Bill de hÓra is a technical architect with Propylon
Database type switching Posted: Aug 10, 2005 1:47 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Bill de hÓra.
Original Post: Database type switching
Feed Title: Bill de hÓra
Feed URL: http://www.dehora.net/journal/atom.xml
Feed Description: FD85 1117 1888 1681 7689 B5DF E696 885C 20D8 21F8
Latest Java Buzz Posts
Latest Java Buzz Posts by Bill de hÓra
Latest Posts From Bill de hÓra

Advertisement
Suppose you had an event object that had the following properties:   class event:     def __init__(self, what, where, when)       self.what=what       self.where=where       self.when=when Now, in the above imagine that 'when' is a date and 'where' is a URI. But suppose in your domain the 'what' could be one of three types: a URI: this means something well known enough that we have a pre-canned name for it. a String: this means it's some kind of opaque literal, like a java stacktrace or hexed coredump, or maybe some chunk of XHTML. some XML format: this means the event has a 'well-known' XML format that we know how to process, ie some SOAP thing or an Atom entry. The interesting thing here is that these 3 types are disjoint; they're not specializations of some common form, modulo the crashingly trivial observation they could all be represented as text. In code or markup you'd probably have a some extra metadata about the 'what' that would allow you to switch-on-type For example, in XML that could result in different element names altogether for each type maybe or some @type attribute, or in RDF, it would an rdf:type annotation. So given that the range of value types can be disjoint I was wondering what people think the idiomatic way to represent this event structure in an RDBMS would be. Have a foreign-key for the 'what' column pointing to 1 of 3 possible tables? Make the 'what' column a blob? Change the design not to have use disjoint types? Have the three what tables hold foreign keys back the event table? Or some other approach?...

Read: Database type switching

Topic: Hilton, Chris, and Zane [Flickr] Previous Topic   Next Topic Topic: JP Gone Wild! [Flickr]

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use