cul_hydra 1.4.18 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concept.rb +2 -30
- data/app/models/concerns/cul/hydra/models/aggregator.rb +11 -0
- data/app/models/concerns/cul/hydra/models/common.rb +40 -1
- data/app/models/generic_aggregator.rb +3 -0
- data/config/fedora.yml +24 -15
- data/config/solr.yml +16 -7
- data/config/subs.yml +8 -15
- data/lib/cul_hydra/version.rb +1 -1
- metadata +3 -5
- data/lib/cul_hydra/#version.rb# +0 -8
- data/lib/cul_hydra/version.rb~ +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2baf2571dbbdc2d415c7a2933580386f87a4bfc9
|
4
|
+
data.tar.gz: e1aa15a6689b907d3d2100b1aefc8436617b5430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f81d19b2bd3f9f5ec1f6c9ab94ac4dbd62ef034cfdbe1338e3a2195acb0626acff5c4853a4e668332e66ec0843752d7c1b41da3997121bc54ef7caed05b4690
|
7
|
+
data.tar.gz: 35554b9b11df6aa862370ea4d0b2f84f49516d15e6018d88bff4c2c17d68359bcca9e3649c9997d2548e37ebee8a88389af4c0b3df90907b7a0682759aaa4512
|
data/app/models/concept.rb
CHANGED
@@ -76,16 +76,6 @@ class Concept < GenericAggregator
|
|
76
76
|
set_singular_rel(:restriction, val, true)
|
77
77
|
end
|
78
78
|
|
79
|
-
# a representative image URI for this concept
|
80
|
-
# https://schema.org/image
|
81
|
-
def representative_image
|
82
|
-
get_singular_rel(:schema_image)
|
83
|
-
end
|
84
|
-
|
85
|
-
def representative_image=(val)
|
86
|
-
set_singular_rel(:schema_image, val)
|
87
|
-
end
|
88
|
-
|
89
79
|
# a human readable URI segment for this concept
|
90
80
|
# http://www.bbc.co.uk/ontologies/coreconcepts/slug
|
91
81
|
def slug
|
@@ -116,30 +106,12 @@ class Concept < GenericAggregator
|
|
116
106
|
set_singular_rel(:short_title, val, true)
|
117
107
|
end
|
118
108
|
|
119
|
-
def get_singular_rel(predicate)
|
120
|
-
property = relationships(predicate).first
|
121
|
-
return nil unless property
|
122
|
-
return (property.kind_of? RDF::Literal) ? property.value : property
|
123
|
-
end
|
124
|
-
|
125
|
-
def set_singular_rel(predicate, value, literal=false)
|
126
|
-
raise "#{predicate} is a singular property" if value.respond_to? :each
|
127
|
-
clear_relationship(predicate)
|
128
|
-
add_relationship(predicate, value, literal) unless value.nil? || value.empty?
|
129
|
-
end
|
130
|
-
|
131
109
|
def to_solr(solr_doc = Hash.new, opts={})
|
132
110
|
solr_doc = super(solr_doc, opts)
|
133
111
|
solr_doc[::ActiveFedora::SolrService.solr_name(:description_text, :displayable)] = description
|
134
112
|
solr_doc
|
135
113
|
end
|
136
|
-
class SingularRelValidator < ActiveModel::Validator
|
137
|
-
def validate(record)
|
138
|
-
[:abstract, :alternative, :restriction, :slug, :source, :schema_image].each do |rel|
|
139
|
-
record.errors[rel] << "#{rel} must have 0 or 1 values" unless record.relationships(rel).length < 2
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
114
|
|
144
|
-
|
115
|
+
# validators built for [0..1] RELS properties
|
116
|
+
validates_with singular_rel_validator([:abstract, :alternative, :restriction, :slug, :source])
|
145
117
|
end
|
@@ -56,6 +56,17 @@ module Cul::Hydra::Models::Aggregator
|
|
56
56
|
return thumb || {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
|
57
57
|
end
|
58
58
|
|
59
|
+
# a representative image URI for this object
|
60
|
+
# defined by the predicate https://schema.org/image
|
61
|
+
# @return [String, URI]
|
62
|
+
def representative_image
|
63
|
+
get_singular_rel(:schema_image)
|
64
|
+
end
|
65
|
+
|
66
|
+
def representative_image=(val)
|
67
|
+
set_singular_rel(:schema_image, val)
|
68
|
+
end
|
69
|
+
|
59
70
|
private
|
60
71
|
def thumb_from_struct(members)
|
61
72
|
puts "thumb thumb_from_struct"
|
@@ -24,6 +24,23 @@ module Cul::Hydra::Models::Common
|
|
24
24
|
end
|
25
25
|
@rdf_types
|
26
26
|
end
|
27
|
+
def singular_rel_validator(symbols = [])
|
28
|
+
r = Class.new(ActiveModel::Validator) do
|
29
|
+
def self.symbols=(symbols)
|
30
|
+
@symbols = symbols
|
31
|
+
end
|
32
|
+
def self.symbols
|
33
|
+
@symbols ||= []
|
34
|
+
end
|
35
|
+
def validate(record)
|
36
|
+
self.class.symbols.each do |rel|
|
37
|
+
record.errors[rel] << "#{rel} must have 0 or 1 values" unless record.relationships(rel).length < 2
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
r.symbols = symbols
|
42
|
+
r
|
43
|
+
end
|
27
44
|
end
|
28
45
|
|
29
46
|
def rdf_types!
|
@@ -163,11 +180,18 @@ module Cul::Hydra::Models::Common
|
|
163
180
|
solr_doc
|
164
181
|
end
|
165
182
|
|
183
|
+
# Return a representative file resource for the object
|
184
|
+
# @param force_use_of_non_pid_identifier [Boolean] switch to require use of application id in struct map parsing
|
185
|
+
# @return [GenericResource] a representative file resource
|
166
186
|
# This method generally shouldn't be called with any parameters (unless we're doing testing)
|
167
187
|
def get_representative_generic_resource(force_use_of_non_pid_identifier=false)
|
168
188
|
return self if self.is_a?(GenericResource)
|
169
|
-
return nil unless self.is_a?(Cul::Hydra::Models::Aggregator) # Only Aggregators have struct metadata
|
170
189
|
|
190
|
+
# if there's an explicit assignment of representative image, return it
|
191
|
+
assigned_image = get_singular_rel(:schema_image)
|
192
|
+
return ActiveFedora::Base.find(assigned_image.split('/')[-1]) if assigned_image
|
193
|
+
|
194
|
+
return nil unless self.is_a?(Cul::Hydra::Models::Aggregator) # Only Aggregators have struct metadata
|
171
195
|
# If we're here, then the object was not a Generic resource.
|
172
196
|
# Try to get child info from a structMat datastream, and fall back to
|
173
197
|
# the first :cul_member_of child if a structMap isn't present
|
@@ -233,6 +257,9 @@ module Cul::Hydra::Models::Common
|
|
233
257
|
return nil
|
234
258
|
end
|
235
259
|
end
|
260
|
+
rescue ActiveFedora::ObjectNotFoundError
|
261
|
+
logger.warn "#{get_singular_rel(:schema_image)} not found in repository for #{self.pid}"
|
262
|
+
return nil
|
236
263
|
end
|
237
264
|
|
238
265
|
def update_datastream_attributes(params={}, opts={})
|
@@ -263,6 +290,18 @@ module Cul::Hydra::Models::Common
|
|
263
290
|
{:asset=>("cul_hydra/crystal/kmultiple.png"),:mime_type=>"image/png"}
|
264
291
|
end
|
265
292
|
|
293
|
+
def get_singular_rel(predicate)
|
294
|
+
property = relationships(predicate).first
|
295
|
+
return nil unless property
|
296
|
+
return (property.kind_of? RDF::Literal) ? property.value : property
|
297
|
+
end
|
298
|
+
|
299
|
+
def set_singular_rel(predicate, value, literal=false)
|
300
|
+
raise "#{predicate} is a singular property" if value.respond_to? :each
|
301
|
+
clear_relationship(predicate)
|
302
|
+
add_relationship(predicate, value, literal) unless value.nil? || value.empty?
|
303
|
+
end
|
304
|
+
|
266
305
|
private
|
267
306
|
def value_changed?(ds,pointer,values)
|
268
307
|
if values.is_a? Hash
|
data/config/fedora.yml
CHANGED
@@ -1,17 +1,26 @@
|
|
1
1
|
development:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
:
|
6
|
-
|
7
|
-
test:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
:
|
12
|
-
|
2
|
+
user: fedoraAdmin
|
3
|
+
password: f+BULUS*^
|
4
|
+
url: http://repository.cul.columbia.edu:8080/fedora
|
5
|
+
datastreams_root: /ifs/cul/repo/archive/repo-datastreams
|
6
|
+
time_zone: "America/New_York"
|
7
|
+
test: &TEST
|
8
|
+
user: fedoraAdmin
|
9
|
+
password: fedoraAdmin
|
10
|
+
url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/fedora-test" %>
|
11
|
+
datastreams_root: /ifs/cul/repo/archive/repo-datastreams
|
12
|
+
time_zone: "America/New_York"
|
13
13
|
production:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
:
|
14
|
+
user: fedoraAdmin
|
15
|
+
password: f+BULUS*^
|
16
|
+
url: http://repository.cul.columbia.edu:8080/fedora
|
17
|
+
datastreams_root: /ifs/cul/repo/archive/repo-datastreams
|
18
|
+
time_zone: "America/New_York"
|
19
|
+
dcv_test:
|
20
|
+
user: fedoraAdmin
|
21
|
+
password: f+BULUS*^
|
22
|
+
url: http://repository.cul.columbia.edu:8080/fedora
|
23
|
+
datastreams_root: /ifs/cul/repo/archive/repo-datastreams
|
24
|
+
time_zone: "America/New_York"
|
25
|
+
cucumber:
|
26
|
+
<<: *TEST
|
data/config/solr.yml
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
+
# This is a sample config file that does not have multiple solr instances. You will also need to be sure to
|
2
|
+
# edit the fedora.yml file to match the solr URL for active-fedora.
|
3
|
+
# url: http://katana.cul.columbia.edu:8080/solr-4.7/dcv_private_dev
|
4
|
+
test: &TEST
|
5
|
+
url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/test" %>
|
6
|
+
dcv_dev: &DEV
|
7
|
+
url: http://spatha.cul.columbia.edu:8080/solr-4.7/dcv_private_test
|
8
|
+
dcv_core: 'dcv_private_dev'
|
9
|
+
dcv_test: &IFP
|
10
|
+
url: http://spatha.cul.columbia.edu:8080/solr-4.7/dcv_private_test
|
11
|
+
dcv_core: 'dcv_private_test'
|
12
|
+
cucumber:
|
13
|
+
<<: *TEST
|
14
|
+
production: &PROD
|
15
|
+
url: http://spatha.cul.columbia.edu:8080/solr-4.7/dcv_prod
|
1
16
|
development:
|
2
|
-
|
3
|
-
|
4
|
-
test:
|
5
|
-
url: http://localhost:8983/solr/test
|
6
|
-
|
7
|
-
production:
|
8
|
-
url: http://katana.cul.columbia.edu:8080/solr-4.7/dcv_private_dev
|
17
|
+
<<: *PROD
|
data/config/subs.yml
CHANGED
@@ -1,17 +1,10 @@
|
|
1
|
+
old:
|
2
|
+
fedora_server: http://sayers.cul.columbia.edu:8080
|
3
|
+
php_server: http://bach.cul.columbia.edu/dev
|
4
|
+
djatoka_server: http://iris.cul.columbia.edu:8080
|
1
5
|
development:
|
2
|
-
|
3
|
-
|
4
|
-
php_server: "http://bach.cul.columbia.edu/dev"
|
6
|
+
fedora_server: http://repository.cul.columbia.edu:8080
|
7
|
+
php_server: http://fedora-svc.cul.columbia.edu/dev
|
5
8
|
test:
|
6
|
-
|
7
|
-
|
8
|
-
php_server: "http://bach.cul.columbia.edu/dev"
|
9
|
-
production:
|
10
|
-
djatoka_server: "http://iris.cul.columbia.edu:8080"
|
11
|
-
fedora_server: "http://alcott.cul.columbia.edu:8080"
|
12
|
-
php_server: "http://bach.cul.columbia.edu"
|
13
|
-
|
14
|
-
hyacinth_prod:
|
15
|
-
djatoka_server: "http://iris.cul.columbia.edu:8080"
|
16
|
-
fedora_server: "http://alcott.cul.columbia.edu:8080"
|
17
|
-
php_server: "http://bach.cul.columbia.edu"
|
9
|
+
fedora_server: http://repository.cul.columbia.edu:8080
|
10
|
+
php_server: http://fedora-svc.cul.columbia.edu/dev
|
data/lib/cul_hydra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul_hydra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Armintor
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blacklight
|
@@ -532,7 +532,6 @@ files:
|
|
532
532
|
- fixtures/spec/STRUCTMAP/structmap-unlabeled-seq.xml
|
533
533
|
- fixtures/spec/STRUCTMAP/structmap-unordered-seq.xml
|
534
534
|
- lib/cul_hydra.rb
|
535
|
-
- lib/cul_hydra/#version.rb#
|
536
535
|
- lib/cul_hydra/access_controls_enforcement.rb
|
537
536
|
- lib/cul_hydra/controllers.rb
|
538
537
|
- lib/cul_hydra/controllers/aggregates.rb
|
@@ -570,7 +569,6 @@ files:
|
|
570
569
|
- lib/cul_hydra/solrizer/value_mapper.rb
|
571
570
|
- lib/cul_hydra/solrizer_patch.rb
|
572
571
|
- lib/cul_hydra/version.rb
|
573
|
-
- lib/cul_hydra/version.rb~
|
574
572
|
- lib/tasks/cmodel.rake
|
575
573
|
- lib/tasks/cul_hydra_dev.rake
|
576
574
|
- lib/tasks/index.rake
|
@@ -597,7 +595,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
597
595
|
version: '0'
|
598
596
|
requirements: []
|
599
597
|
rubyforge_project:
|
600
|
-
rubygems_version: 2.6.
|
598
|
+
rubygems_version: 2.6.11
|
601
599
|
signing_key:
|
602
600
|
specification_version: 4
|
603
601
|
summary: ActiveFedora, OM, and Solrizer implementations for CUL repository apps
|
data/lib/cul_hydra/#version.rb#
DELETED