Sha256: 691853bf36d335fc9215be3d0e29568d33d17bb6855da86964b1fa2852dd2186

Contents?: true

Size: 1.22 KB

Versions: 20

Compression:

Stored size: 1.22 KB

Contents

require "rdf/vocab"

module Ddr::Datastreams
  class DescriptiveMetadataDatastream < MetadataDatastream

    class_attribute :vocabularies
    self.vocabularies = [RDF::Vocab::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)
        # Do not include :license as a descriptive metadata property
        unless term_name == :license
          property term_name, predicate: term do |index|
            index.as *indexers_for(term_name)
          end
        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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ddr-models-2.11.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.10.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.10.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.10.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.10.0.rc2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.10.0.rc1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.9.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.9.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.9.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.9.0.rc1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.8.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.8.0.rc1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.6 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.5 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.4 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.3 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.2 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.1 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.0 lib/ddr/datastreams/descriptive_metadata_datastream.rb
ddr-models-2.7.0.rc1 lib/ddr/datastreams/descriptive_metadata_datastream.rb