active-fedora 11.1.3 → 11.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +3 -2
  3. data/.rubocop_todo.yml +73 -18
  4. data/.travis.yml +4 -4
  5. data/History.txt +6 -0
  6. data/README.md +1 -1
  7. data/active-fedora.gemspec +5 -4
  8. data/lib/active_fedora.rb +3 -3
  9. data/lib/active_fedora/aggregation/list_source.rb +1 -1
  10. data/lib/active_fedora/associations/association.rb +1 -2
  11. data/lib/active_fedora/associations/basic_contains_association.rb +3 -1
  12. data/lib/active_fedora/associations/builder/association.rb +1 -2
  13. data/lib/active_fedora/associations/null_validator.rb +1 -2
  14. data/lib/active_fedora/attached_files.rb +4 -0
  15. data/lib/active_fedora/attributes/property_builder.rb +3 -3
  16. data/lib/active_fedora/containers/container.rb +1 -2
  17. data/lib/active_fedora/file.rb +2 -3
  18. data/lib/active_fedora/file_configurator.rb +2 -2
  19. data/lib/active_fedora/fixity_service.rb +36 -5
  20. data/lib/active_fedora/indexers/null_indexer.rb +1 -2
  21. data/lib/active_fedora/indexing.rb +34 -15
  22. data/lib/active_fedora/indexing/descendant_fetcher.rb +101 -0
  23. data/lib/active_fedora/indexing/map.rb +11 -3
  24. data/lib/active_fedora/indexing_service.rb +6 -1
  25. data/lib/active_fedora/inheritance.rb +1 -1
  26. data/lib/active_fedora/null_logger.rb +2 -4
  27. data/lib/active_fedora/persistence.rb +2 -2
  28. data/lib/active_fedora/property.rb +1 -2
  29. data/lib/active_fedora/rake_support.rb +1 -1
  30. data/lib/active_fedora/rdf/field_map.rb +2 -2
  31. data/lib/active_fedora/rdf/field_map_entry.rb +7 -5
  32. data/lib/active_fedora/rdf/indexing_service.rb +9 -7
  33. data/lib/active_fedora/relation/finder_methods.rb +2 -1
  34. data/lib/active_fedora/solr_service.rb +2 -1
  35. data/lib/active_fedora/type/value.rb +2 -4
  36. data/lib/active_fedora/version.rb +1 -1
  37. data/lib/active_fedora/with_metadata/metadata_node.rb +2 -0
  38. data/spec/integration/associations_spec.rb +8 -8
  39. data/spec/integration/attached_files_spec.rb +1 -2
  40. data/spec/integration/collection_association_spec.rb +1 -1
  41. data/spec/integration/direct_container_spec.rb +2 -2
  42. data/spec/integration/fedora_solr_sync_spec.rb +1 -1
  43. data/spec/integration/generators/fedora_generator_spec.rb +1 -1
  44. data/spec/integration/generators/solr_generator_spec.rb +1 -1
  45. data/spec/integration/has_many_associations_spec.rb +4 -5
  46. data/spec/integration/indexing_spec.rb +21 -1
  47. data/spec/integration/indirect_container_spec.rb +2 -2
  48. data/spec/integration/solr_hit_spec.rb +1 -1
  49. data/spec/integration/versionable_spec.rb +2 -2
  50. data/spec/unit/attached_files_spec.rb +36 -8
  51. data/spec/unit/attributes_spec.rb +5 -13
  52. data/spec/unit/base_spec.rb +2 -2
  53. data/spec/unit/callback_spec.rb +2 -2
  54. data/spec/unit/change_set_spec.rb +1 -2
  55. data/spec/unit/collection_proxy_spec.rb +2 -1
  56. data/spec/unit/core_spec.rb +3 -3
  57. data/spec/unit/default_model_mapper_spec.rb +1 -1
  58. data/spec/unit/file_path_builder_spec.rb +1 -1
  59. data/spec/unit/file_spec.rb +23 -25
  60. data/spec/unit/files_hash_spec.rb +1 -2
  61. data/spec/unit/filter_spec.rb +2 -2
  62. data/spec/unit/fixity_service_spec.rb +65 -5
  63. data/spec/unit/has_and_belongs_to_many_association_spec.rb +1 -2
  64. data/spec/unit/has_many_association_spec.rb +2 -2
  65. data/spec/unit/indexing/map/index_object_spec.rb +25 -0
  66. data/spec/unit/indexing/map_spec.rb +27 -0
  67. data/spec/unit/indexing_spec.rb +1 -2
  68. data/spec/unit/inheritance_spec.rb +28 -1
  69. data/spec/unit/model_classifier_spec.rb +1 -1
  70. data/spec/unit/pathing_spec.rb +1 -2
  71. data/spec/unit/query_result_builder_spec.rb +1 -2
  72. data/spec/unit/query_spec.rb +1 -1
  73. data/spec/unit/rdf/indexing_service_spec.rb +17 -3
  74. data/spec/unit/reflection_spec.rb +2 -2
  75. data/spec/unit/solr_hit_spec.rb +1 -2
  76. data/spec/unit/solr_service_spec.rb +6 -0
  77. data/spec/unit/sparql_insert_spec.rb +1 -1
  78. data/spec/unit/with_metadata/metadata_node_spec.rb +26 -1
  79. metadata +28 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6fbb07414e2177fa95ea8349817976b1b37a765c
4
- data.tar.gz: 6d2310b2bd54270c779e9f3c183b3aad790b68ad
2
+ SHA256:
3
+ metadata.gz: 2a1b653e61034a472c59722925334b0cfa2d83391a5e8f7ed89678fab2f729ac
4
+ data.tar.gz: 4cd25e244f319ea0eb84e0ea5c5067fc967764695073062ea510c0222dc7814b
5
5
  SHA512:
6
- metadata.gz: 4fa39573b64bac45e116fbe334e657ef3f1b01e15a8a93cade30080c4d55fa2628e2b5de5bb15482880951f401fcea90b5736744ee141190f4ee03847015edd0
7
- data.tar.gz: 14bf26166bc2d0a1e52455686a952922748036d3dd6a756be9e9264c3802032420ce0a0ddc608dcbb49050cea8d26ac3e339b38e3250b2177df4718e1eea2592
6
+ metadata.gz: 86a88288dede46d2a4fe40f1924434004b8f74d0b5452058c9f4aef8256d3147edc4fa62d2a6d1a626451e4cb16b78f9785b8564a694e1c4ded7b03409fdc752
7
+ data.tar.gz: daeb70527556e50848a9407e9dabaf2e5a051c6e942d5a49e01b4c90b6c3d61f92cdae307a781fe3b1d1a957943dd0eeeaa4a1b479f52addc0202154cec4e3aa
@@ -106,7 +106,6 @@ Style/AndOr:
106
106
  Style/AccessorMethodName:
107
107
  Exclude:
108
108
  - 'lib/active_fedora/with_metadata/metadata_node.rb'
109
- - 'lib/active_fedora/predicates.rb'
110
109
  - 'lib/active_fedora/fedora_attributes.rb'
111
110
  - 'lib/active_fedora/attribute_methods/dirty.rb'
112
111
  - 'lib/active_fedora/associations/has_many_association.rb'
@@ -207,7 +206,6 @@ Style/ClassVars:
207
206
  - 'spec/unit/finder_methods_spec.rb'
208
207
  - 'spec/unit/base_spec.rb'
209
208
  - 'spec/integration/indexing_spec.rb'
210
- - 'lib/active_fedora/predicates.rb'
211
209
  - 'lib/active_fedora/identifiable.rb'
212
210
 
213
211
  Style/SignalException:
@@ -266,3 +264,6 @@ RSpec/DescribedClass:
266
264
 
267
265
  RSpec/NotToNot:
268
266
  Enabled: false
267
+
268
+ RSpec/MessageSpies:
269
+ Enabled: false
@@ -1,20 +1,23 @@
1
- require: rubocop-rspec
2
-
3
1
  # This configuration was generated by
4
2
  # `rubocop --auto-gen-config`
5
- # on 2016-08-25 16:34:38 -0700 using RuboCop version 0.42.0.
3
+ # on 2017-02-28 19:30:31 -0600 using RuboCop version 0.47.1.
6
4
  # The point is for the user to remove these configuration records
7
5
  # one by one as the offenses are removed from the code base.
8
6
  # Note that changes in the inspected code, or installation of new
9
7
  # versions of RuboCop, may require this file to be generated again.
10
8
 
11
- # Offense count: 116
12
- # Configuration parameters: Max.
13
- RSpec/ExampleLength:
9
+ # Offense count: 211
10
+ # Configuration parameters: CountComments, ExcludedMethods.
11
+ Metrics/BlockLength:
12
+ Max: 577
13
+
14
+ # Offense count: 65
15
+ RSpec/BeforeAfterAll:
14
16
  Enabled: false
15
17
 
16
- # Offense count: 40
17
- RSpec/LeadingSubject:
18
+ # Offense count: 114
19
+ # Configuration parameters: Max.
20
+ RSpec/ExampleLength:
18
21
  Enabled: false
19
22
 
20
23
  # Offense count: 15
@@ -32,24 +35,76 @@ RSpec/MessageChain:
32
35
  Exclude:
33
36
  - 'spec/unit/file_spec.rb'
34
37
 
35
- # Offense count: 218
36
- # Configuration parameters: EnforcedStyle, SupportedStyles.
37
- # SupportedStyles: allow, expect
38
- RSpec/MessageExpectation:
39
- Enabled: false
40
-
41
- # Offense count: 238
38
+ # Offense count: 241
42
39
  RSpec/MultipleExpectations:
43
40
  Max: 8
44
41
 
45
- # Offense count: 394
46
- # Configuration parameters: MaxNesting.
42
+ # Offense count: 181
43
+ # Configuration parameters: Max.
47
44
  RSpec/NestedGroups:
48
45
  Enabled: false
49
46
 
47
+ # Offense count: 24
48
+ RSpec/ScatteredSetup:
49
+ Exclude:
50
+ - 'spec/integration/base_spec.rb'
51
+ - 'spec/integration/direct_container_spec.rb'
52
+ - 'spec/integration/has_and_belongs_to_many_associations_spec.rb'
53
+ - 'spec/integration/indexing_spec.rb'
54
+ - 'spec/integration/indirect_container_spec.rb'
55
+ - 'spec/integration/json_serialization_spec.rb'
56
+ - 'spec/unit/attached_files_spec.rb'
57
+ - 'spec/unit/base_spec.rb'
58
+ - 'spec/unit/loadable_from_json_spec.rb'
59
+ - 'spec/unit/rdf/indexing_service_spec.rb'
60
+
50
61
  # Offense count: 94
51
62
  RSpec/SubjectStub:
52
- Enabled: false
63
+ Exclude:
64
+ - 'spec/integration/associations_spec.rb'
65
+ - 'spec/integration/autosave_association_spec.rb'
66
+ - 'spec/integration/versionable_spec.rb'
67
+ - 'spec/unit/attached_files_spec.rb'
68
+ - 'spec/unit/base_extra_spec.rb'
69
+ - 'spec/unit/file_configurator_spec.rb'
70
+ - 'spec/unit/file_spec.rb'
71
+ - 'spec/unit/has_and_belongs_to_many_association_spec.rb'
72
+ - 'spec/unit/persistence_spec.rb'
73
+ - 'spec/unit/solr_config_options_spec.rb'
74
+ - 'spec/unit/validations_spec.rb'
53
75
 
76
+ # Offense count: 20
77
+ # Configuration parameters: IgnoreSymbolicNames.
54
78
  RSpec/VerifiedDoubles:
79
+ Exclude:
80
+ - 'spec/unit/association_hash_spec.rb'
81
+ - 'spec/unit/files_hash_spec.rb'
82
+ - 'spec/unit/query_spec.rb'
83
+ - 'spec/unit/schema_indexing_strategy_spec.rb'
84
+ - 'spec/unit/solr_config_options_spec.rb'
85
+ - 'spec/unit/solr_service_spec.rb'
86
+
87
+ # Offense count: 3
88
+ Rails/FilePath:
89
+ Exclude:
90
+ - 'lib/active_fedora/file_configurator.rb'
91
+ - 'spec/unit/file_configurator_spec.rb'
92
+
93
+ # Offense count: 2
94
+ Security/MarshalLoad:
95
+ Exclude:
96
+ - 'spec/integration/marshal_spec.rb'
97
+
98
+ # Offense count: 20
99
+ # Configuration parameters: MinBodyLength.
100
+ Style/GuardClause:
55
101
  Enabled: false
102
+
103
+ # Offense count: 20
104
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
105
+ # SupportedStyles: snake_case, normalcase, non_integer
106
+ Style/VariableNumber:
107
+ Exclude:
108
+ - 'spec/integration/associations_spec.rb'
109
+ - 'spec/unit/ordered_spec.rb'
110
+ - 'spec/unit/orders/ordered_list_spec.rb'
@@ -1,12 +1,12 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
- rvm: 2.4.0
4
+ rvm: 2.4.1
5
5
  matrix:
6
6
  include:
7
- - rvm: 2.3.3
8
- env: "RAILS_VERSION=4.2.7.1"
9
- - env: "RSOLR_VERSION=2.0.0.pre1"
7
+ - rvm: 2.3.4
8
+ env: "RAILS_VERSION=4.2.8"
9
+ - env: "RSOLR_VERSION=2.0.1"
10
10
  global_env:
11
11
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
12
12
  before_install:
@@ -1,3 +1,9 @@
1
+ v11.2.1
2
+ 2017-06-12 — Bump LDP version to ~> 0.7.0 [Justin Coyne]
3
+
4
+ v11.2.0
5
+ (History is missing)
6
+
1
7
  v11.1.2
2
8
  2017-01-25: Eager load all the code in eager_load blocks [Justin Coyne]
3
9
 
data/README.md CHANGED
@@ -81,7 +81,7 @@ solr_wrapper
81
81
  To start FCRepo, open another shell and run:
82
82
 
83
83
  ```bash
84
- fcrepo_wrapper -p 8984
84
+ fcrepo_wrapper -p 8986
85
85
  ```
86
86
 
87
87
  Now you’re ready to run the tests. In the directory where active\_fedora
@@ -20,20 +20,21 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency "activemodel", '>= 4.2', '< 6'
21
21
  s.add_dependency "active-triples", '~> 0.11.0'
22
22
  s.add_dependency "deprecation"
23
- s.add_dependency "ldp", '~> 0.6.0'
23
+ s.add_dependency "ldp", '~> 0.7.0'
24
+ s.add_dependency "ruby-progressbar", '~> 1.0'
24
25
 
25
26
  s.add_development_dependency "rails"
26
27
  s.add_development_dependency "rdoc"
27
28
  s.add_development_dependency "yard"
28
29
  s.add_development_dependency "rake"
29
- s.add_development_dependency "solr_wrapper", "~> 0.15"
30
+ s.add_development_dependency "solr_wrapper", "~> 1.0"
30
31
  s.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
31
32
  s.add_development_dependency "rspec", "~> 3.0"
32
33
  s.add_development_dependency "rspec-its"
33
34
  s.add_development_dependency "equivalent-xml"
34
35
  s.add_development_dependency "simplecov", '~> 0.8'
35
- s.add_development_dependency "rubocop", '~> 0.42.0'
36
- s.add_development_dependency "rubocop-rspec", '~> 1.8.0'
36
+ s.add_development_dependency "rubocop", '~> 0.47.1'
37
+ s.add_development_dependency "rubocop-rspec", '~> 1.12.0'
37
38
 
38
39
  s.files = `git ls-files`.split("\n")
39
40
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
@@ -196,11 +196,11 @@ module ActiveFedora #:nodoc:
196
196
  # ActiveFedora.environment => "test"
197
197
  def environment
198
198
  if config_options.fetch(:environment, nil)
199
- return config_options[:environment]
199
+ config_options[:environment]
200
200
  elsif defined?(Rails.env) && !Rails.env.nil?
201
- return Rails.env.to_s
201
+ Rails.env.to_s
202
202
  elsif defined?(ENV['environment']) && !ENV['environment'].nil?
203
- return ENV['environment']
203
+ ENV['environment']
204
204
  elsif defined?(ENV['RAILS_ENV']) && !ENV['RAILS_ENV'].nil?
205
205
  raise "You're depending on RAILS_ENV for setting your environment. Please use ENV['environment'] for non-rails environment setting: 'rake foo:bar environment=test'"
206
206
  else
@@ -80,7 +80,7 @@ module ActiveFedora
80
80
  # Set node subjects to a term in AF JUST so that AF will persist the
81
81
  # sub-graphs.
82
82
  # TODO: Find a way to fix this.
83
- self.nodes = nil
83
+ resource.set_value(:nodes, [])
84
84
  self.nodes += graph.subjects.to_a
85
85
  ordered_self.changes_committed!
86
86
  end
@@ -202,8 +202,7 @@ module ActiveFedora
202
202
  # the target is stale.
203
203
  #
204
204
  # This is only relevant to certain associations, which is why it returns nil by default.
205
- def stale_state
206
- end
205
+ def stale_state; end
207
206
 
208
207
  def build_record(attributes)
209
208
  reflection.build_association(attributes) do |record|
@@ -22,7 +22,9 @@ module ActiveFedora
22
22
  # Update the membership triples (and no other triples) on the the owner's resource
23
23
  if owner.persisted?
24
24
  pattern = ::RDF::Query::Pattern.new(predicate: options[:predicate])
25
- new_resource = owner.dup.reload.resource
25
+ new_resource = ActiveFedora::Base.uncached do
26
+ owner.dup.reload.resource
27
+ end
26
28
  owner.resource.delete_insert([pattern], new_resource.query(pattern))
27
29
  end
28
30
  super
@@ -63,8 +63,7 @@ module ActiveFedora::Associations::Builder
63
63
  name
64
64
  end
65
65
 
66
- def self.define_extensions(_model, _name)
67
- end
66
+ def self.define_extensions(_model, _name); end
68
67
 
69
68
  def self.define_callbacks(model, reflection)
70
69
  if dependent = reflection.options[:dependent]
@@ -2,7 +2,6 @@ module ActiveFedora::Associations
2
2
  ##
3
3
  # An association type validator which does no validation.
4
4
  class NullValidator
5
- def self.validate!(_reflection, _object)
6
- end
5
+ def self.validate!(_reflection, _object); end
7
6
  end
8
7
  end
@@ -33,7 +33,11 @@ module ActiveFedora
33
33
  resource.query(subject: resource, predicate: ::RDF::Vocab::LDP.contains).objects.map(&:to_s)
34
34
  end
35
35
 
36
+ # Load any undeclared relationships or has_subresource relationships. These are non-idiomatic LDP
37
+ # because we are going to find the subresource by knowing it's subpath ahead of time.
38
+ # Does nothing if this object is using idiomatic basic containment, by declaring `is_a_container`
36
39
  def load_attached_files
40
+ return if reflections[:contains] && reflections[:contains].macro == :is_a_container
37
41
  contains_assertions.each do |file_uri|
38
42
  path = file_uri.to_s.sub(uri + '/', '')
39
43
  next if association(path.to_sym)
@@ -16,7 +16,7 @@ module ActiveFedora::Attributes
16
16
  mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
17
17
  def #{name}=(value)
18
18
  if value.present? && !value.respond_to?(:each)
19
- raise ArgumentError, "You attempted to set the property `#{name}' to a scalar value. However, this property is declared as being multivalued."
19
+ raise ArgumentError, "You attempted to set the property `#{name}' of \#{id} to a scalar value. However, this property is declared as being multivalued."
20
20
  end
21
21
  set_value(:#{name}, value)
22
22
  end
@@ -28,7 +28,7 @@ module ActiveFedora::Attributes
28
28
  def #{name}(*args)
29
29
  vals = get_values(:#{name})
30
30
  return nil unless vals
31
- raise ActiveFedora::ConstraintError, "Expected \\"#{name}\\" to have 0-1 statements, but there are \#{vals.size}" if vals.size > 1
31
+ raise ActiveFedora::ConstraintError, "Expected \\"#{name}\\" of \#{id} to have 0-1 statements, but there are \#{vals.size}" if vals.size > 1
32
32
  vals.first
33
33
  end
34
34
  CODE
@@ -46,7 +46,7 @@ module ActiveFedora::Attributes
46
46
  mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
47
47
  def #{name}=(value)
48
48
  if value.respond_to?(:each) # singular
49
- raise ArgumentError, "You attempted to set the property `#{name}' to an enumerable value. However, this property is declared as singular."
49
+ raise ArgumentError, "You attempted to set the property `#{name}' of \#{id} to an enumerable value. However, this property is declared as singular."
50
50
  end
51
51
  set_value(:#{name}, value)
52
52
  end
@@ -28,7 +28,6 @@ module ActiveFedora
28
28
  private
29
29
 
30
30
  # Don't allow directly setting contained
31
- def contained=(*_args)
32
- end
31
+ def contained=(*_args); end
33
32
  end
34
33
  end
@@ -40,7 +40,7 @@ module ActiveFedora
40
40
  id = ActiveFedora::Associations::IDComposite.new([identifier], translate_uri_to_id).first
41
41
  @ldp_source = build_ldp_resource id
42
42
  else
43
- raise "The first argument to #{self} must be a Hash, String or RDF::URI. You provided a #{uri.class}"
43
+ raise "The first argument to #{self} must be a Hash, String or RDF::URI. You provided a #{identifier.class}"
44
44
  end
45
45
 
46
46
  @attributes = {}.with_indifferent_access
@@ -140,8 +140,7 @@ module ActiveFedora
140
140
  end
141
141
 
142
142
  # serializes any changed data into the content field
143
- def serialize!
144
- end
143
+ def serialize!; end
145
144
 
146
145
  def to_solr(solr_doc = {}, _opts = {})
147
146
  solr_doc
@@ -108,7 +108,7 @@ module ActiveFedora
108
108
  end
109
109
 
110
110
  begin
111
- fedora_yml = YAML.load(config_erb)
111
+ fedora_yml = YAML.safe_load(config_erb, [], [], true) # allow YAML aliases
112
112
  rescue Psych::SyntaxError => e
113
113
  raise "fedora.yml was found, but could not be parsed. " \
114
114
  "Error #{e.message}"
@@ -132,7 +132,7 @@ module ActiveFedora
132
132
  end
133
133
 
134
134
  begin
135
- solr_yml = YAML.load(config_erb)
135
+ solr_yml = YAML.safe_load(config_erb, [], [], true) # allow YAML aliases
136
136
  rescue StandardError
137
137
  raise("solr.yml was found, but could not be parsed.\n")
138
138
  end
@@ -2,26 +2,57 @@ module ActiveFedora
2
2
  class FixityService
3
3
  extend ActiveSupport::Concern
4
4
 
5
- attr_accessor :target, :response
5
+ attr_accessor :target
6
6
 
7
- # @param [String, RDF::URI] target url for a Fedora resource
7
+ # @param [String, RDF::URI] target url for a Fedora resource.
8
8
  def initialize(target)
9
9
  raise ArgumentError, 'You must provide a uri' unless target
10
10
  @target = target.to_s
11
11
  end
12
12
 
13
- # Executes a fixity check on Fedora and saves the Faraday::Response.
13
+ def response
14
+ @response ||= fixity_response_from_fedora
15
+ end
16
+
17
+ # For backwards compat, check always insists on doing a new request.
18
+ # you might want verified? instead which uses a cached request.
14
19
  # @return true or false
15
20
  def check
16
- @response = fixity_response_from_fedora
21
+ @response = nil
22
+ verified?
23
+ end
24
+
25
+ # Executes a fixity check on Fedora
26
+ # @return true or false
27
+ def verified?
17
28
  status.include?(success)
18
29
  end
19
30
 
31
+ # An array of 1 or more literals reported by Fedora.
32
+ # See 'success' for which one indicates fixity check is good.
20
33
  def status
21
34
  fixity_graph.query(predicate: premis_status_predicate).map(&:object) +
22
35
  fixity_graph.query(predicate: fedora_status_predicate).map(&:object)
23
36
  end
24
37
 
38
+ # the currently calculated checksum, as a string URI, like
39
+ # "urn:sha1:09a848b79f86f3a4f3f301b8baafde455d6f8e0e"
40
+ def expected_message_digest
41
+ fixity_graph.query(predicate: ::RDF::Vocab::PREMIS.hasMessageDigest).first.try(:object).try(:to_s)
42
+ end
43
+
44
+ # integer, as reported by fedora. bytes maybe?
45
+ def expected_size
46
+ fixity_graph.query(predicate: ::RDF::Vocab::PREMIS.hasSize).first.try(:object).try(:to_s).try(:to_i)
47
+ end
48
+
49
+ # Fedora response as an ::RDF::Graph object. Public API, so consumers
50
+ # can do with it what they will, especially if future fedora versions
51
+ # add more things to it.
52
+ def response_graph
53
+ fixity_graph
54
+ end
55
+
25
56
  private
26
57
 
27
58
  def premis_status_predicate
@@ -46,7 +77,7 @@ module ActiveFedora
46
77
  end
47
78
 
48
79
  def fixity_graph
49
- ::RDF::Graph.new << ::RDF::Reader.for(:ttl).new(response.body)
80
+ @fixity_graph ||= ::RDF::Graph.new << ::RDF::Reader.for(:ttl).new(response.body)
50
81
  end
51
82
 
52
83
  # See https://jira.duraspace.org/browse/FCREPO-1247
@@ -7,7 +7,6 @@ module ActiveFedora::Indexers
7
7
  self
8
8
  end
9
9
 
10
- def index(_)
11
- end
10
+ def index(_); end
12
11
  end
13
12
  end