Sha256: e5165f679f377adce99d28c6d68ed19738b1690527586da54dae677cdb8b42db

Contents?: true

Size: 1.15 KB

Versions: 7

Compression:

Stored size: 1.15 KB

Contents

module Ddr
  module Datastreams
    class DescriptiveMetadataDatastream < MetadataDatastream

      class_attribute :vocabularies
      self.vocabularies = [RDF::DC, Ddr::Vocab::DukeTerms].freeze

      def self.default_attributes
        super.merge(:mimeType => 'application/n-triples')
      end

      def self.indexers
        # Add term_name => [indexers] mapping to customize indexing
        {}
      end

      def self.default_indexers
        [:stored_searchable]
      end

      def self.indexers_for(term_name)
        indexers.fetch(term_name, default_indexers)
      end

      # Add terms from the vocabularies as properties
      vocabularies.each do |vocab|
        Ddr::Vocab::Vocabulary.property_terms(vocab).each do |term|
          term_name = Ddr::Vocab::Vocabulary.term_name(vocab, term)
          property term_name, predicate: term do |index|
            index.as *indexers_for(term_name)
          end
        end
      end
     
      # Override ActiveFedora::Rdf::Indexing#apply_prefix(name) to not
      # prepend the index field name with a string based on the datastream id.
      def apply_prefix(name)
        name
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-models-1.13.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.13.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.13.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.12.3 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.12.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.12.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.12.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb