Class: Hyrax::FileSet
- Defined in:
- app/models/hyrax/file_set.rb,
app/models/concerns/hyrax/file_set/indexing.rb,
app/models/concerns/hyrax/file_set/querying.rb,
app/models/concerns/hyrax/file_set/derivatives.rb,
app/models/concerns/hyrax/file_set/belongs_to_works.rb,
app/models/concerns/hyrax/file_set/characterization.rb
Overview
Valkyrie model for ‘FileSet` domain objects in the Hydra Works model.
## Relationships
### FileSet and Work
-
Defined: The relationship is defined by the inverse relationship stored in the work’s ‘:member_ids` attribute.
-
Tested: The test for the Work class tests the relationship.
-
FileSet to Work: (n..1) A FileSet must be in one and only one work. A Work can have zero to many FileSets.
-
See Hyrax::Work for code to get and set file sets for the work.
### FileSet and FileMetadata
-
Defined: The relationship is defined by the FileSet’s ‘:file_ids` attribute.
-
FileSet to FileMetadata: (0..n) A FileSet can have many FileMetadatas. A FileMetadata must be in one and only one FileSet.
### FileMetadata and Files
-
Defined: The relationship is defined by the FileMetadata’s ‘:file_identifier` attribute.
-
FileMetadata to File: (1..1) A FileMetadata can have one and only one File
Direct Known Subclasses
Defined Under Namespace
Modules: BelongsToWorks, Characterization, Derivatives, Indexing, Querying
Class Method Summary collapse
-
.file_set? ⇒ Boolean
True.
- .model_name(name_class: Hyrax::Name) ⇒ Object
-
.pcdm_object? ⇒ Boolean
True.
Instance Method Summary collapse
- #extracted_text ⇒ Hyrax::FileMetadata?
- #extracted_text_id ⇒ Valkyrie::ID?
-
#iiif_id ⇒ String, Nil
Versioned identifier suitable for use in a IIIF manifest.
- #original_file ⇒ Hyrax::FileMetadata?
- #original_file_id ⇒ Valkyrie::ID?
- #representative_id ⇒ Valkyrie::ID
- #thumbnail ⇒ Hyrax::FileMetadata?
- #thumbnail_id ⇒ Valkyrie::ID?
Methods inherited from Resource
#==, collection?, #collection?, #embargo, #embargo=, file?, #file?, #file_set?, human_readable_type, #lease, #lease=, pcdm_collection?, #pcdm_collection?, #pcdm_object?, #permission_manager, #to_rdf_representation, to_rdf_representation, #visibility, #visibility=, #work?, work?
Methods included from WithEvents
#event_class, #events, #log_event, #stream
Class Method Details
.file_set? ⇒ Boolean
Returns true.
117 118 119 |
# File 'app/models/hyrax/file_set.rb', line 117 def self.file_set? true end |
.model_name(name_class: Hyrax::Name) ⇒ Object
55 56 57 |
# File 'app/models/hyrax/file_set.rb', line 55 def self.model_name(name_class: Hyrax::Name) @_model_name ||= name_class.new(self, nil, 'FileSet') end |
.pcdm_object? ⇒ Boolean
Returns true.
123 124 125 |
# File 'app/models/hyrax/file_set.rb', line 123 def self.pcdm_object? true end |
Instance Method Details
#extracted_text ⇒ Hyrax::FileMetadata?
98 99 100 101 102 |
# File 'app/models/hyrax/file_set.rb', line 98 def extracted_text Hyrax.custom_queries.find_extracted_text(file_set: self) rescue Valkyrie::Persistence::ObjectNotFoundError nil end |
#extracted_text_id ⇒ Valkyrie::ID?
105 106 107 |
# File 'app/models/hyrax/file_set.rb', line 105 def extracted_text_id extracted_text&.id end |
#iiif_id ⇒ String, Nil
Returns versioned identifier suitable for use in a IIIF manifest.
77 78 79 80 81 82 83 |
# File 'app/models/hyrax/file_set.rb', line 77 def iiif_id orig_file = original_file return nil if orig_file.nil? || orig_file.file_identifier.blank? latest_file = Hyrax::VersioningService.latest_version_of(orig_file) version = latest_file&.version_id ? Digest::MD5.hexdigest(latest_file.version_id) : nil "#{id}/files/#{orig_file.id}#{'/' + version if version}" end |
#original_file ⇒ Hyrax::FileMetadata?
65 66 67 68 69 |
# File 'app/models/hyrax/file_set.rb', line 65 def original_file Hyrax.custom_queries.find_original_file(file_set: self) rescue Valkyrie::Persistence::ObjectNotFoundError nil end |
#original_file_id ⇒ Valkyrie::ID?
72 73 74 |
# File 'app/models/hyrax/file_set.rb', line 72 def original_file_id original_file&.id end |
#representative_id ⇒ Valkyrie::ID
111 112 113 |
# File 'app/models/hyrax/file_set.rb', line 111 def representative_id id end |
#thumbnail ⇒ Hyrax::FileMetadata?
86 87 88 89 90 |
# File 'app/models/hyrax/file_set.rb', line 86 def thumbnail Hyrax.custom_queries.find_thumbnail(file_set: self) rescue Valkyrie::Persistence::ObjectNotFoundError nil end |
#thumbnail_id ⇒ Valkyrie::ID?
93 94 95 |
# File 'app/models/hyrax/file_set.rb', line 93 def thumbnail_id thumbnail&.id end |