Sha256: 7a75e9deaf1e200e8ef572ff1816d9ddb66427e040c01fd2d1c7ee06e9dc5d04

Contents?: true

Size: 1.15 KB

Versions: 64

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

64 entries across 64 versions & 1 rubygems

Version Path
ddr-models-2.1.0.rc2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.1.0.rc1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.rc6 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.rc5 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.rc4 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.rc3 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.rc2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.17.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.rc1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.pre.5 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.17.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.pre.4 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.pre.3 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.16.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.pre.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.0.0.pre.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.16.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-1.16.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb