Class: Krikri::Enrichments::CreatePrefLabelFromProvided
- Inherits:
-
Object
- Object
- Krikri::Enrichments::CreatePrefLabelFromProvided
- Includes:
- Audumbla::FieldEnrichment
- Defined in:
- lib/krikri/enrichments/create_pref_label_from_provided.rb
Overview
Given an field that accepts both providedLabel and prefLabel, copies
the first providedLabel into prefLabel unless one is already present.
Only the first providedLabel is copied, avoiding conflicts with SKOS's
limit of one skos:prefLabel per language tag.
Fields are ignored and returned as-is if:
- they are not `ActiveTriples::Resource`
- they do not respond to `#providedLabel`
- they already have a `prefLabel`
- there are no `providedLabel`s present
Instance Method Summary collapse
Instance Method Details
#enrich_value(value) ⇒ Object
36 37 38 39 40 |
# File 'lib/krikri/enrichments/create_pref_label_from_provided.rb', line 36 def enrich_value(value) return value unless value.is_a?(ActiveTriples::Resource) && value.respond_to?(:providedLabel) add_pref_label(value) end |