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.4.13 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.12 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.11 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.10 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.9 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.8 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.7 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.6 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.5 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-3.0.0.beta.9 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-3.0.0.beta.8 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-3.0.0.beta.7 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.4 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-3.0.0.beta.6 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.3 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-3.0.0.beta.4 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.4.0.rc6 lib/ddr/datastreams/descriptive_metadata_datastream.rb