ddr-models 2.0.1 → 2.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -17
  3. data/app/models/collection.rb +1 -35
  4. data/ddr-models.gemspec +2 -1
  5. data/lib/ddr/actions.rb +1 -0
  6. data/lib/ddr/actions/virus_check.rb +28 -0
  7. data/lib/ddr/auth.rb +4 -0
  8. data/lib/ddr/auth/ability_definitions/datastream_ability_definitions.rb +7 -5
  9. data/lib/ddr/auth/grouper_gateway.rb +9 -1
  10. data/lib/ddr/auth/permissions.rb +2 -1
  11. data/lib/ddr/auth/role_based_access_controls_enforcement.rb +5 -5
  12. data/lib/ddr/auth/roles/role_types.rb +2 -1
  13. data/lib/ddr/datastreams.rb +2 -2
  14. data/lib/ddr/datastreams/administrative_metadata_datastream.rb +27 -14
  15. data/lib/ddr/datastreams/datastream_behavior.rb +13 -0
  16. data/lib/ddr/datastreams/fits_datastream.rb +88 -0
  17. data/lib/ddr/derivatives/png_generator.rb +2 -0
  18. data/lib/ddr/derivatives/ptif_generator.rb +2 -0
  19. data/lib/ddr/events/fixity_check_event.rb +2 -2
  20. data/lib/ddr/events/virus_check_event.rb +2 -14
  21. data/lib/ddr/index.rb +29 -0
  22. data/lib/ddr/index/abstract_query_result.rb +23 -0
  23. data/lib/ddr/index/connection.rb +17 -0
  24. data/lib/ddr/index/csv_query_result.rb +61 -0
  25. data/lib/ddr/index/document_builder.rb +9 -0
  26. data/lib/ddr/index/field.rb +23 -0
  27. data/lib/ddr/index/fields.rb +83 -0
  28. data/lib/ddr/index/filter.rb +48 -0
  29. data/lib/ddr/index/filters.rb +19 -0
  30. data/lib/ddr/index/legacy_license_fields.rb +14 -0
  31. data/lib/ddr/index/query.rb +35 -0
  32. data/lib/ddr/index/query_builder.rb +74 -0
  33. data/lib/ddr/index/query_clause.rb +52 -0
  34. data/lib/ddr/index/query_result.rb +70 -0
  35. data/lib/ddr/index/query_value.rb +16 -0
  36. data/lib/ddr/index/response.rb +13 -0
  37. data/lib/ddr/index/unique_key_field.rb +12 -0
  38. data/lib/ddr/index_fields.rb +7 -53
  39. data/lib/ddr/jobs.rb +1 -1
  40. data/lib/ddr/jobs/fits_file_characterization.rb +51 -0
  41. data/lib/ddr/managers.rb +1 -0
  42. data/lib/ddr/managers/technical_metadata_manager.rb +104 -0
  43. data/lib/ddr/models.rb +39 -23
  44. data/lib/ddr/models/base.rb +0 -2
  45. data/lib/ddr/models/describable.rb +1 -1
  46. data/lib/ddr/models/effective_license.rb +9 -0
  47. data/lib/ddr/models/engine.rb +13 -0
  48. data/lib/ddr/models/file_management.rb +157 -160
  49. data/lib/ddr/models/governable.rb +0 -4
  50. data/lib/ddr/models/has_admin_metadata.rb +80 -72
  51. data/lib/ddr/models/has_children.rb +1 -1
  52. data/lib/ddr/models/has_content.rb +18 -0
  53. data/lib/ddr/models/has_struct_metadata.rb +5 -1
  54. data/lib/ddr/models/indexing.rb +32 -20
  55. data/lib/ddr/models/inherited_license.rb +13 -0
  56. data/lib/ddr/models/license.rb +38 -0
  57. data/lib/ddr/models/solr_document.rb +195 -211
  58. data/lib/ddr/models/version.rb +1 -1
  59. data/lib/ddr/models/year_facet.rb +154 -0
  60. data/lib/ddr/utils.rb +13 -1
  61. data/lib/ddr/vocab/roles.rb +0 -10
  62. data/spec/controllers/including_role_based_access_controls_enforcement_spec.rb +4 -4
  63. data/spec/datastreams/fits_datastream_spec.rb +84 -0
  64. data/spec/fixtures/fits/document.xml +65 -0
  65. data/spec/fixtures/fits/image.xml +59 -0
  66. data/spec/index/filter_spec.rb +47 -0
  67. data/spec/index/filters_spec.rb +17 -0
  68. data/spec/index/query_spec.rb +19 -0
  69. data/spec/jobs/fits_file_characterization_spec.rb +52 -0
  70. data/spec/managers/technical_metadata_manager_spec.rb +140 -0
  71. data/spec/models/active_fedora_datastream_spec.rb +44 -0
  72. data/spec/models/collection_spec.rb +7 -12
  73. data/spec/models/component_spec.rb +3 -6
  74. data/spec/models/effective_license_spec.rb +49 -0
  75. data/spec/models/has_admin_metadata_spec.rb +143 -194
  76. data/spec/models/has_struct_metadata_spec.rb +2 -2
  77. data/spec/models/indexing_spec.rb +40 -0
  78. data/spec/models/solr_document_spec.rb +96 -37
  79. data/spec/models/year_facet_spec.rb +65 -0
  80. data/spec/spec_helper.rb +1 -7
  81. data/spec/support/shared_examples_for_ddr_models.rb +0 -2
  82. data/spec/support/shared_examples_for_has_content.rb +37 -3
  83. metadata +79 -32
  84. data/lib/ddr/datastreams/properties_datastream.rb +0 -25
  85. data/lib/ddr/jobs/migrate_legacy_authorization.rb +0 -23
  86. data/lib/ddr/models/has_properties.rb +0 -15
  87. data/lib/ddr/models/licensable.rb +0 -28
  88. data/spec/auth/legacy_authorization_spec.rb +0 -94
  89. data/spec/auth/legacy_roles_spec.rb +0 -32
  90. data/spec/jobs/migrate_legacy_authorization_spec.rb +0 -43
  91. data/spec/support/shared_examples_for_has_properties.rb +0 -5
  92. data/spec/support/shared_examples_for_licensable.rb +0 -15
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "2.0.1"
3
+ VERSION = "2.1.0.rc1"
4
4
  end
5
5
  end
@@ -0,0 +1,154 @@
1
+ require "date"
2
+
3
+ module Ddr::Models
4
+ class YearFacet
5
+
6
+ EARLIEST_YEAR = 1000
7
+
8
+ # Between 1965 and 1968
9
+ BETWEEN = Regexp.new '\A([Bb]etween\s+)(\d{4})(\s+and\s+)(\d{4})\??\z'
10
+
11
+ # YYYx (192x)
12
+ # YYYX (192X)
13
+ # YYY? (192?)
14
+ # YYY- (192-)
15
+ # YYY-? (192-?)
16
+ IN_DECADE = Regexp.new '\A(\d{3})([xX\-]\??|\?)\z'
17
+
18
+ # YYxx (19xx)
19
+ IN_CENTURY = Regexp.new '\A(\d{2})xx\z'
20
+
21
+ # YYY0s (1920s)
22
+ # YYY0s? (1920s?)
23
+ DECADE = Regexp.new '\A(\d{3}0)s\??\z'
24
+
25
+ # YYYY-MM (2010-01)
26
+ # YYYY/MM (2010/01)
27
+ YEAR_MONTH = Regexp.new '\A(\d{4})[/-](0[1-9]|1[0-2])\z'
28
+
29
+ # YYYY-YYYY (1935-2010)
30
+ # YYYY/YYYY (1935/2010)
31
+ YEAR_RANGE = Regexp.new '\A(\d{4})[/-](\d{4})\z'
32
+
33
+ # YYYY (1979)
34
+ YEAR = Regexp.new '\A\d{4}\z'
35
+
36
+ SQUARE_BRACKETS = Regexp.new '[\[\]]'
37
+
38
+ # c. 1920
39
+ # ca. 1920
40
+ # c1920
41
+ CIRCA = Regexp.new '\b(circa\s+|ca?\.\s*|c(?=\d{4}[^\d]*))'
42
+
43
+ class << self
44
+ def call(obj)
45
+ new(obj).values
46
+ end
47
+ end
48
+
49
+ attr_reader :obj, :values
50
+
51
+ def initialize(obj)
52
+ @obj = obj
53
+ @values = []
54
+ facet_values
55
+ end
56
+
57
+ def facet_values
58
+ obj.date.each do |date|
59
+ date.split(/;/).each do |value|
60
+ clean! value
61
+ years = extract_years(value)
62
+ validate! years
63
+ values.push *years
64
+ end
65
+ end
66
+ end
67
+
68
+ def extract_years(value)
69
+ years = match_years(value) || parse_year(value)
70
+ Array(years)
71
+ end
72
+
73
+ def clean!(value)
74
+ value.strip!
75
+ value.gsub! SQUARE_BRACKETS, ""
76
+ value.gsub! CIRCA, ""
77
+ end
78
+
79
+ def validate!(years)
80
+ years = years & valid_years.to_a
81
+ end
82
+
83
+ def parse_year(value)
84
+ Date.parse(value).year
85
+ rescue ArgumentError
86
+ nil
87
+ end
88
+
89
+ def valid_years
90
+ (EARLIEST_YEAR..latest_year)
91
+ end
92
+
93
+ def latest_year
94
+ Date.today.year + 100
95
+ end
96
+
97
+ def match_years(value)
98
+ result = match_year_range(value) ||
99
+ match_year_month(value) ||
100
+ match_year(value) ||
101
+ match_in_decade(value) ||
102
+ match_in_century(value) ||
103
+ match_decade(value) ||
104
+ match_between(value)
105
+ first_year, last_year = Array(result).map(&:to_i)
106
+ last_year ? (first_year..last_year) : first_year
107
+ end
108
+
109
+ def match_year_range(value)
110
+ if m = YEAR_RANGE.match(value)
111
+ m[1, 2]
112
+ end
113
+ end
114
+
115
+ def match_year_month(value)
116
+ if m = YEAR_MONTH.match(value)
117
+ m[1]
118
+ end
119
+ end
120
+
121
+ def match_year(value)
122
+ if m = YEAR.match(value)
123
+ value
124
+ end
125
+ end
126
+
127
+ def match_in_decade(value)
128
+ if m = IN_DECADE.match(value)
129
+ [ "#{m[1]}0", "#{m[1]}9" ]
130
+ end
131
+ end
132
+
133
+ def match_in_century(value)
134
+ if m = IN_CENTURY.match(value)
135
+ [ "#{m[1]}00", "#{m[1]}99" ]
136
+ end
137
+ end
138
+
139
+ def match_decade(value)
140
+ if m = DECADE.match(value)
141
+ [ m[1], m[1].sub(/0\z/, "9") ]
142
+ end
143
+ end
144
+
145
+ def match_between(value)
146
+ if m = BETWEEN.match(value)
147
+ value.sub! m[1], "" # [Bb]etween
148
+ value.sub! m[3], "-" # and
149
+ match_year_range(value)
150
+ end
151
+ end
152
+
153
+ end
154
+ end
@@ -93,7 +93,7 @@ module Ddr::Utils
93
93
  model = opts.fetch(:model, nil)
94
94
  collection = opts.fetch(:collection, nil)
95
95
  objs = []
96
- ActiveFedora::Base.find_each( { Ddr::IndexFields::IDENTIFIER_ALL => identifier }, { :cast => true } ) { |o| objs << o }
96
+ ActiveFedora::Base.find_each( { Ddr::Index::Fields::IDENTIFIER_ALL => identifier }, { :cast => true } ) { |o| objs << o }
97
97
  pids = []
98
98
  objs.each { |obj| pids << obj.pid }
99
99
  if model.present?
@@ -157,4 +157,16 @@ module Ddr::Utils
157
157
  return klass
158
158
  end
159
159
 
160
+ # Returns a string suitable to index as a Solr date
161
+ # @param dt [Date, DateTime, Time] the date/time
162
+ # @return [String]
163
+ def self.solr_date(dt)
164
+ return if dt.nil?
165
+ dt.to_time.utc.iso8601
166
+ end
167
+
168
+ def self.solr_dates(dts)
169
+ dts.map { |dt| solr_date(dt) }
170
+ end
171
+
160
172
  end
@@ -2,8 +2,6 @@ module Ddr
2
2
  module Vocab
3
3
  class Roles < RDF::StrictVocabulary("http://repository.lib.duke.edu/vocab/roles/")
4
4
 
5
- LEGACY_ROLES = [:administrator, :editor, :contributor, :downloader]
6
-
7
5
  term :Role,
8
6
  label: "Role",
9
7
  comment: "An assertion of a role granted to an agent."
@@ -24,14 +22,6 @@ module Ddr
24
22
  label: "Scope",
25
23
  comment: "The scope within which the role applies."
26
24
 
27
- #
28
- # Deprecated terms
29
- #
30
-
31
- LEGACY_ROLES.each do |legacy_role|
32
- term legacy_role, label: legacy_role.to_s.capitalize
33
- end
34
-
35
25
  end
36
26
  end
37
27
  end
@@ -14,9 +14,9 @@ RSpec.describe ApplicationController, type: :controller do
14
14
  describe "#resource_role_filters" do
15
15
  it "should include clauses for each agent for the current ability" do
16
16
  expect(subject.resource_role_filters.split(" OR "))
17
- .to contain_exactly("_query_:\"{!raw f=#{Ddr::IndexFields::RESOURCE_ROLE}}foo\"",
18
- "_query_:\"{!raw f=#{Ddr::IndexFields::RESOURCE_ROLE}}bar\"",
19
- "_query_:\"{!raw f=#{Ddr::IndexFields::RESOURCE_ROLE}}#{user.agent}\"")
17
+ .to contain_exactly("_query_:\"{!raw f=#{Ddr::Index::Fields::RESOURCE_ROLE}}foo\"",
18
+ "_query_:\"{!raw f=#{Ddr::Index::Fields::RESOURCE_ROLE}}bar\"",
19
+ "_query_:\"{!raw f=#{Ddr::Index::Fields::RESOURCE_ROLE}}#{user.agent}\"")
20
20
  end
21
21
  end
22
22
 
@@ -41,7 +41,7 @@ RSpec.describe ApplicationController, type: :controller do
41
41
  allow(subject).to receive(:policy_role_policies) { ["info:fedora/test:13", "info:fedora/test:45"] }
42
42
  end
43
43
  it "should include clauses for is_governed_by relationships to the #policy_role_policies" do
44
- expect(subject.policy_role_filters).to eq("_query_:\"{!raw f=#{Ddr::IndexFields::IS_GOVERNED_BY}}info:fedora/test:13\" OR _query_:\"{!raw f=#{Ddr::IndexFields::IS_GOVERNED_BY}}info:fedora/test:45\"")
44
+ expect(subject.policy_role_filters).to eq("_query_:\"{!raw f=#{Ddr::Index::Fields::IS_GOVERNED_BY}}info:fedora/test:13\" OR _query_:\"{!raw f=#{Ddr::Index::Fields::IS_GOVERNED_BY}}info:fedora/test:45\"")
45
45
  end
46
46
  end
47
47
 
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ module Ddr::Datastreams
4
+ RSpec.describe FitsDatastream do
5
+
6
+ let(:fits_xml) do
7
+ <<-XML
8
+ <?xml version="1.0" encoding="UTF-8"?>
9
+ <fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.5" timestamp="7/3/15 8:29 PM">
10
+ <identification>
11
+ <identity format="Portable Document Format" mimetype="application/pdf" toolname="FITS" toolversion="0.8.5">
12
+ <tool toolname="Jhove" toolversion="1.5" />
13
+ <tool toolname="file utility" toolversion="5.04" />
14
+ <tool toolname="Exiftool" toolversion="9.13" />
15
+ <tool toolname="Droid" toolversion="6.1.3" />
16
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.4GA" />
17
+ <tool toolname="ffident" toolversion="0.2" />
18
+ <tool toolname="Tika" toolversion="1.3" />
19
+ <version toolname="Jhove" toolversion="1.5">1.6</version>
20
+ <externalIdentifier toolname="Droid" toolversion="6.1.3" type="puid">fmt/20</externalIdentifier>
21
+ </identity>
22
+ </identification>
23
+ <fileinfo>
24
+ <size toolname="Jhove" toolversion="1.5">3786205</size>
25
+ <creatingApplicationName toolname="Exiftool" toolversion="9.13" status="CONFLICT">Adobe Acrobat Pro 11.0.3 Paper Capture Plug-in/PREMIS Editorial Committee</creatingApplicationName>
26
+ <creatingApplicationName toolname="NLNZ Metadata Extractor" toolversion="3.4GA" status="CONFLICT">Adobe Acrobat Pro 11.0.3 Paper Capture Plug-in/Acrobat PDFMaker 11 for Word</creatingApplicationName>
27
+ <lastmodified toolname="Exiftool" toolversion="9.13" status="CONFLICT">2015:06:25 21:45:24-04:00</lastmodified>
28
+ <lastmodified toolname="Tika" toolversion="1.3" status="CONFLICT">2015-06-08T21:22:35Z</lastmodified>
29
+ <created toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">2015:06:05 15:16:23-04:00</created>
30
+ <filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/dc/Downloads/premis-3-0-final.pdf</filepath>
31
+ <filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">premis-3-0-final.pdf</filename>
32
+ <md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">432ab76d650bfdc8f8d4a98cea9634bb</md5checksum>
33
+ <fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1435283124000</fslastmodified>
34
+ </fileinfo>
35
+ <filestatus>
36
+ <well-formed toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">true</well-formed>
37
+ <valid toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">false</valid>
38
+ <message toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">Invalid page tree node offset=390028</message>
39
+ <message toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">Outlines contain recursive references.</message>
40
+ </filestatus>
41
+ <metadata>
42
+ <document>
43
+ <title toolname="Jhove" toolversion="1.5" status="CONFLICT">CONTENTS</title>
44
+ <title toolname="Exiftool" toolversion="9.13" status="CONFLICT">PREMIS Data Dictionary for Preservation Metadata, Version 3.0</title>
45
+ <author toolname="Exiftool" toolversion="9.13">PREMIS Editorial Committee</author>
46
+ <language toolname="Jhove" toolversion="1.5">en</language>
47
+ <pageCount toolname="Exiftool" toolversion="9.13">282</pageCount>
48
+ <isTagged toolname="Jhove" toolversion="1.5" status="CONFLICT">no</isTagged>
49
+ <isTagged toolname="NLNZ Metadata Extractor" toolversion="3.4GA" status="CONFLICT">yes</isTagged>
50
+ <hasOutline toolname="Jhove" toolversion="1.5">yes</hasOutline>
51
+ <hasAnnotations toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">no</hasAnnotations>
52
+ <isRightsManaged toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">no</isRightsManaged>
53
+ <isProtected toolname="Exiftool" toolversion="9.13">no</isProtected>
54
+ <hasForms toolname="NLNZ Metadata Extractor" toolversion="3.4GA" status="SINGLE_RESULT">yes</hasForms>
55
+ <subject toolname="Tika" toolversion="1.3" status="SINGLE_RESULT">PREMIS</subject>
56
+ </document>
57
+ </metadata>
58
+ <statistics fitsExecutionTime="2977">
59
+ <tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
60
+ <tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
61
+ <tool toolname="Jhove" toolversion="1.5" executionTime="1034" />
62
+ <tool toolname="file utility" toolversion="5.04" executionTime="912" />
63
+ <tool toolname="Exiftool" toolversion="9.13" executionTime="842" />
64
+ <tool toolname="Droid" toolversion="6.1.3" executionTime="336" />
65
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.4GA" executionTime="2192" />
66
+ <tool toolname="OIS File Information" toolversion="0.2" executionTime="351" />
67
+ <tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
68
+ <tool toolname="ffident" toolversion="0.2" executionTime="410" />
69
+ <tool toolname="Tika" toolversion="1.3" executionTime="2911" />
70
+ </statistics>
71
+ </fits>
72
+ XML
73
+ end
74
+
75
+ before do
76
+ subject.content = fits_xml
77
+ end
78
+
79
+ it "should exclude Exiftool from modified" do
80
+ expect(subject.modified).to eq(["2015-06-08T21:22:35Z"])
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,65 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.5" timestamp="7/3/15 8:29 PM">
3
+ <identification>
4
+ <identity format="Portable Document Format" mimetype="application/pdf" toolname="FITS" toolversion="0.8.5">
5
+ <tool toolname="Jhove" toolversion="1.5" />
6
+ <tool toolname="file utility" toolversion="5.04" />
7
+ <tool toolname="Exiftool" toolversion="9.13" />
8
+ <tool toolname="Droid" toolversion="6.1.3" />
9
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.4GA" />
10
+ <tool toolname="ffident" toolversion="0.2" />
11
+ <tool toolname="Tika" toolversion="1.3" />
12
+ <version toolname="Jhove" toolversion="1.5">1.6</version>
13
+ <externalIdentifier toolname="Droid" toolversion="6.1.3" type="puid">fmt/20</externalIdentifier>
14
+ </identity>
15
+ </identification>
16
+ <fileinfo>
17
+ <size toolname="Jhove" toolversion="1.5">3786205</size>
18
+ <creatingApplicationName toolname="Exiftool" toolversion="9.13" status="CONFLICT">Adobe Acrobat Pro 11.0.3 Paper Capture Plug-in/PREMIS Editorial Committee</creatingApplicationName>
19
+ <creatingApplicationName toolname="NLNZ Metadata Extractor" toolversion="3.4GA" status="CONFLICT">Adobe Acrobat Pro 11.0.3 Paper Capture Plug-in/Acrobat PDFMaker 11 for Word</creatingApplicationName>
20
+ <lastmodified toolname="Exiftool" toolversion="9.13" status="CONFLICT">2015:06:25 21:45:24-04:00</lastmodified>
21
+ <lastmodified toolname="Tika" toolversion="1.3" status="CONFLICT">2015-06-08T21:22:35Z</lastmodified>
22
+ <created toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">2015:06:05 15:16:23-04:00</created>
23
+ <filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/dc/Downloads/premis-3-0-final.pdf</filepath>
24
+ <filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">premis-3-0-final.pdf</filename>
25
+ <md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">432ab76d650bfdc8f8d4a98cea9634bb</md5checksum>
26
+ <fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1435283124000</fslastmodified>
27
+ </fileinfo>
28
+ <filestatus>
29
+ <well-formed toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">true</well-formed>
30
+ <valid toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">false</valid>
31
+ <message toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">Invalid page tree node offset=390028</message>
32
+ <message toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">Outlines contain recursive references.</message>
33
+ </filestatus>
34
+ <metadata>
35
+ <document>
36
+ <title toolname="Jhove" toolversion="1.5" status="CONFLICT">CONTENTS</title>
37
+ <title toolname="Exiftool" toolversion="9.13" status="CONFLICT">PREMIS Data Dictionary for Preservation Metadata, Version 3.0</title>
38
+ <author toolname="Exiftool" toolversion="9.13">PREMIS Editorial Committee</author>
39
+ <language toolname="Jhove" toolversion="1.5">en</language>
40
+ <pageCount toolname="Exiftool" toolversion="9.13">282</pageCount>
41
+ <isTagged toolname="Jhove" toolversion="1.5" status="CONFLICT">no</isTagged>
42
+ <isTagged toolname="NLNZ Metadata Extractor" toolversion="3.4GA" status="CONFLICT">yes</isTagged>
43
+ <hasOutline toolname="Jhove" toolversion="1.5">yes</hasOutline>
44
+ <hasAnnotations toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">no</hasAnnotations>
45
+ <isRightsManaged toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">no</isRightsManaged>
46
+ <isProtected toolname="Exiftool" toolversion="9.13">no</isProtected>
47
+ <hasForms toolname="NLNZ Metadata Extractor" toolversion="3.4GA" status="SINGLE_RESULT">yes</hasForms>
48
+ <subject toolname="Tika" toolversion="1.3" status="SINGLE_RESULT">PREMIS</subject>
49
+ </document>
50
+ </metadata>
51
+ <statistics fitsExecutionTime="2977">
52
+ <tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
53
+ <tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
54
+ <tool toolname="Jhove" toolversion="1.5" executionTime="1034" />
55
+ <tool toolname="file utility" toolversion="5.04" executionTime="912" />
56
+ <tool toolname="Exiftool" toolversion="9.13" executionTime="842" />
57
+ <tool toolname="Droid" toolversion="6.1.3" executionTime="336" />
58
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.4GA" executionTime="2192" />
59
+ <tool toolname="OIS File Information" toolversion="0.2" executionTime="351" />
60
+ <tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
61
+ <tool toolname="ffident" toolversion="0.2" executionTime="410" />
62
+ <tool toolname="Tika" toolversion="1.3" executionTime="2911" />
63
+ </statistics>
64
+ </fits>
65
+
@@ -0,0 +1,59 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.5" timestamp="7/28/15 4:34 PM">
3
+ <identification>
4
+ <identity format="JPEG File Interchange Format" mimetype="image/jpeg" toolname="FITS" toolversion="0.8.5">
5
+ <tool toolname="Jhove" toolversion="1.5" />
6
+ <tool toolname="file utility" toolversion="5.04" />
7
+ <tool toolname="Exiftool" toolversion="9.13" />
8
+ <tool toolname="Droid" toolversion="6.1.3" />
9
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.4GA" />
10
+ <version toolname="Jhove" toolversion="1.5">1.01</version>
11
+ <externalIdentifier toolname="Droid" toolversion="6.1.3" type="puid">fmt/43</externalIdentifier>
12
+ </identity>
13
+ </identification>
14
+ <fileinfo>
15
+ <size toolname="Jhove" toolversion="1.5">94497</size>
16
+ <creatingApplicationName toolname="Jhove" toolversion="1.5">File source: https://commons.wikimedia.org/wiki/File:Dante_Gabriel_Rossetti_-_Joan_of_Arc_(1882).jpg</creatingApplicationName>
17
+ <lastmodified toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">2015:07:28 10:19:55-04:00</lastmodified>
18
+ <filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/dc/Downloads/Joan_of_Arc.jpg</filepath>
19
+ <filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">Joan_of_Arc.jpg</filename>
20
+ <md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">bc575fbcbffff0248f5da3dddf8afd69</md5checksum>
21
+ <fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1438093195000</fslastmodified>
22
+ </fileinfo>
23
+ <filestatus>
24
+ <well-formed toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">true</well-formed>
25
+ <valid toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">true</valid>
26
+ </filestatus>
27
+ <metadata>
28
+ <image>
29
+ <byteOrder toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">big endian</byteOrder>
30
+ <compressionScheme toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">JPEG (old-style)</compressionScheme>
31
+ <imageWidth toolname="Jhove" toolversion="1.5">500</imageWidth>
32
+ <imageHeight toolname="Jhove" toolversion="1.5">569</imageHeight>
33
+ <colorSpace toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">YCbCr</colorSpace>
34
+ <iccProfileName toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">c2</iccProfileName>
35
+ <YCbCrSubSampling toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">1 1</YCbCrSubSampling>
36
+ <samplingFrequencyUnit toolname="Jhove" toolversion="1.5">in.</samplingFrequencyUnit>
37
+ <xSamplingFrequency toolname="Jhove" toolversion="1.5">128</xSamplingFrequency>
38
+ <ySamplingFrequency toolname="Jhove" toolversion="1.5">128</ySamplingFrequency>
39
+ <bitsPerSample toolname="Jhove" toolversion="1.5">8 8 8</bitsPerSample>
40
+ <samplesPerPixel toolname="Jhove" toolversion="1.5" status="SINGLE_RESULT">3</samplesPerPixel>
41
+ <lightSource toolname="NLNZ Metadata Extractor" toolversion="3.4GA" status="SINGLE_RESULT">unknown</lightSource>
42
+ <iccProfileVersion toolname="Exiftool" toolversion="9.13" status="SINGLE_RESULT">2.1.0</iccProfileVersion>
43
+ </image>
44
+ </metadata>
45
+ <statistics fitsExecutionTime="897">
46
+ <tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
47
+ <tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
48
+ <tool toolname="Jhove" toolversion="1.5" executionTime="728" />
49
+ <tool toolname="file utility" toolversion="5.04" executionTime="662" />
50
+ <tool toolname="Exiftool" toolversion="9.13" executionTime="718" />
51
+ <tool toolname="Droid" toolversion="6.1.3" executionTime="85" />
52
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.4GA" executionTime="664" />
53
+ <tool toolname="OIS File Information" toolversion="0.2" executionTime="82" />
54
+ <tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
55
+ <tool toolname="ffident" toolversion="0.2" executionTime="315" />
56
+ <tool toolname="Tika" toolversion="1.3" executionTime="240" />
57
+ </statistics>
58
+ </fits>
59
+
@@ -0,0 +1,47 @@
1
+ module Ddr::Index
2
+ RSpec.describe Filter do
3
+
4
+ describe "#where(conditions)" do
5
+ it "should add raw query filters for the field, value hash of conditions" do
6
+ subject.where("foo"=>"bar", "spam"=>"eggs", "stuff"=>["dog", "cat", "bird"])
7
+ expect(subject.clauses).to eq(["{!term f=foo}bar", "{!term f=spam}eggs", "stuff:(dog OR cat OR bird)"])
8
+ end
9
+ end
10
+
11
+ describe "#raw(*clauses)" do
12
+ it "should add the clauses w/o escaping" do
13
+ subject.raw("foo:bar", "spam:eggs")
14
+ expect(subject.clauses).to eq(["foo:bar", "spam:eggs"])
15
+ end
16
+ end
17
+
18
+ describe "#present(field)" do
19
+ it "should add a \"field present\" clause" do
20
+ subject.present("foo")
21
+ expect(subject.clauses).to eq(["foo:[* TO *]"])
22
+ end
23
+ end
24
+
25
+ describe "#absent(field)" do
26
+ it "should add a \"field not present\" clause" do
27
+ subject.absent("foo")
28
+ expect(subject.clauses).to eq(["-foo:[* TO *]"])
29
+ end
30
+ end
31
+
32
+ describe "#before_days(field, days)" do
33
+ it "should add a date range query clause" do
34
+ subject.before_days("foo", 60)
35
+ expect(subject.clauses).to eq(["foo:[* TO NOW-60DAYS]"])
36
+ end
37
+ end
38
+
39
+ describe "#before(field, date_time)" do
40
+ it "should add a date range query clause" do
41
+ subject.before("foo", DateTime.parse("Thu, 27 Aug 2015 17:42:34 -0400"))
42
+ expect(subject.clauses).to eq(["foo:[* TO 2015-08-27T21:42:34Z]"])
43
+ end
44
+ end
45
+
46
+ end
47
+ end