Queue an Enrichment Job

See the current Enrichment Profiles.

Enrichment Queue
# a typical enrichment specification: 
enrichment_profile = {
  'Krikri::Enrichments::DedupNodes' => {
    input_fields: [:all]
  },
  'Krikri::Enrichments::SplitProvidedLabelAtDelimiter' => {
    input_fields: [{ sourceResource: :subject },
                   { sourceResource: :spatial },
                   { sourceResource: :creator }]
  },
  'Krikri::Enrichments::CreatePrefLabelFromProvided' => {
    input_fields: [:all]
  },
  'Krikri::Enrichments::SplitAtDelimiter' => {
    input_fields: [:rights,
                   { sourceResource: :identifier },
                   { sourceResource: :rights },
                   { sourceResource: :extent },
                   { sourceResource: :dcformat },
                   { sourceResource: :genre },
                   { sourceResource: :dctype }]
  },
  'Krikri::Enrichments::StripHtml' => {
    input_fields: [:all]
  },
  'Krikri::Enrichments::StripLeadingColons' => {
    input_fields: [{ sourceResource: :title }]
  },
  'Krikri::Enrichments::StripLeadingPunctuation' => {
    input_fields: [{ sourceResource: { creator: :prefLabel } },
                   { sourceResource: { contributor: :prefLabel } },
                   { sourceResource: { publisher: :prefLabel } },
                   { sourceResource: { subject: :prefLabel } },
                   { sourceResource: :dcformat },
                   { sourceResource: :genre }]
  },
  'Krikri::Enrichments::StripEndingPunctuation' => {
    input_fields: [{ sourceResource: :title },
                   { sourceResource: { creator: :prefLabel } },
                   { sourceResource: { contributor: :prefLabel } },
                   { sourceResource: { publisher: :prefLabel } },
                   { sourceResource: { subject: :prefLabel } },
                   { sourceResource: :dcformat },
                   { sourceResource: :genre }]
  },
  'Krikri::Enrichments::StripWhitespace' => {
    input_fields: [:all]
  },
  '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 }]
  },
  'Krikri::Enrichments::GenreFilter' => {
    input_fields: [{ sourceResource: :genre }]
  },
  'Krikri::Enrichments::LanguageToLexvo' => {
    input_fields: [{ sourceResource: :language }]
  },
  'Krikri::Enrichments::DcmiEnforcer' => {
    input_fields: [{ sourceResource: :dctype }]
  },
  'Krikri::Enrichments::TimespanLabel' => {
    input_fields: [{ sourceResource: :date }]
  },
  'Krikri::Enrichments::RemoveEmptyFields' => {
    input_fields: [:all]
  }
}
# Queue enrichment
activity_uri = Krikri::Activity.find(activity_id).rdf_subject
Krikri::Enricher.enqueue({:generator_uri => activity_uri, :chain => enrichment_profile})
 


To Test Enrichments Manually (w/o save)

manual enrichment
# first assign a profile as above
activity_uri = Krikri::Activity.find(id).rdf_subject
enricher = Krikri::Enricher.new(generator_uri: activity_uri, chain: enrichment_profile)
 
# this could be improved :(
agg = enricher.generator_activity.entities.first
enricher.chain_enrichments!(agg)
agg.dump :ttl # to see turtle serialized output