Skip to content

ActiveFedora 9.0.0

Choose a tag to compare

@jcoyne jcoyne released this 30 Jan 21:23

ActiveFedora 9.0.0

I'm pleased to announce ActiveFedora 9.0.0, the first release of ActiveFedora to work with Fedora Commons 4. There are many changes in this release, but most things that worked in ActiveFedora 8 should continue to work in ActiveFedora 9. Please add to these release notes if you find something missing:

Changes

RDF improvements

You can now add properties right on a subclass of ActiveFedora::Base just as you would have in an RDFDatastream in previous versions of ActiveFedora

Datastreams are now called Files

Fedora 4 doesn't have a concept of datastreams. Everything is just a resource at a URL. We've change Active-Fedora to drop the Datastream terminology and we've replaced it with File

  • add_file_datastream has been renamed to add_file
  • File#prefix now takes one required argument, the file_path.
  • ActiveFedora::Base.datastreams is now ActiveFedora::Base.attached_files
  • ActiveFedora::Base.add_datastream is now ActiveFedora::Base.attach_file
  • instead of has_metadata or has_file_datastream use contains
    E.G. has_metadata 'descMetadata', type: CodexMetadata
    becomes
    contains 'descMetadata', class_name: 'CodexMetadata'
    And has_file_datastream 'pageContent' becomes contains 'pageContent'

pid is now id and dsid is now path

  • ActiveFedora::Base.attach_file (formerly add_datastream) now takes two arguments, the File and the file_path (was dsid)
  • assign_pid, the hook for minting custom identifiers, is now called assign_id

Refactoring

  • load_instance_from_solr has been refactored to return an object backed by a JSON structure. It is read-only
  • Indexing objects. Instead of overriding to_solr in order to add custom indexing, ActiveFedora has introduced indexing objects:
  class MyObject < ActiveFedora::Base
    # inject a custom indexing service
    def indexer
      MyIndexingService 
    end
  end

  class MyIndexingService < ActiveFedora::IndexingService
    def generate_solr_document
      super.tap do |solr_doc|
        solr_doc[Solrizer.solr_name('label')] = object.label
        solr_doc[Solrizer.solr_name('file_format')] = object.file_format
        solr_doc[Solrizer.solr_name('file_format', :facetable)] = object.file_format
        solr_doc['all_text_timv'] = object.full_text.content
        solr_doc = object.index_collection_ids(solr_doc)
      end
    end
end
  • has_model_ssim now indexes the model name, not the URI
  • object_relations and all of SemanticNode is gone

Follow the Ruby Conventions

  • :mimeType parameter to add_file is now to :mime_type
  • File#mimeType is now #mime_type
  • File#dsSize is now #size
  • File#new? is now #new_record?