Module: Krikri::SoftwareAgent

Extended by:
ActiveSupport::Concern
Included in:
Enricher, Harvester, Indexer, Mapper::Agent
Defined in:
lib/krikri/software_agent.rb

Overview

SoftwareAgent is a mixin for logic common to classes that carry out the work involved in a Krikri::Activity. This corresponds to a prov:SoftwareAgent within PROV-O & PROV-DM.

Software Agents should handle internal errors that do not result in full activity failure, and raise a RuntimeError when the job fails. Activity handles logging of activity start/stop, and failure status.

Implementers must provide a #run method.

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entity_behaviorKrikri::EntityBehavior

Returns the entity initialization behavior to use with this SoftwareAgent.

Returns:

See Also:



23
# File 'lib/krikri/software_agent.rb', line 23

included { attr_accessor :entity_behavior }

Instance Method Details

#agent_nameString

Return an agent name suitable for saving in an Activity. This is the name of the most-derived class upon which this is invoked.

Returns:

  • (String)

See Also:



31
32
33
# File 'lib/krikri/software_agent.rb', line 31

def agent_name
  self.class.agent_name
end

#runBoolean

This method is abstract.

Perform this agent's work. The method may accept an activity_uri to record as the prov:Activity in provenance metadata. If so, the implementation must be optional and handle nil values by declining to record provenance

Returns true if the run has succeeded; otherwise false.

Returns:

  • (Boolean)

    true if the run has succeeded; otherwise false

Raises:

  • (RuntimeError)

    when the software agent's process fails

See Also:



47
48
49
# File 'lib/krikri/software_agent.rb', line 47

def run
  fail NotImplementedError
end