app/models/article.rb
# frozen_string_literal: true
# Generated via
# `rails generate hyrax:work Article`
class Article < ActiveFedora::Base
include ::Hyrax::WorkBehavior
self.indexer = ArticleIndexer
# Change this to restrict which works can be added as a child.
# self.valid_child_concerns = []
validates :title, presence: { message: 'Your work must have a title.' }
property :abstract, predicate: ::RDF::Vocab::DC.abstract do |index|
index.as :stored_searchable
end
property :admin_note, predicate: ::RDF::URI('http://cdr.unc.edu/definitions/model#AdminNote'), multiple: false do |index|
index.as :stored_searchable
end
property :alternative_title, predicate: ::RDF::Vocab::DC.alternative do |index|
index.as :stored_searchable
end
property :copyright_date, predicate: ::RDF::Vocab::DC.dateCopyrighted, multiple: false do |index|
index.as :stored_searchable
end
property :date_captured, predicate: ::RDF::Vocab::MODS.dateCaptured, multiple: false do |index|
index.as :stored_searchable
end
property :date_issued, predicate: ::RDF::Vocab::DC.issued, multiple: false do |index|
index.as :stored_searchable
end
property :date_other, predicate: ::RDF::Vocab::DC.date do |index|
index.as :stored_searchable
end
property :dcmi_type, predicate: ::RDF::Vocab::DC.type do |index|
index.as :stored_searchable
end
property :digital_collection, predicate: ::RDF::URI('http://dbpedia.org/ontology/collection') do |index|
index.as :stored_searchable
end
# link to previous deposit record
property :deposit_record, predicate: ::RDF::URI('http://cdr.unc.edu/definitions/model#DepositRecord'), multiple: false do |index|
index.as :stored_searchable
end
property :doi, predicate: ::RDF::Vocab::Identifiers.doi, multiple: false do |index|
index.as :stored_searchable
end
property :edition, predicate: ::RDF::Vocab::BF2.editionStatement, multiple: false do |index|
index.as :stored_searchable, :facetable
end
property :extent, predicate: ::RDF::URI('http://rdaregistry.info/Elements/u/extent.en') do |index|
index.as :stored_searchable
end
property :funder, predicate: ::RDF::URI('http://id.loc.gov/vocabulary/relators/fnd') do |index|
index.as :stored_searchable
end
property :issn, predicate: ::RDF::Vocab::Identifiers.issn do |index|
index.as :stored_searchable
end
property :journal_issue, predicate: ::RDF::Vocab::BIBO::issue, multiple: false do |index|
index.as :stored_searchable
end
property :journal_title, predicate: ::RDF::URI('http://rdaregistry.info/Elements/u/containedIn.en'), multiple: false do |index|
index.as :stored_searchable
end
property :journal_volume, predicate: ::RDF::Vocab::BIBO::volume, multiple: false do |index|
index.as :stored_searchable
end
property :language_label, predicate: ::RDF::URI('http://cdr.unc.edu/definitions/model#LanguageLabel') do |index|
index.as :stored_searchable
end
property :license_label, predicate: ::RDF::URI('http://cdr.unc.edu/definitions/model#LicenseLabel') do |index|
index.as :stored_searchable
end
property :note, predicate: ::RDF::Vocab::SKOS.note do |index|
index.as :stored_searchable
end
property :page_end, predicate: ::RDF::Vocab::SCHEMA.pageEnd, multiple: false do |index|
index.as :stored_searchable
end
property :page_start, predicate: ::RDF::Vocab::SCHEMA.pageStart, multiple: false do |index|
index.as :stored_searchable
end
property :peer_review_status, predicate: ::RDF::URI('http://purl.org/ontology/bibo/status/peerReviewed'),
multiple: false do |index|
index.as :stored_searchable
end
property :place_of_publication, predicate: ::RDF::URI('http://id.loc.gov/vocabulary/relators/pup') do |index|
index.as :stored_searchable
end
property :rights_holder, predicate: ::RDF::Vocab::DC.rightsHolder do |index|
index.as :stored_searchable
end
property :rights_statement_label, predicate: ::RDF::URI('http://cdr.unc.edu/definitions/model#RightsStatementLabel'), multiple: false do |index|
index.as :stored_searchable
end
property :translators, predicate: ::RDF::URI('http://id.loc.gov/vocabulary/relators/trl'), class_name: 'Person' do |index|
index.as :stored_searchable
end
# This must be included at the end, because it finalizes the metadata
# schema (by adding accepts_nested_attributes)
include ::Hyrax::BasicMetadata
# accepts_nested_attributes_for can not be called until all
# the properties are declared because it calls resource_class,
# which finalizes the property declarations.
# See https://github.com/projecthydra/active_fedora/issues/847
accepts_nested_attributes_for :creators, allow_destroy: true, reject_if: proc { |attributes| attributes['name'].blank? }
accepts_nested_attributes_for :translators, allow_destroy: true, reject_if: proc { |attributes| attributes['name'].blank? }
end