module Hydra::PCDM::AddTypeToFile

Public Class Methods

call(file, uri) click to toggle source

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

# File lib/hydra/pcdm/services/file/add_type.rb, line 10
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