cul_hydra 1.2.1 → 1.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e4652c6ba2ad83f7e8f3c6d5d53f2c9ed99b5b3
4
- data.tar.gz: 74ada7de873eb687e9145528bd3bd7c4636f4001
3
+ metadata.gz: 5b4df6344182d2a1a44c6d286351a7f3a4236a8e
4
+ data.tar.gz: a5d69d3023b352af7193f8b1c1cb9cd7d72bacd2
5
5
  SHA512:
6
- metadata.gz: c5e453ac0ca0f1585d6fe086f5d86148f2a6e8ad43bab2aa32cb53d341196d02f9513989837c2faf97bccc00986e895c547109533f2fa5d2cc054e6c819a20c6
7
- data.tar.gz: 290debecb4e2a733e28dfbfb9633a85f4b445e80dfc1fccbe2b9fd548edeac946b70cbacd695999f86b273b1149dcc7a6072396bae0097c4c12d5481765508fe
6
+ metadata.gz: 64dd5669dd1b949e3a4d433f17f7bd3013ab1b148b0fd0e9fbc3bdaf1c31c7ea4b3f03ec5097971c8890038aea2b221991c160ac72a8bd695981cd5083c24f83
7
+ data.tar.gz: f20adce232a055aa7b688e21c552a08a7bde9670347348ae9b86edc9e2622edae4c6f99d12b7475c75efda5faeeb5325feb6b12fe1ded6f2e34fe2fb707dbe38
@@ -1,5 +1,6 @@
1
1
  class Collection < GenericAggregator
2
2
  include Pcdm::Models
3
+ include Pcdm::Models::Collections
3
4
  rdf_types(RDF::CUL.Aggregator)
4
5
  rdf_types(RDF::PCDM.Collection)
5
6
 
@@ -0,0 +1,7 @@
1
+ module Pcdm::Models::Collections
2
+ extend ActiveSupport::Concern
3
+ def compose_from(*collections)
4
+ collections = collections.map {|c| (c.is_a? String) ? ActiveFedora::Base.find(c) : c }
5
+ self.structMetadata.merge(*collections.map {|c| c.structMetadata})
6
+ end
7
+ end
@@ -151,7 +151,37 @@ class StructMetadata < ::ActiveFedora::Datastream
151
151
  end
152
152
  end
153
153
 
154
+ def merge(*parts)
155
+ if bad_part = parts.detect {|p| !p.is_a? StructMetadata}
156
+ raise "Can only compose from other StructMetadata datastreams (#{bad_part.class})"
157
+ end
158
+
159
+ parts.each do |part|
160
+ part.struct_map.attributes.each do |att|
161
+ struct_map[att[0]] = att[1]
162
+ end
163
+ combine(part.struct_map,struct_map)
164
+ end
165
+ ng_xml_will_change!
166
+ self
167
+ end
168
+
154
169
  private
170
+ def combine(src, target)
171
+ src.children.each do |child|
172
+
173
+ if child['CONTENTIDS'] and c = target.children.detect {|n| n['CONTENTIDS'].eql?child['CONTENTIDS']}
174
+ child.attributes.each do |att|
175
+ c[att[0]] = c[att[1]]
176
+ end
177
+ combine(child,c)
178
+ elsif c = target.children.detect {|n| n['LABEL'].eql?child['LABEL'] and !n['CONTENTIDS']}
179
+ combine(child,c)
180
+ else
181
+ target.add_child(child.dup.unlink)
182
+ end
183
+ end
184
+ end
155
185
  def ancestors(node)
156
186
  current = node
157
187
  labels = []
@@ -0,0 +1,14 @@
1
+ <mets:structMap TYPE="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Filesystem" LABEL="Device" xmlns:mets="http://www.loc.gov/METS/">
2
+ <mets:div ORDER="1" LABEL="Leaf1">
3
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0701r" />
4
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0701v" />
5
+ </div>
6
+ <mets:div ORDER="2" LABEL="Leaf2">
7
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0704r" />
8
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0704v" />
9
+ </div>
10
+ <mets:div ORDER="2" LABEL="Leaf3">
11
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0705r" />
12
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0705v" />
13
+ </div>
14
+ </mets:structMap>
@@ -0,0 +1,17 @@
1
+ <mets:structMap TYPE="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Filesystem" LABEL="Device" xmlns:mets="http://www.loc.gov/METS/">
2
+ <mets:div ORDER="1" LABEL="Leaf1">
3
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0701r" />
4
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0701v" />
5
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0702r" />
6
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0702v" />
7
+ </div>
8
+ <mets:div ORDER="2" LABEL="Leaf2">
9
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0703r" />
10
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0703v" />
11
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0704r" />
12
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0704v" />
13
+ </div>
14
+ <mets:div ORDER="2" LABEL="Leaf3">
15
+ <mets:div ORDER="1" LABEL="Recto" CONTENTIDS="rbml_css_0705r" />
16
+ <mets:div ORDER="2" LABEL="Verso" CONTENTIDS="rbml_css_0705v" />
17
+ </div>
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.2.1'
3
+ VERSION = '1.3.0'
4
4
  def self.version
5
5
  VERSION
6
6
  end
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.2.1
4
+ version: 1.3.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: 2015-09-07 00:00:00.000000000 Z
12
+ date: 2015-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -330,6 +330,7 @@ files:
330
330
  - app/models/concerns/nie/information_element.rb
331
331
  - app/models/concerns/ore/proxy.rb
332
332
  - app/models/concerns/pcdm/models.rb
333
+ - app/models/concerns/pcdm/models/collections.rb
333
334
  - app/models/concerns/rdf/cul.rb
334
335
  - app/models/concerns/rdf/fcrepo3.rb
335
336
  - app/models/concerns/rdf/nfo.rb
@@ -446,6 +447,8 @@ files:
446
447
  - fixtures/spec/FOXML/static-image-aggregator.xml
447
448
  - fixtures/spec/STRUCTMAP/structmap-examples.xml
448
449
  - fixtures/spec/STRUCTMAP/structmap-nested.xml
450
+ - fixtures/spec/STRUCTMAP/structmap-nested2.xml
451
+ - fixtures/spec/STRUCTMAP/structmap-nested3.xml
449
452
  - fixtures/spec/STRUCTMAP/structmap-recto.xml
450
453
  - fixtures/spec/STRUCTMAP/structmap-seq.xml
451
454
  - fixtures/spec/STRUCTMAP/structmap-unlabeled-seq.xml
@@ -513,7 +516,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
513
516
  version: '0'
514
517
  requirements: []
515
518
  rubyforge_project:
516
- rubygems_version: 2.2.2
519
+ rubygems_version: 2.4.6
517
520
  signing_key:
518
521
  specification_version: 4
519
522
  summary: ActiveFedora, OM, and Solrizer implementations for CUL repository apps