Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add link to profiles

See the current Enrichment Profiles.

Code Block
languageruby
titleEnrichment Queue
# a typical enrichment specification: 
enrichment_profile = {
  'Krikri::Enrichments::SplitAtDelimiter' => {
     input_fields: [:rights,
                    { dataProvider: :providedLabel },
                    { sourceResource: :identifier },
                    { sourceResource: :title },
                    { sourceResource: :rights },
                    { sourceResource: :extent },
                    { sourceResource: :dcformat },
                    { sourceResource: :genre },
                    { sourceResource: :dctype }]
  },
  'Krikri::Enrichments::RemoveEmptyFields' => {
     input_fields: [:all]
  },
  'Krikri::Enrichments::StripHtml' => {
     input_fields: [:all]
  },
 'Krikri::Enrichments::StripLeadingColons' => {
    input_fields: [{sourceResource: :title}]
  },
  'Krikri::Enrichments::StripLeadingPunctuation' => {
     input_fields: [{ sourceResource: { creator: :providedLabel } },
                    { sourceResource: { contributor: :providedLabel } },
                    { sourceResource: { publisher: :providedLabel } }]
  },
  'Krikri::Enrichments::StripEndingPunctuation' => {
     input_fields: [{ sourceResource: :title },
                    { sourceResource: { creator: :providedLabel } },
                    { sourceResource: { contributor: :providedLabel } },
                    { sourceResource: { publisher: :providedLabel } }]
  },
 'Krikri::Enrichments::StripWhitespace' => {
    input_fields: [{sourceResource: :title}]
  },
 'Krikri::Enrichments::ParseDate' => {
    input_fields: [{ sourceResource: {date: :begin } },
                   { sourceResource: {date: :end } }]
  },	
 'Krikri::Enrichments::TimespanSplit' => {
    input_fields: [{ sourceResource: :date }]
  },
 'Krikri::Enrichments::DcmiTypeMap' => {
    input_fields: [{ sourceResource: :dctype }]
  }
}
 
# Queue enrichment
activity_uri = Krikri::Activity.find(activity_id).rdf_subject
Krikri::Enricher.enqueue({:generator_uri => activity_uri, :chain => enrichment_profile})
 

...