Soliciting Feedback: Rearranging ActiveFedora code related to Content Modeling

4 views
Skip to first unread message

Matthew Zumwalt

unread,
Sep 11, 2010, 6:25:58 PM9/11/10
to active...@googlegroups.com
Rick has just contributed some new code that extends ActiveFedora in useful ways.  Among other things, he added a has_datastream model method and added the long-absent support for deleting relationships.  Incorporating his code has precipitated some ideas about how to make the code base more readable & maintainable, at least where it is dealing with content modeling stuff.

Currently, the support for content modeling type stuff (has_metadata, has_relationship, etc.) is sprinkled all around in the code base.  I think we should put all of that stuff into a directory called active_fedora/model/ and modify the current ActiveFedora::Model  module to inject all of that content model-derived functionality when you include it in a class.  

At first pass, I'm thinking we should create these files:

active_fedora/model/datastream_modeler.rb
active_fedora/model/relationship_modeler.rb
active_fedora/model/metadata_modeler.rb

These would define ActiveFedora::Model::DatastreamModeler, ActiveFedora::Model::RelationshipModeler, and ActiveFedora::Model::MetadataModeler, which would provide class methods like has_metadata as well as any associated instance methods like metadata_streams.  Then we could add these lines to active_fedora/model.rb:

self.included(klass)  
    klass.send(:include, ActiveFedora::Model:: DatastreamModeler)
    klass.send(:include, ActiveFedora::Model::RelationshipModeler)
    klass.send(:include, ActiveFedora::Model:: MetadataModeler)
end

This would ensure that ActiveFedora::Base will inherit all of those behaviors when it calls "include ActiveFedora::Model" .

We should also start moving in the direction of aligning this work (features & method names) with Fedora's Enhanced Content Models (http://sourceforge.net/apps/mediawiki/ecm/index.php?title=Main_Page) whenever possible.  This will make it easier for us to serialize all of this information into ECM content model objects.

Any thoughts?

Matt Zumwalt
MediaShelf, LLC




Reply all
Reply to author
Forward
0 new messages