Sha256: 5bdd1163bc4bf7c00027a0aad52dda4eba1b218fb336c9ec3c0db5430b11d7b9

Contents?: true

Size: 508 Bytes

Versions: 15

Compression:

Stored size: 508 Bytes

Contents

module Hydra::PCDM
  module AddTypeToFile
    # This adds an additional RDF type to an exsiting Hydra::PCDM::File
    #
    # @param [Hydra::PCDM::File] the file object you want to add it to
    # @param [RDF::URI] term you want to add as the type
    #
    # @return [Hydra::PCDM::File] the updated file

    def self.call(file, uri)
      t = file.metadata_node.get_values(:type)
      return file if t.include?(uri)
      t << uri
      file.metadata_node.set_value(:type, t)
      file
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hydra-pcdm-1.4.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-1.3.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-1.2.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-1.1.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-1.0.1 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-1.0.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.11.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.10.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.9.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.8.2 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.8.1 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.8.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.8.0.beta1 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.7.0 lib/hydra/pcdm/services/file/add_type.rb
hydra-pcdm-0.6.0 lib/hydra/pcdm/services/file/add_type.rb