Class: Krikri::Enrichments::SplitOnProvidedLabel
- Inherits:
-
Object
- Object
- Krikri::Enrichments::SplitOnProvidedLabel
- Includes:
- Audumbla::FieldEnrichment
- Defined in:
- lib/krikri/enrichments/split_on_provided_label.rb
Overview
Splits a resource into multiple resources when multiple providedLabels are present. This is useful when a mapping error or limitation in partner data makes it impossible to split resoureces properly at mapping time.
@note: Properties other than ‘providedLabel` are retained by the original
node. This does not attempt to keep like properties together.
@note: Nodes created by this enrichment share a class with the original
input value.
Instance Method Summary collapse
Instance Method Details
#enrich_value(value) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/krikri/enrichments/split_on_provided_label.rb', line 30 def enrich_value(value) return value unless value.is_a?(ActiveTriples::Resource) && value.respond_to?(:providedLabel) return value unless value.providedLabel.count > 1 split_provided(value) end |