Skip to content

Commit

Permalink
Move BasicMetadata out of GenericFile
Browse files Browse the repository at this point in the history
because its used by GenericWorks too.
  • Loading branch information
jcoyne committed Jul 17, 2015
1 parent cbf0a83 commit 066ea0a
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
module CurationConcerns
module BasicMetadata
extend ActiveSupport::Concern

included do

property :label, predicate: ActiveFedora::RDF::Fcrepo::Model.downloadFilename, multiple: false

property :depositor, predicate: ::RDF::URI.new("http://id.loc.gov/vocabulary/relators/dpt"), multiple: false do |index|
index.as :symbol, :stored_searchable
end

property :relative_path, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#relativePath'), multiple: false

property :import_url, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#importUrl'), multiple: false do |index|
index.as :symbol
end

property :part_of, predicate: ::RDF::DC.isPartOf
property :resource_type, predicate: ::RDF::DC.type do |index|
index.as :stored_searchable, :facetable
end
property :title, predicate: ::RDF::DC.title do |index|
index.as :stored_searchable, :facetable
end
property :creator, predicate: ::RDF::DC.creator do |index|
index.as :stored_searchable, :facetable
end
property :contributor, predicate: ::RDF::DC.contributor do |index|
index.as :stored_searchable, :facetable
end
property :description, predicate: ::RDF::DC.description do |index|
index.type :text
index.as :stored_searchable
end
property :tag, predicate: ::RDF::DC.relation do |index|
index.as :stored_searchable, :facetable
end
property :rights, predicate: ::RDF::DC.rights do |index|
index.as :stored_searchable
end
property :publisher, predicate: ::RDF::DC.publisher do |index|
index.as :stored_searchable, :facetable
end
property :date_created, predicate: ::RDF::DC.created do |index|
index.as :stored_searchable
end

# We reserve date_uploaded for the original creation date of the record.
# For example, when migrating data from a fedora3 repo to fedora4,
# fedora's system created date will reflect the date when the record
# was created in fedora4, but the date_uploaded will preserve the
# original creation date from the old repository.
property :date_uploaded, predicate: ::RDF::DC.dateSubmitted, multiple: false do |index|
index.type :date
index.as :stored_sortable
end

property :date_modified, predicate: ::RDF::DC.modified, multiple: false do |index|
index.type :date
index.as :stored_sortable
end
property :subject, predicate: ::RDF::DC.subject do |index|
index.as :stored_searchable, :facetable
end
property :language, predicate: ::RDF::DC.language do |index|
index.as :stored_searchable, :facetable
end
property :identifier, predicate: ::RDF::DC.identifier do |index|
index.as :stored_searchable
end
property :based_near, predicate: ::RDF::FOAF.based_near do |index|
index.as :stored_searchable, :facetable
end
property :related_url, predicate: ::RDF::RDFS.seeAlso do |index|
index.as :stored_searchable
end
property :bibliographic_citation, predicate: ::RDF::DC.bibliographicCitation do |index|
index.as :stored_searchable
end
property :source, predicate: ::RDF::DC.source do |index|
index.as :stored_searchable
end
end

end
end

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module GenericFileBehavior
include CurationConcerns::Permissions
include CurationConcerns::GenericFile::Export
include CurationConcerns::GenericFile::Characterization
include CurationConcerns::GenericFile::BasicMetadata
include CurationConcerns::BasicMetadata
include CurationConcerns::GenericFile::Content
include CurationConcerns::GenericFile::VirusCheck
include CurationConcerns::GenericFile::FullTextIndexing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated by curation_concerns:models:install
class GenericWork < ActiveFedora::Base
include ::CurationConcerns::GenericWorkBehavior
include ::CurationConcerns::GenericFile::BasicMetadata
include ::CurationConcerns::BasicMetadata
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# `rails generate curation_concerns:work <%= class_name %>`
class <%= class_name %> < ActiveFedora::Base
include ::CurationConcerns::GenericWorkBehavior
include ::CurationConcerns::GenericFile::BasicMetadata
include ::CurationConcerns::BasicMetadata
validates_presence_of :title, message: 'Your work must have a title.'
end

0 comments on commit 066ea0a

Please sign in to comment.