DSDB (domain-specific database)?

Greetings!

I’ve begun working on a Ruby library that will process XML files known
as CCRs (an ASTM standard). I’m at what feels like a major decision
point and I could use some help thinking through the alternatives. Any
feedback is much appreciated. So here goes …

I want the library to be useful both within a Rails app and in a
standalone Ruby app. I want it to be useful both with and without using
a database. I want to make it really easy to move the CCR contents from
the XML file into a database and vice-versa. One person has suggested I
approach this by writing an ActiveRecord adapter that treats the XML
file itself as a domain-specific database. Importing the content of the
XML file into MySQL, for example, could then be as easy as …

ccr = Xml_Ccr.find(1) # get the content from the XML file / DSDB. ccr
is now a set of associated AR objects
ar_ccr = Mysql_Ccr.new(ccr) # create a new AR object based on the MySQL
db
ar_ccr.save # save the records to the MySQL db

I could use some help getting my head around this DSDB notion. Is it
doable? Does it make sense? Anybody got any experience with something
like this? Or could point me to any readings that might help?

TIA,
Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs