Skip to content

Commit

Permalink
Include predicate details in warning and only warn if the predicates …
Browse files Browse the repository at this point in the history
…do not match; sort internals
  • Loading branch information
dlpierce committed Oct 6, 2023
1 parent 69f238a commit 2782245
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
18 changes: 9 additions & 9 deletions app/services/hyrax/simple_schema_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,20 @@ def metadata_files

def predicate_pairs(ret_hsh, schema_name)
schema_config(schema_name)['attributes'].each do |name, config|
predicate = RDF::URI(config['predicate'])
if ret_hsh[name].blank?
ret_hsh[name.to_sym] = RDF::URI(config['predicate'])
else
multiple_predicate_message(name)
ret_hsh[name.to_sym] = predicate
elsif ret_hsh[name] != predicate
multiple_predicate_message(name, ret_hsh[name], predicate)
end
end
end

def multiple_predicate_message(name)
message = "The attribute of #{name} has been assigned multiple times " \
"within the metadata YAMLs. Please be aware that once the " \
"attribute's predicate value is first assigned, any other value " \
"will be ignored."

def multiple_predicate_message(name, existing, incoming)
message = "The attribute of #{name} has been assigned a predicate multiple times " \
"within the metadata YAMLs. Please be aware that once the attribute's " \
"predicate value is first assigned, any other value will be ignored. " \
"The existing value is #{existing} preventing the use of #{incoming}"
Hyrax.logger.warn(message)
end
end
Expand Down
53 changes: 27 additions & 26 deletions config/metadata/hyrax_internal_metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
---
# This internal metadata config is used to define predicates for hyrax internals only
attributes:
admin_set_id:
access_to:
predicate: http://www.w3.org/ns/auth/acl#accessTo
admin_set_id:
predicate: http://purl.org/dc/terms/isPartOf
id:
predicate: http://purl.org/dc/terms/id
internal_resource:
predicate: info:fedora/fedora-system:def/model#hasModel
representative_id:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasRelatedMediaFragment
state:
predicate: http://fedora.info/definitions/1/0/access/ObjState#objState
thumbnail_id:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasRelatedImage
created_at:
predicate: http://purl.org/dc/terms/created
agent:
predicate: http://www.w3.org/ns/auth/acl#agent
byte_order:
predicate: http://sweet.jpl.nasa.gov/2.2/reprDataFormat.owl#byteOrder
color_space:
predicate: http://www.w3.org/2003/12/exif/ns#colorSpace
compression:
predicate: http://vocabulary.samvera.org/ns#compressionScheme
created_at:
predicate: http://purl.org/dc/terms/created
file_identifier:
predicate: http://vocabulary.samvera.org/ns#fileIdentifier
file_ids:
predicate: http://pcdm.org/models#hasFile
file_set_id:
predicate: http://vocabulary.samvera.org/ns#fileSetId
format_label:
predicate: http://www.loc.gov/premis/rdf/v1#hasFormatName
height:
height:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#height
id:
predicate: http://purl.org/dc/terms/id
internal_resource:
predicate: info:fedora/fedora-system:def/model#hasModel
mime_type:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasMimeType
mode:
predicate: http://www.w3.org/ns/auth/acl#mode
original_filename:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#filename
pcdm_use:
predicate: http://vocabulary.samvera.org/ns#pcdmUse
permissions:
predicate: http://vocabulary.samvera.org/ns#permissions
recorded_size:
predicate: http://www.loc.gov/premis/rdf/v1#hasSize
representative_id:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasRelatedMediaFragment
state:
predicate: http://fedora.info/definitions/1/0/access/ObjState#objState
thumbnail_id:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasRelatedImage
updated_at:
predicate: http://vocabulary.samvera.org/ns#updatedAt
valid:
predicate: http://vocabulary.samvera.org/ns#valid
well_formed:
predicate: http://vocabulary.samvera.org/ns#wellFormed
width:
predicate: http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#width
access_to:
predicate: http://www.w3.org/ns/auth/acl#accessTo
permissions:
predicate: http://vocabulary.samvera.org/ns#permissions
updated_at:
predicate: http://vocabulary.samvera.org/ns#updatedAt
agent:
predicate: http://www.w3.org/ns/auth/acl#agent
mode:
predicate: http://www.w3.org/ns/auth/acl#mode
file_ids:
predicate: http://pcdm.org/models#hasFile

0 comments on commit 2782245

Please sign in to comment.