krikri 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/krikri/activity.rb +34 -8
  3. data/lib/generators/krikri/templates/schema.xml +1 -0
  4. data/lib/generators/krikri/templates/solrconfig.xml +1 -0
  5. data/lib/krikri/async_uri_getter.rb +27 -0
  6. data/lib/krikri/engine.rb +19 -4
  7. data/lib/krikri/enricher.rb +3 -6
  8. data/lib/krikri/entity_behavior.rb +57 -11
  9. data/lib/krikri/entity_behaviors/aggregation_entity_behavior.rb +1 -1
  10. data/lib/krikri/entity_behaviors/original_record_entity_behavior.rb +1 -1
  11. data/lib/krikri/entity_consumer.rb +40 -17
  12. data/lib/krikri/indexer.rb +7 -7
  13. data/lib/krikri/mapper.rb +23 -14
  14. data/lib/krikri/search_index.rb +4 -0
  15. data/lib/krikri/software_agent.rb +8 -4
  16. data/lib/krikri/version.rb +1 -1
  17. data/spec/internal/Gemfile +3 -3
  18. data/spec/internal/Gemfile.lock +28 -28
  19. data/spec/internal/app/assets/javascripts/application.js +1 -1
  20. data/spec/internal/config/initializers/blacklight_initializer.rb +1 -1
  21. data/spec/internal/config/initializers/devise.rb +2 -2
  22. data/spec/internal/config/secrets.yml +2 -2
  23. data/spec/internal/db/development.sqlite3 +0 -0
  24. data/spec/internal/db/migrate/{20160304151204_devise_create_users.rb → 20160226160200_devise_create_users.rb} +0 -0
  25. data/spec/internal/db/migrate/{20160304151247_create_searches.blacklight.rb → 20160226160226_create_searches.blacklight.rb} +0 -0
  26. data/spec/internal/db/migrate/{20160304151248_create_bookmarks.blacklight.rb → 20160226160227_create_bookmarks.blacklight.rb} +0 -0
  27. data/spec/internal/db/migrate/{20160304151249_add_polymorphic_type_to_bookmarks.blacklight.rb → 20160226160228_add_polymorphic_type_to_bookmarks.blacklight.rb} +0 -0
  28. data/spec/internal/db/schema.rb +1 -1
  29. data/spec/internal/db/test.sqlite3 +0 -0
  30. data/spec/internal/log/development.log +92 -92
  31. data/spec/lib/krikri/async_uri_getter_spec.rb +31 -7
  32. data/spec/lib/krikri/entity_consumer_spec.rb +37 -7
  33. data/spec/lib/krikri/harvester_spec.rb +7 -3
  34. data/spec/lib/krikri/indexer_spec.rb +7 -4
  35. data/spec/lib/krikri/mapper_agent_spec.rb +10 -9
  36. data/spec/lib/krikri/search_index_spec.rb +3 -6
  37. data/spec/models/activity_spec.rb +32 -0
  38. data/spec/models/dpla/map/aggregation_spec.rb +40 -21
  39. data/spec/models/provider_spec.rb +2 -9
  40. data/spec/spec_helper.rb +1 -2
  41. data/spec/support/shared_contexts/indexed_item.rb +1 -3
  42. data/spec/support/shared_examples/software_agent.rb +1 -1
  43. metadata +11 -14
  44. data/lib/generators/krikri/templates/schema.xml +0 -767
  45. data/lib/generators/krikri/templates/solrconfig.xml +0 -160
  46. data/spec/internal/log/test.log +0 -8537
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ac6156f3d3dfd9164e4598d0b236bff739885ed
4
- data.tar.gz: 437640a56aa024e4bcb4b58a58a70e02d3f8edb5
3
+ metadata.gz: 66d34d2d357a32a8406cd36a09e0333abec7ac0f
4
+ data.tar.gz: af0783e05398a667a1380bd0cad675ec546b489d
5
5
  SHA512:
6
- metadata.gz: 9bdc4b60c7c533c4ed27d635c14fa11bef703037729edc5e4b31c80376f450289f1fb369c6f5e36d5de3ced9edd8162591d2f651bff01b6c63a1505c33861217
7
- data.tar.gz: f2cc707b635d75265947eccc27617310199721186831e84b6d75ab64dab4178471631df760a5db5f01f8dff2dd42c305d8c47876216858ab0295b8035d9d6666
6
+ metadata.gz: 9806d3d2968791b32b743c49bf5b4ab9bda09bf44533680f194560b51adcab7948067f3d8df067dec6b74567c93c3648d3ca531c8c0be279ed7adcbfee13c3b9
7
+ data.tar.gz: 97087dbff34ec494908a678f8b02d37b61c3110ae8aef07c769dbe09b3092e116dc814f0dd020f50d53c1d0d777abe9dfffbadb169077f8b4a99eb489e553275
@@ -10,16 +10,42 @@ module Krikri
10
10
  class Activity < ActiveRecord::Base
11
11
  # @!attribute agent
12
12
  # @return [String] a string representing the Krikri::SoftwareAgent
13
- # responsible for the activity.
13
+ # responsible for the activity.
14
+ # @!attribute start_time
15
+ # @return [DateTime] a datestamp marking the activity's start
14
16
  # @!attribute end_time
15
17
  # @return [DateTime] a datestamp marking the activity's competion
16
18
  # @!attribute opts
17
19
  # @return [JSON] the options to pass to the #agent class when running
18
- # the activity
19
- # @!attribute start_time
20
- # @return [DateTime] a datestamp marking the activity's start
20
+ # the activity
21
+
21
22
  validate :agent_must_be_a_software_agent
22
23
 
24
+ ##
25
+ # @example building a valid URI from the base
26
+ # Krikri::Activity.base_uri / 1
27
+ #
28
+ # @return [RDF::URI] the configured base URI for this class
29
+ def self.base_uri
30
+ RDF::URI.intern(Krikri::Settings['marmotta']['ldp']) /
31
+ Krikri::Settings['prov']['activity']
32
+ end
33
+
34
+ ##
35
+ # @param uri [#to_s] a uri for this activity
36
+ #
37
+ # @return [Krikri::Activity] the activity with the given uri
38
+ #
39
+ # @raise [RuntimeError] if the URI form does not match the activity
40
+ # @raise [ActiveRecord::RecordNotFound] if no activity is found
41
+ def self.from_uri(uri)
42
+ raise "Cannot find #{self} from URI: #{uri}; " \
43
+ "the requested uri does not match #{base_uri}" unless
44
+ uri.start_with? base_uri
45
+
46
+ find(uri.to_s.sub(base_uri.to_s, '').sub('/', ''))
47
+ end
48
+
23
49
  def agent_must_be_a_software_agent
24
50
  errors.add(:agent, 'does not represent a SoftwareAgent') unless
25
51
  agent.constantize < Krikri::SoftwareAgent
@@ -81,7 +107,9 @@ module Krikri
81
107
  def agent_instance
82
108
  @agent_instance ||= agent.constantize.new(parsed_opts)
83
109
  end
84
-
110
+
111
+ ##
112
+ # @return [Hash] the options parsed as JSON
85
113
  def parsed_opts
86
114
  JSON.parse(opts, symbolize_names: true)
87
115
  end
@@ -89,11 +117,9 @@ module Krikri
89
117
  ##
90
118
  # @return [RDF::URI] the uri for this activity
91
119
  def rdf_subject
92
- RDF::URI(Krikri::Settings['marmotta']['ldp']) /
93
- Krikri::Settings['prov']['activity'] / id.to_s
120
+ self.class.base_uri / id.to_s
94
121
  end
95
122
  alias_method :to_term, :rdf_subject
96
-
97
123
 
98
124
  ##
99
125
  # @return [String] a string reprerestation of the activity
@@ -0,0 +1 @@
1
+ ../../../../solr_conf/schema.xml
@@ -0,0 +1 @@
1
+ ../../../../solr_conf/solrconfig.xml
@@ -51,6 +51,8 @@ module Krikri
51
51
  # redirects.
52
52
  # @option opts [Integer] :max_redirects Number of redirects to follow before
53
53
  # giving up. (default: 10)
54
+ # @option opts [Boolean] :inline_exceptions If true, pass exceptions as a
55
+ # 5xx response with the exception string in the body. (default: false)
54
56
  def initialize(opts: {})
55
57
  @default_opts = { max_redirects: MAX_REDIRECTS }.merge(opts)
56
58
  end
@@ -80,16 +82,41 @@ module Krikri
80
82
  # Wait for the request thread to complete
81
83
  def join
82
84
  @request_thread.join
85
+ rescue => e
86
+ # If the join throws an exception, the thread is dead anyway. The
87
+ # subsequent call to `with_response` will propagate the exception to the
88
+ # calling thread.
89
+ raise e unless inline_exceptions?
83
90
  end
84
91
 
85
92
  ##
86
93
  # @yield [Faraday::Response] the response returned for the request
87
94
  def with_response
88
95
  yield @request_thread.value
96
+ rescue => e
97
+ if inline_exceptions?
98
+ # Deliver an error response to the caller to allow uniform access
99
+ msg = e.message + "\n\n" + e.backtrace.join("\n")
100
+ yield Faraday::Response.new(status: 500,
101
+ body: msg,
102
+ response_headers: {
103
+ 'X-Exception' => e,
104
+ 'X-Exception-Message' => e.message,
105
+ 'X-Internal-Response' => 'true'
106
+ })
107
+ else
108
+ raise e
109
+ end
89
110
  end
90
111
 
91
112
  private
92
113
 
114
+ ##
115
+ # True if we are using inline exceptions
116
+ def inline_exceptions?
117
+ opts.fetch(:inline_exceptions, false)
118
+ end
119
+
93
120
  ##
94
121
  # Run the Faraday request in a new thread
95
122
  def start_request
data/lib/krikri/engine.rb CHANGED
@@ -129,13 +129,13 @@ module Krikri
129
129
  # Get the persisted original record for this Aggregation.
130
130
  # @return [Krikri::OriginalRecord, nil]
131
131
  #
132
- # @raise [NameError] when the original record id is not a URI or the
133
- # the original record has not been persisted to Marmotta.
132
+ # @raise [NameError] when the original record is empty or is a blank
133
+ # node.
134
134
  #
135
135
  # @raise [Faraday::ConnectionError] when there is a connection problem
136
136
  # with Marmotta.
137
137
  def original_record
138
- raise NameError, "#{originalRecord.first} is not an OriginalRecord" if
138
+ raise NameError, no_origrec_message if
139
139
  originalRecord.empty? || originalRecord.first.node?
140
140
  Krikri::OriginalRecord.load(originalRecord.first.rdf_subject
141
141
  .to_s)
@@ -164,10 +164,25 @@ module Krikri
164
164
 
165
165
  def mint_id_fragment(seed = nil)
166
166
  return seed if seed
167
- return SecureRandom.hex if
167
+ # We rely on originalRecord for consistent ID minting, so we have to
168
+ # raise an exception if it's empty or is a blank node; for example,
169
+ # if a mapping failed to map it.
170
+ raise NameError, no_origrec_message if
168
171
  originalRecord.empty? || originalRecord.first.node?
169
172
  local_name_from_original_record
170
173
  end
174
+
175
+ def no_origrec_message
176
+ "#{dpla_id} #{no_origrec_cond}"
177
+ end
178
+
179
+ def no_origrec_cond
180
+ if originalRecord.empty?
181
+ "has an empty originalRecord"
182
+ else
183
+ "has a blank node for its originalRecord"
184
+ end
185
+ end
171
186
  end
172
187
  end
173
188
 
@@ -2,9 +2,8 @@ module Krikri
2
2
  ##
3
3
  # A SoftwareAgent that runs enrichment processes.
4
4
  #
5
- # @example
6
- #
7
- # To enrich records that were mapped by the mapping activity with ID 3:
5
+ # @example to enrich records that were mapped by the mapping activity
6
+ # with ID 3:
8
7
  #
9
8
  # # Define which enrichments are run, and thier parameters:
10
9
  # chain = {
@@ -43,7 +42,6 @@ module Krikri
43
42
  # @see Audumbla::Enrichment
44
43
  # @param opts [Hash] a hash of options
45
44
  def initialize(opts = {})
46
- @generator_uri = RDF::URI(opts.fetch(:generator_uri))
47
45
  @chain = deep_sym(opts.fetch(:chain) { {} })
48
46
  @entity_behavior = self.class.entity_behavior
49
47
  assign_generator_activity!(opts)
@@ -56,8 +54,7 @@ module Krikri
56
54
  # instantiation, and apply each enrichment from the enrichment chain.
57
55
  #
58
56
  def run(activity_uri = nil)
59
- mapped_records = generator_activity.entities
60
- mapped_records.each do |rec|
57
+ entities.each do |rec|
61
58
  begin
62
59
  chain_enrichments!(rec)
63
60
  activity_uri ? rec.save_with_provenance(activity_uri) : rec.save
@@ -1,19 +1,36 @@
1
1
 
2
2
  module Krikri
3
3
  ##
4
- # Base class for behaviors related to entities that are generated or revised
5
- # by activities.
4
+ # Base class for retrieval behaviors related to entities that were generated
5
+ # or revised by a `Krikri::Activity`.
6
6
  #
7
- # A SoftwareAgent implements #entity_behavior, which returns an appropriate
8
- # subclass of EntityBehavior. When an Activity is queried for its entities,
9
- # it instantiates an instance of its particular SoftwareAgent, and then
10
- # calls the #entities method of the agent's entity behavior.
7
+ # @example implementing an entity behavior
8
+ # class CustomBehavior < Krikri::EntityBehavior
9
+ # def entities(load = true, include_invalidated = false)
10
+ # activity_uris(include_invalidated) do |uri|
11
+ # # some behavior over URIs to return initialized entities
12
+ # end
13
+ # end
14
+ # end
15
+ #
16
+ # @example retrieving entities with a behavior
17
+ # Krikri::Activity.find(activity_id)
18
+ # CustomBehavor.entities(activity)
19
+ #
20
+ # A `SoftwareAgent` implements `#entity_behavior`, which returns an appropriate
21
+ # subclass of `EntityBehavior`. When an Activity is queried for its entities,
22
+ # it instantiates an instance of its particular `SoftwareAgent`, and then
23
+ # calls the `#entities` method of the agent's entity behavior.
11
24
  #
12
25
  # @see Krikri::Activity#entities
13
26
  # @see lib/krikri/entity_behaviors
14
- #
15
27
  class EntityBehavior
28
+ # @!attribute [r] activity
29
+ # @return [Krikri::Activity]
16
30
  attr_reader :activity
31
+
32
+ ##
33
+ # @param activity [Krikri::Activity]
17
34
  def initialize(activity)
18
35
  @activity = activity
19
36
  end
@@ -21,20 +38,49 @@ module Krikri
21
38
  ##
22
39
  # Return an Enumerator of objects that have been affected by our @activity.
23
40
  #
24
- # @return [Enumerator] objects
41
+ # @param load [Boolean] `true` to force load the entities from the datastore
42
+ # on access
43
+ # @param include_invalidated [Boolean] `true` to include entities marked as
44
+ # invalid.
45
+ #
46
+ # @return [Enumerator] the entities. When possible, they should be
47
+ # initialized & retrieved lazily.
48
+ #
49
+ #
25
50
  # @see lib/krikri/entity_behaviors
26
51
  # @see Krikri::Activity#entities
27
52
  #
53
+ # @see Krikri::LDP::Invalidatable for more about "invalidated" entities
28
54
  def entities(*args)
29
- raise NotImplementedError
55
+ raise NotImplementedError
30
56
  end
31
57
 
32
58
  ##
33
- # @see Krikri::Activity#entities
34
- # @see Krikri::EntityBehavior#entities
59
+ # Initializes an instance of this class with the given `Activity` and
60
+ # returns an enumerator of the associated entities.
35
61
  #
62
+ # @param activity [Krikri::Activity]
63
+ # @param load [Boolean]
64
+ # @param include_invalidated [Boolean]
65
+ #
66
+ # @see Krikri::EntityBehavior#entities
67
+ # @see Krikri::Activity#entities
36
68
  def self.entities(activity, *args)
37
69
  new(activity).entities(*args)
38
70
  end
71
+
72
+ private
73
+
74
+ ##
75
+ # Private utility method capturing common logic for applying entity logic to
76
+ # uris gathered from the instance's `Krikri::Activity`.
77
+ #
78
+ # @param include_invalided [Boolean]
79
+ #
80
+ # @return [Enumerator::Lazy] the uris, lazily mapped to the behavior in the
81
+ # given block
82
+ def activity_uris(include_invalidated, &block)
83
+ activity.entity_uris(include_invalidated).lazy.map(&block)
84
+ end
39
85
  end
40
86
  end
@@ -22,7 +22,7 @@ module Krikri
22
22
  # @return [Enumerator] DPLA::MAP::Aggregation objects
23
23
  #
24
24
  def entities(load = true, include_invalidated = false)
25
- @activity.entity_uris(include_invalidated).lazy.map do |uri|
25
+ activity_uris(include_invalidated) do |uri|
26
26
  agg = DPLA::MAP::Aggregation.new(uri)
27
27
  agg.get if load
28
28
  agg
@@ -23,7 +23,7 @@ module Krikri
23
23
  # @return [Enumerator] OriginalRecord objects
24
24
  #
25
25
  def entities(load = true, include_invalidated = false)
26
- @activity.entity_uris(include_invalidated).lazy.map do |uri|
26
+ activity_uris(include_invalidated) do |uri|
27
27
  load ? OriginalRecord.load(uri) : OriginalRecord.new(uri)
28
28
  end
29
29
  end
@@ -1,15 +1,21 @@
1
1
  module Krikri
2
2
  ##
3
- # A mixin for classes, like certain software agents, that generates entities.
4
- # For example, a mapper usually generates RDF aggregations, such that
5
- # Mapper::Agent includes EntityConsumer, and a mapper agent is instantiated
6
- # with
7
- # a = Krikri::Mapper::Agent.new({
8
- # generator_uri: 'http://some.org/activity/1'
9
- # })
10
- # such that
11
- # a.generator_activity
12
- # returns a Krikri::Activity
3
+ # A mixin for `Krikri::SoftwareAgent`s that use entities. Provides a
4
+ # mechanism for setting an `#entity_source` and consuming entities.
5
+ #
6
+ # For backwards compatability, this supports an older interface where entities
7
+ # are selected based on a `generator_activity`.
8
+ #
9
+ # @example the deprecated interface
10
+ # class AnAgent
11
+ # include Krikri::EntityConsumer
12
+ # end
13
+ #
14
+ # agent = AnAgent.new
15
+ # agent.assign_generator_activity!(generator_uri:
16
+ # Krikri::Activity.find(1).rdf_subject)
17
+ #
18
+ # agent.generator_activity.entities
13
19
  #
14
20
  module EntityConsumer
15
21
  extend ActiveSupport::Concern
@@ -32,17 +38,34 @@ module Krikri
32
38
  #
33
39
  # @see Krikri::Mapper::Agent
34
40
  # @see Krikri::Harvester
35
- #
36
41
  def assign_generator_activity!(opts)
37
42
  if opts.include?(:generator_uri)
38
43
  generator_uri = opts.delete(:generator_uri)
39
- # allow generator_uri to be string or RDF::URI with `to_s' ...
40
- activity_id = generator_uri.to_s[/\d+$/].to_i # 0 if no match
41
- fail "Can not determine ID for #{generator_uri}" if activity_id == 0
42
- @generator_activity = Krikri::Activity.find_by_id(activity_id)
43
- raise "Generator activity not found for id #{activity_id}" \
44
- unless @generator_activity
44
+ @entity_source =
45
+ @generator_activity = Krikri::Activity.from_uri(generator_uri)
45
46
  end
46
47
  end
48
+
49
+ ##
50
+ # @return [Enumerator<Krikri::LDP::Resource>] entities this agent will use
51
+ def entities
52
+ entity_source ? entity_source.entities : []
53
+ end
54
+
55
+ ##
56
+ # @return [#entities, nil]
57
+ def entity_source
58
+ @entity_source
59
+ end
60
+
61
+ ##
62
+ # Sets the entity source to a new instance of the provided class,
63
+ # initialized with the provided arguments and block.
64
+ #
65
+ # @param klass [Class] a class with an instance method `#entities`
66
+ # @return [void]
67
+ def set_entity_source!(klass, *args, &block)
68
+ @entity_source = klass.new(*args, &block)
69
+ end
47
70
  end
48
71
  end
@@ -2,21 +2,21 @@ module Krikri
2
2
  ##
3
3
  # A SoftwareAgent to run indexing processes.
4
4
  #
5
- # @example
6
- #
7
- # To index records enriched by the enrichment activity with ID 3:
8
- #
5
+ # @example To index records enriched by the enrichment activity with ID 3:
9
6
  # Krikri::Indexer.enqueue({
10
7
  # index_class: 'Krikri::QASearchIndex',
11
8
  # generator_uri: 'http://ldp.local.dp.la/ldp/activity/3'
12
9
  # some_option_for_index_class: 'abc'
13
10
  # })
14
11
  #
15
- # The options hash contains options for the Indexer as well as the
16
- # SearchIndex.
12
+ # The options hash contains options for the `Indexer` as well as the
13
+ # `SearchIndex`.
17
14
  #
15
+ # @todo use generalized `EntityConsumer` interface that is independent from
16
+ # `Activity`. `#index` needs to be largely rewritten due to
17
+ # `#update_from_activity`, which is tighly bound to `Activity` rather than
18
+ # `Enumerator<#entities>`.
18
19
  # @see Krikri::SoftwareAgent#enqueue
19
- #
20
20
  class Indexer
21
21
  include SoftwareAgent
22
22
  include EntityConsumer
data/lib/krikri/mapper.rb CHANGED
@@ -75,38 +75,48 @@ module Krikri
75
75
  ##
76
76
  # A SoftwareAgent to run mapping processes.
77
77
  #
78
- # @example
79
- #
80
- # To map the records harvested by the harvest activity with ID 1:
81
- #
82
- # Krikri::Mapper::Agent.enqueue(
83
- # :mapping,
84
- # opts = {
85
- # name: 'scdl_qdc',
86
- # generator_uri: 'http://ldp.local.dp.la/ldp/activity/1'
87
- # }
88
- # )
78
+ # @example to map the records harvested by the harvest activity with ID 1:
79
+ # Krikri::Mapper::Agent.enqueue(name: :scdl_qdc,
80
+ # generator_uri: 'http://ldp.local.dp.la/ldp/activity/1')
89
81
  #
90
82
  # @see: Krikri::SoftwareAgent, Krikri::Activity
91
83
  class Agent
92
84
  include SoftwareAgent
93
85
  include EntityConsumer
94
86
 
87
+ # @!attribute [r] name
88
+ # @return [Symbol]
95
89
  attr_reader :name
96
90
 
91
+ ##
92
+ # @return [Symbol] the default queue for jobs using this agent
97
93
  def self.queue_name
98
94
  :mapping
99
95
  end
100
96
 
97
+ ##
98
+ # @see Krikri::Activity#entities
99
+ # @see Krikri::EntityBehavior
100
+ # @see Krikri::SoftwareAgent#entity_behavior
101
+ def entity_behavior
102
+ @entity_behavior ||= Krikri::AggregationEntityBehavior
103
+ end
104
+
105
+ ##
106
+ # @param opts [Hash]
107
+ # @option opts [#to_sym] name the symbol naming the mapping to use
101
108
  def initialize(opts = {})
102
109
  @name = opts.fetch(:name).to_sym
103
110
  @entity_behavior = self.class.entity_behavior
104
111
  assign_generator_activity!(opts)
105
112
  end
106
113
 
114
+ ##
115
+ # @param activity_uri [RDF::URI] the uri of the activity to attribute
116
+ # for provenance purposes (default: nil)
117
+ # @see SoftwareAgent#run
107
118
  def run(activity_uri = nil)
108
- harvest_records = generator_activity.entities
109
- Krikri::Mapper.map(name, harvest_records).each do |rec|
119
+ Krikri::Mapper.map(name, entities).each do |rec|
110
120
  begin
111
121
  rec.mint_id! if rec.node?
112
122
  activity_uri ? rec.save_with_provenance(activity_uri) : rec.save
@@ -116,7 +126,6 @@ module Krikri
116
126
  end
117
127
  end
118
128
  end
119
-
120
129
  end
121
130
  end
122
131
  end
@@ -6,6 +6,10 @@ module Krikri
6
6
  ##
7
7
  # Search index base class that gets extended by QA and Production index
8
8
  # classes
9
+ #
10
+ # @todo rewrite to use generalized `EntityConsumer` interface & avoid
11
+ # `#update_from_activity`, which is tighly bound to `Activity` rather than
12
+ # `Enumerator<#entities>`.
9
13
  class SearchIndex
10
14
  def initialize(opts)
11
15
  @bulk_update_size = opts.delete(:bulk_update_size) { 10 }
@@ -1,13 +1,17 @@
1
1
  module Krikri
2
2
  ##
3
- # SoftwareAgent is a mixin for logic common to code that generates a
4
- # `Krikri::Activity`.
3
+ # SoftwareAgent is a mixin for logic common to classes that carry out the
4
+ # work involved in a `Krikri::Activity`. This corresponds to a
5
+ # prov:SoftwareAgent within PROV-O & PROV-DM.
5
6
  #
6
7
  # Software Agents should handle internal errors that do not result in full
7
8
  # activity failure, and raise a `RuntimeError` when the job fails. `Activity`
8
9
  # handles logging of activity start/stop, and failure status.
9
10
  #
11
+ # Implementers must provide a `#run` method.
12
+ #
10
13
  # @see Krikri::Activity
14
+ # @see https://www.w3.org/TR/prov-dm/#concept-software-agent
11
15
  module SoftwareAgent
12
16
  extend ActiveSupport::Concern
13
17
 
@@ -30,13 +34,13 @@ module Krikri
30
34
 
31
35
  ##
32
36
  # @abstract Perform this agent's work. The method may accept an
33
- # `activity_uri` to record as the Activity in provenance metadata.
37
+ # `activity_uri` to record as the prov:Activity in provenance metadata.
34
38
  # If so, the implementation must be optional and handle `nil` values by
35
39
  # declining to record provenance
36
40
  #
37
41
  # @return [Boolean] `true` if the run has succeeded; otherwise `false`
38
42
  #
39
- # @raise [RuntimeError] when the software agent's activity fails
43
+ # @raise [RuntimeError] when the software agent's process fails
40
44
  #
41
45
  # @see Krirkri::Activity
42
46
  # @see Krikri::Job.run
@@ -1,3 +1,3 @@
1
1
  module Krikri
2
- VERSION = '0.12.0'.freeze
2
+ VERSION = '0.12.1'.freeze
3
3
  end
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
 
4
4
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
- gem 'rails', '4.1.9'
5
+ gem 'rails', '4.1.14.1'
6
6
  # Use sqlite3 as the database for Active Record
7
7
  gem 'sqlite3'
8
8
  # Use SCSS for stylesheets
@@ -11,7 +11,7 @@ gem 'sass-rails', '~> 4.0.3'
11
11
  gem 'uglifier', '>= 1.3.0'
12
12
  # Use CoffeeScript for .js.coffee assets and views
13
13
  gem 'coffee-rails', '~> 4.0.0'
14
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
14
+ # See https://github.com/rails/execjs#readme for more supported runtimes
15
15
  # gem 'therubyracer', platforms: :ruby
16
16
 
17
17
  # Use jquery as the JavaScript library
@@ -36,7 +36,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc
36
36
  # gem 'debugger', group: [:development, :test]
37
37
 
38
38
 
39
- gem 'krikri', :path => '/vagrant'
39
+ gem 'krikri', :path => '/Users/mark/Documents/Code/dpla/KriKri'
40
40
 
41
41
  gem "factory_girl_rails", "~> 4.4.0", group: :development
42
42
  gem "jettywrapper", "~> 2.0", group: :development