Sha256: 442d32c04851088f951abc8ce674a4a98f850a0c21c1bca194e189fbdc4789fe

Contents?: true

Size: 1.24 KB

Versions: 20

Compression:

Stored size: 1.24 KB

Contents

module Sufia
  module GenericFile
    module Metadata
      extend ActiveSupport::Concern

      included do
        has_metadata "descMetadata", type: GenericFileRdfDatastream
        has_metadata "properties", type: PropertiesDatastream
        has_file_datastream "content", type: FileContentDatastream
        has_file_datastream "thumbnail"

        has_attributes :relative_path, :depositor, :import_url, datastream: :properties, multiple: false
        has_attributes :date_uploaded, :date_modified, datastream: :descMetadata, multiple: false
        has_attributes :related_url, :based_near, :part_of, :creator,
                                    :contributor, :title, :tag, :description, :rights,
                                    :publisher, :date_created, :subject,
                                    :resource_type, :identifier, :language, datastream: :descMetadata, multiple: true
      end

      # Add a schema.org itemtype
      def itemtype
        # Look up the first non-empty resource type value in a hash from the config
        Sufia.config.resource_types_to_schema[resource_type.to_a.reject { |type| type.empty? }.first] || 'http://schema.org/CreativeWork'
      rescue
        'http://schema.org/CreativeWork'
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
sufia-5.0.0 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-5.0.0 app/models/concerns/sufia/generic_file/metadata.rb
sufia-5.0.0.rc1 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-5.0.0.rc1 app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.3.1 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.3.1 app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.2.0 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.2.0 app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.1.0 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.1.0 app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.0.1 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.0.1 app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.0.0 app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.0.0 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.0.0.rc2 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.0.0.rc2 app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.0.0.rc1 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.0.0.rc1 app/models/concerns/sufia/generic_file/metadata.rb
sufia-4.0.0.beta4 sufia-models/app/models/concerns/sufia/generic_file/metadata.rb
sufia-models-4.0.0.beta4 app/models/concerns/sufia/generic_file/metadata.rb