active-fedora 9.0.0 → 9.1.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 +4 -4
- data/History.txt +97 -0
- data/README.md +40 -28
- data/active-fedora.gemspec +2 -1
- data/lib/active_fedora/associations/builder/contains.rb +5 -1
- data/lib/active_fedora/associations/builder/has_many.rb +1 -1
- data/lib/active_fedora/associations/collection_association.rb +1 -18
- data/lib/active_fedora/associations/contains_association.rb +3 -1
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +12 -10
- data/lib/active_fedora/associations.rb +1 -1
- data/lib/active_fedora/attached_files.rb +7 -4
- data/lib/active_fedora/attributes/property_builder.rb +1 -0
- data/lib/active_fedora/attributes.rb +36 -9
- data/lib/active_fedora/change_set.rb +2 -2
- data/lib/active_fedora/clean_connection.rb +40 -0
- data/lib/active_fedora/core/fedora_id_translator.rb +12 -0
- data/lib/active_fedora/core/fedora_uri_translator.rb +9 -0
- data/lib/active_fedora/core.rb +26 -38
- data/lib/active_fedora/errors.rb +4 -0
- data/lib/active_fedora/fedora.rb +22 -4
- data/lib/active_fedora/fedora_attributes.rb +25 -1
- data/lib/active_fedora/file.rb +30 -24
- data/lib/active_fedora/indexing/map.rb +46 -0
- data/lib/active_fedora/indexing.rb +14 -0
- data/lib/active_fedora/inheritable_accessors.rb +26 -0
- data/lib/active_fedora/loadable_from_json.rb +5 -1
- data/lib/active_fedora/nom_datastream.rb +6 -4
- data/lib/active_fedora/persistence.rb +11 -7
- data/lib/active_fedora/rdf/datastream_indexing.rb +4 -0
- data/lib/active_fedora/rdf/fcrepo4.rb +1 -0
- data/lib/active_fedora/rdf/indexing_service.rb +18 -11
- data/lib/active_fedora/rdf/ldp.rb +3 -0
- data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +0 -4
- data/lib/active_fedora/rdf/rdf_datastream.rb +12 -1
- data/lib/active_fedora/reflection.rb +3 -1
- data/lib/active_fedora/relation/finder_methods.rb +36 -5
- data/lib/active_fedora/solr_query_builder.rb +1 -1
- data/lib/active_fedora/solr_service.rb +1 -1
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/versions_graph.rb +7 -8
- data/lib/active_fedora.rb +6 -0
- data/spec/integration/associations_spec.rb +64 -21
- data/spec/integration/attached_files_spec.rb +24 -0
- data/spec/integration/attributes_spec.rb +49 -3
- data/spec/integration/belongs_to_association_spec.rb +118 -47
- data/spec/integration/clean_connection_spec.rb +21 -0
- data/spec/integration/collection_association_spec.rb +46 -0
- data/spec/integration/field_to_solr_name_spec.rb +11 -7
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +180 -137
- data/spec/integration/has_many_associations_spec.rb +6 -2
- data/spec/integration/json_serialization_spec.rb +11 -5
- data/spec/integration/nested_attribute_spec.rb +3 -1
- data/spec/integration/ntriples_datastream_spec.rb +23 -17
- data/spec/integration/persistence_spec.rb +3 -1
- data/spec/integration/query_result_builder_spec.rb +2 -2
- data/spec/integration/relation_delegation_spec.rb +3 -1
- data/spec/integration/scoped_query_spec.rb +3 -1
- data/spec/integration/solr_instance_loader_spec.rb +4 -2
- data/spec/integration/versionable_spec.rb +38 -1
- data/spec/samples/samples.rb +0 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/active_fedora_spec.rb +4 -2
- data/spec/unit/attributes_spec.rb +52 -12
- data/spec/unit/base_active_model_spec.rb +5 -3
- data/spec/unit/base_spec.rb +102 -2
- data/spec/unit/callback_spec.rb +4 -2
- data/spec/unit/change_set_spec.rb +4 -2
- data/spec/unit/core/fedora_id_translator_spec.rb +20 -0
- data/spec/unit/core/fedora_uri_translator_spec.rb +19 -0
- data/spec/unit/core_spec.rb +54 -2
- data/spec/unit/has_many_association_spec.rb +27 -2
- data/spec/unit/ntriples_datastream_spec.rb +24 -20
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -6
- data/spec/unit/query_result_builder_spec.rb +1 -1
- data/spec/unit/rdf/indexing_service_spec.rb +19 -17
- data/spec/unit/rdf_resource_datastream_spec.rb +14 -10
- data/spec/unit/reflection_spec.rb +44 -0
- data/spec/unit/simple_datastream_spec.rb +34 -0
- data/spec/unit/solr_query_builder_spec.rb +1 -1
- data/spec/unit/validations_spec.rb +4 -2
- metadata +28 -13
- data/spec/samples/marpa-dc_datastream.rb +0 -102
- data/spec/samples/models/audio_record.rb +0 -29
- data/spec/samples/models/image.rb +0 -5
- data/spec/samples/models/oral_history.rb +0 -36
- data/spec/samples/models/seminar.rb +0 -29
- data/spec/samples/models/seminar_audio_file.rb +0 -32
- data/spec/samples/oral_history_sample_model.rb +0 -30
- data/spec/samples/special_thing.rb +0 -44
|
@@ -3,23 +3,25 @@ require 'spec_helper'
|
|
|
3
3
|
describe ActiveFedora::RDF::IndexingService do
|
|
4
4
|
before do
|
|
5
5
|
class MyDatastream < ActiveFedora::NtriplesRDFDatastream
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
Deprecation.silence(ActiveFedora::RDFDatastream) do
|
|
7
|
+
property :created, predicate: ::RDF::DC.created do |index|
|
|
8
|
+
index.as :sortable, :displayable
|
|
9
|
+
index.type :date
|
|
10
|
+
end
|
|
11
|
+
property :title, predicate: ::RDF::DC.title do |index|
|
|
12
|
+
index.as :stored_searchable, :sortable
|
|
13
|
+
index.type :text
|
|
14
|
+
end
|
|
15
|
+
property :publisher, predicate: ::RDF::DC.publisher do |index|
|
|
16
|
+
index.as :facetable, :sortable, :stored_searchable
|
|
17
|
+
end
|
|
18
|
+
property :based_near, predicate: ::RDF::FOAF.based_near do |index|
|
|
19
|
+
index.as :facetable, :stored_searchable
|
|
20
|
+
index.type :text
|
|
21
|
+
end
|
|
22
|
+
property :related_url, predicate: ::RDF::RDFS.seeAlso do |index|
|
|
23
|
+
index.as :stored_searchable
|
|
24
|
+
end
|
|
23
25
|
end
|
|
24
26
|
property :rights, predicate: ::RDF::DC.rights
|
|
25
27
|
end
|
|
@@ -8,14 +8,16 @@ describe ActiveFedora::RDFDatastream do
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
class DummyResource < ActiveFedora::RDFDatastream
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
Deprecation.silence(ActiveFedora::RDFDatastream) do
|
|
12
|
+
property :title, predicate: ::RDF::DC[:title], class_name: ::RDF::Literal do |index|
|
|
13
|
+
index.as :searchable, :displayable
|
|
14
|
+
end
|
|
15
|
+
property :license, predicate: ::RDF::DC[:license], class_name: DummySubnode do |index|
|
|
16
|
+
index.as :searchable, :displayable
|
|
17
|
+
end
|
|
18
|
+
property :creator, predicate: ::RDF::DC[:creator], class_name: 'DummyAsset' do |index|
|
|
19
|
+
index.as :searchable
|
|
20
|
+
end
|
|
19
21
|
end
|
|
20
22
|
def serialization_format
|
|
21
23
|
:ntriples
|
|
@@ -24,8 +26,10 @@ describe ActiveFedora::RDFDatastream do
|
|
|
24
26
|
|
|
25
27
|
class DummyAsset < ActiveFedora::Base
|
|
26
28
|
has_metadata 'descMetadata', type: DummyResource
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
Deprecation.silence(ActiveFedora::Attributes) do
|
|
30
|
+
has_attributes :title, :license, datastream: 'descMetadata', multiple: true
|
|
31
|
+
has_attributes :relation, datastream: 'descMetadata', at: [:license, :relation], multiple: false
|
|
32
|
+
end
|
|
29
33
|
end
|
|
30
34
|
end
|
|
31
35
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe ActiveFedora::Reflection::AssociationReflection do
|
|
4
|
+
describe "#derive_foreign_key" do
|
|
5
|
+
let(:name) { 'dummy' }
|
|
6
|
+
let(:options) { { inverse_of: :default_permissions } }
|
|
7
|
+
let(:active_fedora) { double }
|
|
8
|
+
let(:instance) { described_class.new(macro, name, options, active_fedora) }
|
|
9
|
+
subject { instance.send :derive_foreign_key }
|
|
10
|
+
|
|
11
|
+
context "when a has_many" do
|
|
12
|
+
let(:macro) { :has_many }
|
|
13
|
+
|
|
14
|
+
context "and the inverse is a collection association" do
|
|
15
|
+
let(:inverse) { double(collection?: true) }
|
|
16
|
+
before { allow(instance).to receive(:inverse_of).and_return(inverse) }
|
|
17
|
+
it { is_expected.to eq 'default_permission_ids' }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "#automatic_inverse_of" do
|
|
23
|
+
before do
|
|
24
|
+
class Dummy < ActiveFedora::Base
|
|
25
|
+
belongs_to :foothing, predicate: ::RDF::DC.extent
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
after { Object.send(:remove_const, :Dummy) }
|
|
30
|
+
let(:name) { 'dummy' }
|
|
31
|
+
let(:options) { { as: 'foothing' } }
|
|
32
|
+
let(:active_fedora) { double }
|
|
33
|
+
let(:instance) { described_class.new(macro, name, options, active_fedora) }
|
|
34
|
+
subject { instance.send :automatic_inverse_of }
|
|
35
|
+
|
|
36
|
+
context "when a has_many" do
|
|
37
|
+
let(:macro) { :has_many }
|
|
38
|
+
|
|
39
|
+
context "and the inverse is a collection association" do
|
|
40
|
+
it { is_expected.to eq :foothing }
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -62,5 +62,39 @@ describe ActiveFedora::SimpleDatastream do
|
|
|
62
62
|
expect(solr[ActiveFedora::SolrQueryBuilder.solr_name('creation_date', type: :date)]).to eq "2012-01-15"
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
|
+
|
|
66
|
+
describe "datastream configuration" do
|
|
67
|
+
let(:foo) do
|
|
68
|
+
ActiveFedora::Base.create! do |obj|
|
|
69
|
+
obj.add_file(%{<?xml version="1.0"?>\n<fields><fubar>test</fubar></fields>}, path:'someData')
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
let(:resource) { Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection, foo.uri) }
|
|
73
|
+
let(:orm) { Ldp::Orm.new(resource) }
|
|
74
|
+
|
|
75
|
+
before do
|
|
76
|
+
class FooHistory < ActiveFedora::Base
|
|
77
|
+
has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"someData" do |m|
|
|
78
|
+
m.field "fubar", :string
|
|
79
|
+
end
|
|
80
|
+
Deprecation.silence(ActiveFedora::Attributes) do
|
|
81
|
+
has_attributes :fubar, datastream: 'someData', multiple: false
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
orm.graph.delete([orm.resource.subject_uri, ActiveFedora::RDF::Fcrepo::Model.hasModel, nil])
|
|
86
|
+
orm.graph.insert([orm.resource.subject_uri, ActiveFedora::RDF::Fcrepo::Model.hasModel, 'FooHistory'])
|
|
87
|
+
orm.save
|
|
88
|
+
foo.reload
|
|
89
|
+
foo.update_index
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
after do
|
|
93
|
+
Object.send(:remove_const, :FooHistory)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
subject { FooHistory.find(foo.id) }
|
|
97
|
+
its(:fubar) { is_expected.to eq 'test' }
|
|
98
|
+
end
|
|
65
99
|
|
|
66
100
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe SolrQueryBuilder do
|
|
3
|
+
describe ActiveFedora::SolrQueryBuilder do
|
|
4
4
|
describe "raw_query" do
|
|
5
5
|
it "should generate a raw query clause" do
|
|
6
6
|
expect(ActiveFedora::SolrQueryBuilder.raw_query('id', "my:_ID1_")).to eq '_query_:"{!raw f=id}my:_ID1_"'
|
|
@@ -7,8 +7,10 @@ describe ActiveFedora::Base do
|
|
|
7
7
|
m.field "fubar", :string
|
|
8
8
|
m.field "swank", :text
|
|
9
9
|
end
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Deprecation.silence(ActiveFedora::Attributes) do
|
|
11
|
+
has_attributes :fubar, datastream: 'someData', multiple: true
|
|
12
|
+
has_attributes :swank, datastream: 'someData', multiple: false
|
|
13
|
+
end
|
|
12
14
|
|
|
13
15
|
validates_presence_of :fubar
|
|
14
16
|
validates_length_of :swank, :minimum=>5
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active-fedora
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.
|
|
4
|
+
version: 9.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Zumwalt
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2015-
|
|
13
|
+
date: 2015-04-16 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rsolr
|
|
@@ -130,14 +130,14 @@ dependencies:
|
|
|
130
130
|
requirements:
|
|
131
131
|
- - "~>"
|
|
132
132
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: 0.
|
|
133
|
+
version: 0.3.0
|
|
134
134
|
type: :runtime
|
|
135
135
|
prerelease: false
|
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
|
137
137
|
requirements:
|
|
138
138
|
- - "~>"
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: 0.
|
|
140
|
+
version: 0.3.0
|
|
141
141
|
- !ruby/object:Gem::Dependency
|
|
142
142
|
name: rdf-ldp
|
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -222,6 +222,20 @@ dependencies:
|
|
|
222
222
|
- - "~>"
|
|
223
223
|
- !ruby/object:Gem::Version
|
|
224
224
|
version: '3.0'
|
|
225
|
+
- !ruby/object:Gem::Dependency
|
|
226
|
+
name: rspec-its
|
|
227
|
+
requirement: !ruby/object:Gem::Requirement
|
|
228
|
+
requirements:
|
|
229
|
+
- - ">="
|
|
230
|
+
- !ruby/object:Gem::Version
|
|
231
|
+
version: '0'
|
|
232
|
+
type: :development
|
|
233
|
+
prerelease: false
|
|
234
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
235
|
+
requirements:
|
|
236
|
+
- - ">="
|
|
237
|
+
- !ruby/object:Gem::Version
|
|
238
|
+
version: '0'
|
|
225
239
|
- !ruby/object:Gem::Dependency
|
|
226
240
|
name: equivalent-xml
|
|
227
241
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -321,9 +335,12 @@ files:
|
|
|
321
335
|
- lib/active_fedora/caching_connection.rb
|
|
322
336
|
- lib/active_fedora/callbacks.rb
|
|
323
337
|
- lib/active_fedora/change_set.rb
|
|
338
|
+
- lib/active_fedora/clean_connection.rb
|
|
324
339
|
- lib/active_fedora/cleaner.rb
|
|
325
340
|
- lib/active_fedora/config.rb
|
|
326
341
|
- lib/active_fedora/core.rb
|
|
342
|
+
- lib/active_fedora/core/fedora_id_translator.rb
|
|
343
|
+
- lib/active_fedora/core/fedora_uri_translator.rb
|
|
327
344
|
- lib/active_fedora/datastream.rb
|
|
328
345
|
- lib/active_fedora/datastreams.rb
|
|
329
346
|
- lib/active_fedora/datastreams/nokogiri_datastreams.rb
|
|
@@ -337,7 +354,9 @@ files:
|
|
|
337
354
|
- lib/active_fedora/files_hash.rb
|
|
338
355
|
- lib/active_fedora/fixity_service.rb
|
|
339
356
|
- lib/active_fedora/indexing.rb
|
|
357
|
+
- lib/active_fedora/indexing/map.rb
|
|
340
358
|
- lib/active_fedora/indexing_service.rb
|
|
359
|
+
- lib/active_fedora/inheritable_accessors.rb
|
|
341
360
|
- lib/active_fedora/ldp_cache.rb
|
|
342
361
|
- lib/active_fedora/ldp_resource.rb
|
|
343
362
|
- lib/active_fedora/ldp_resource_service.rb
|
|
@@ -440,6 +459,7 @@ files:
|
|
|
440
459
|
- spec/integration/belongs_to_association_spec.rb
|
|
441
460
|
- spec/integration/bug_spec.rb
|
|
442
461
|
- spec/integration/caching_spec.rb
|
|
462
|
+
- spec/integration/clean_connection_spec.rb
|
|
443
463
|
- spec/integration/collection_association_spec.rb
|
|
444
464
|
- spec/integration/complex_rdf_datastream_spec.rb
|
|
445
465
|
- spec/integration/datastream_rdf_nested_attributes_spec.rb
|
|
@@ -470,18 +490,10 @@ files:
|
|
|
470
490
|
- spec/rcov.opts
|
|
471
491
|
- spec/samples/hydra-mods_article_datastream.rb
|
|
472
492
|
- spec/samples/hydra-rights_metadata_datastream.rb
|
|
473
|
-
- spec/samples/marpa-dc_datastream.rb
|
|
474
|
-
- spec/samples/models/audio_record.rb
|
|
475
|
-
- spec/samples/models/image.rb
|
|
476
493
|
- spec/samples/models/mods_article.rb
|
|
477
|
-
- spec/samples/models/oral_history.rb
|
|
478
|
-
- spec/samples/models/seminar.rb
|
|
479
|
-
- spec/samples/models/seminar_audio_file.rb
|
|
480
494
|
- spec/samples/oral_history_sample.xml
|
|
481
|
-
- spec/samples/oral_history_sample_model.rb
|
|
482
495
|
- spec/samples/oral_history_xml.xml
|
|
483
496
|
- spec/samples/samples.rb
|
|
484
|
-
- spec/samples/special_thing.rb
|
|
485
497
|
- spec/spec.opts
|
|
486
498
|
- spec/spec_helper.rb
|
|
487
499
|
- spec/support/an_active_model.rb
|
|
@@ -499,6 +511,8 @@ files:
|
|
|
499
511
|
- spec/unit/change_set_spec.rb
|
|
500
512
|
- spec/unit/code_configurator_spec.rb
|
|
501
513
|
- spec/unit/config_spec.rb
|
|
514
|
+
- spec/unit/core/fedora_id_translator_spec.rb
|
|
515
|
+
- spec/unit/core/fedora_uri_translator_spec.rb
|
|
502
516
|
- spec/unit/core_spec.rb
|
|
503
517
|
- spec/unit/file_configurator_spec.rb
|
|
504
518
|
- spec/unit/file_path_builder_spec.rb
|
|
@@ -530,6 +544,7 @@ files:
|
|
|
530
544
|
- spec/unit/rdf_vocab_spec.rb
|
|
531
545
|
- spec/unit/rdfxml_datastream_spec.rb
|
|
532
546
|
- spec/unit/readonly_spec.rb
|
|
547
|
+
- spec/unit/reflection_spec.rb
|
|
533
548
|
- spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb
|
|
534
549
|
- spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb
|
|
535
550
|
- spec/unit/rspec_matchers/have_predicate_matcher_spec.rb
|
|
@@ -560,7 +575,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
560
575
|
version: '0'
|
|
561
576
|
requirements: []
|
|
562
577
|
rubyforge_project:
|
|
563
|
-
rubygems_version: 2.
|
|
578
|
+
rubygems_version: 2.4.5
|
|
564
579
|
signing_key:
|
|
565
580
|
specification_version: 4
|
|
566
581
|
summary: A convenience libary for manipulating documents in the Fedora Repository.
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
require "active-fedora"
|
|
2
|
-
module Marpa
|
|
3
|
-
|
|
4
|
-
# This is an example of a OmDatastream that defines a terminology for Dublin Core xml
|
|
5
|
-
#
|
|
6
|
-
# Some things to observe about this Class:
|
|
7
|
-
# * Defines a couple of custom terms, tibetan_title and english_title, that map to dc:title with varying @language attributes
|
|
8
|
-
# * Indicates which terms should be indexed as facets using :index_as=>[:facetable]
|
|
9
|
-
# * Defines an xml template that is an empty dublin core xml document with three namespaces set
|
|
10
|
-
# * Sets the namespace using :xmlns argument on the root term
|
|
11
|
-
# * Does not override or extend to_solr, so the default solrization approach will be used (Solrizer::XML::TerminologyBasedSolrizer)
|
|
12
|
-
#
|
|
13
|
-
class DcDatastream < ActiveFedora::OmDatastream
|
|
14
|
-
|
|
15
|
-
set_terminology do |t|
|
|
16
|
-
t.root(:path=>"dc", :xmlns=>'http://purl.org/dc/terms/')
|
|
17
|
-
t.tibetan_title(:path=>"title", :attributes=>{:language=>"tibetan"})
|
|
18
|
-
t.english_title(:path=>"title", :attributes=>{:language=>:none})
|
|
19
|
-
t.contributor(:index_as=>[:facetable])
|
|
20
|
-
t.coverage
|
|
21
|
-
t.creator
|
|
22
|
-
t.description
|
|
23
|
-
t.format
|
|
24
|
-
t.identifier
|
|
25
|
-
t.language(:index_as=>[:facetable])
|
|
26
|
-
t.publisher
|
|
27
|
-
t.relation
|
|
28
|
-
t.source
|
|
29
|
-
t.title
|
|
30
|
-
t.abstract
|
|
31
|
-
t.accessRights
|
|
32
|
-
t.accrualMethod
|
|
33
|
-
t.accrualPeriodicity
|
|
34
|
-
t.accrualPolicy
|
|
35
|
-
t.alternative
|
|
36
|
-
t.audience
|
|
37
|
-
t.available
|
|
38
|
-
t.bibliographicCitation
|
|
39
|
-
t.conformsTo
|
|
40
|
-
t.contributor
|
|
41
|
-
t.coverage
|
|
42
|
-
t.created
|
|
43
|
-
t.creator
|
|
44
|
-
t.date(:index_as=>[:facetable])
|
|
45
|
-
t.dateAccepted
|
|
46
|
-
t.dateCopyrighted
|
|
47
|
-
t.dateSubmitted
|
|
48
|
-
t.description
|
|
49
|
-
t.educationLevel
|
|
50
|
-
t.extent
|
|
51
|
-
t.format
|
|
52
|
-
t.hasFormat
|
|
53
|
-
t.hasPart
|
|
54
|
-
t.hasVersion
|
|
55
|
-
t.identifier
|
|
56
|
-
t.instructionalMethod
|
|
57
|
-
t.isFormatOf
|
|
58
|
-
t.isPartOf
|
|
59
|
-
t.isReferencedBy
|
|
60
|
-
t.isReplacedBy
|
|
61
|
-
t.isRequiredBy
|
|
62
|
-
t.issued
|
|
63
|
-
t.isVersionOf
|
|
64
|
-
t.language(:index_as=>[:facetable])
|
|
65
|
-
t.license
|
|
66
|
-
t.mediator
|
|
67
|
-
t.medium
|
|
68
|
-
t.modified
|
|
69
|
-
t.provenance
|
|
70
|
-
t.publisher
|
|
71
|
-
t.references
|
|
72
|
-
t.relation
|
|
73
|
-
t.replaces
|
|
74
|
-
t.requires
|
|
75
|
-
t.rights
|
|
76
|
-
t.rightsHolder
|
|
77
|
-
t.source
|
|
78
|
-
t.spatial(:index_as=>[:facetable])
|
|
79
|
-
t.subject(:index_as=>[:facetable])
|
|
80
|
-
t.tableOfContents
|
|
81
|
-
t.temporal
|
|
82
|
-
t.type
|
|
83
|
-
t.valid
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def self.xml_template
|
|
87
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
|
88
|
-
xml.dc("xmlns"=>'http://purl.org/dc/terms/',
|
|
89
|
-
"xmlns:dcterms"=>'http://purl.org/dc/terms/',
|
|
90
|
-
"xmlns:xsi"=>'http://www.w3.org/2001/XMLSchema-instance') {
|
|
91
|
-
}
|
|
92
|
-
end
|
|
93
|
-
return builder.doc
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def prefix
|
|
97
|
-
"#{dsid.underscore}__"
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
end
|
|
102
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require 'active-fedora'
|
|
2
|
-
|
|
3
|
-
class AudioRecord
|
|
4
|
-
|
|
5
|
-
include ActiveFedora::Model
|
|
6
|
-
|
|
7
|
-
# This seems a bit strange, since this Class might be used outside of Oral Histories.
|
|
8
|
-
# From this perspective, it makes more sense to put triples on the containing object, not on the children...
|
|
9
|
-
|
|
10
|
-
relationship "parents", :is_part_of, [nil, :oral_history]
|
|
11
|
-
#has n, :parents, {:predicate => :is_part_of, :likely_types => [nil, :oral_history]}
|
|
12
|
-
# OR
|
|
13
|
-
# is_part_of [:oral_history]
|
|
14
|
-
|
|
15
|
-
property "date_recorded", :date
|
|
16
|
-
property "file_name", :string
|
|
17
|
-
property "duration", :string
|
|
18
|
-
property "notes", :text
|
|
19
|
-
|
|
20
|
-
# This doesn't make sense when you have both compressed and uncompressed in the same object!
|
|
21
|
-
# Probably better to rely on the file size in datastreamVersion "SIZE" attribute from Fedora anyway
|
|
22
|
-
#property "file_size", :integer
|
|
23
|
-
|
|
24
|
-
#property "restriction", :text
|
|
25
|
-
|
|
26
|
-
datastream "compressed", ["audio/mpeg"], :multiple => true
|
|
27
|
-
datastream "uncompressed", ["audio/wav", "audio/aiff"], :multiple => true
|
|
28
|
-
|
|
29
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require 'active-fedora'
|
|
2
|
-
|
|
3
|
-
class OralHistory < ActiveFedora::Base
|
|
4
|
-
# Imitating DataMapper ...
|
|
5
|
-
|
|
6
|
-
has_many :parts, :property=>:is_part_of
|
|
7
|
-
|
|
8
|
-
# These are all the properties that don't quite fit into Qualified DC
|
|
9
|
-
# Put them on the object itself (in the properties datastream) for now.
|
|
10
|
-
has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
|
|
11
|
-
field "alt_title", :string
|
|
12
|
-
field "narrator", :string
|
|
13
|
-
field "interviewer", :integer
|
|
14
|
-
field "transcript_editor", :text
|
|
15
|
-
field "bio", :string
|
|
16
|
-
field "notes", :text
|
|
17
|
-
field "hard_copy_availability", :text
|
|
18
|
-
field "hard_copy_location", :text
|
|
19
|
-
field "other_contributors", :string
|
|
20
|
-
field "restrictions", :text
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
has_metadata :name => "dublin_core", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
|
|
24
|
-
# Default :multiple => true
|
|
25
|
-
#
|
|
26
|
-
# on retrieval, these will be pluralized and returned as arrays
|
|
27
|
-
# ie. subject_entries = my_oral_history.dublin_core.subjects
|
|
28
|
-
#
|
|
29
|
-
# aimint to use method-missing to support calling methods like
|
|
30
|
-
# my_oral_history.subjects OR my_oral_history.titles OR EVEN my_oral_history.title whenever possible
|
|
31
|
-
|
|
32
|
-
#field :name => "subject_heading", :string, {:xml_node => "subject", :encoding => "LCSH"}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require 'active-fedora'
|
|
2
|
-
|
|
3
|
-
class Seminar
|
|
4
|
-
|
|
5
|
-
include ActiveFedora::Model
|
|
6
|
-
|
|
7
|
-
# Imitating DataMapper ...
|
|
8
|
-
|
|
9
|
-
relationship "parts", :is_part_of, [:seminar_audio_file], :inbound => true
|
|
10
|
-
#has n, :parts, {:predicate => :is_part_of, :likely_types => [:seminar_audio_file], :inbound => true}
|
|
11
|
-
# OR
|
|
12
|
-
# has_parts [:seminar_audio_file]
|
|
13
|
-
|
|
14
|
-
property "title_wylie", :text # Note: reserving title_tibetan for actual UTF-8 tibetan text
|
|
15
|
-
property "title_english", :text
|
|
16
|
-
property "original_media_format", :text
|
|
17
|
-
property "original_media_number_of_units", :integer
|
|
18
|
-
property "author_name_wylie", :text
|
|
19
|
-
property "author_name_english", :text
|
|
20
|
-
property "location", :string
|
|
21
|
-
property "date_recorded", :date
|
|
22
|
-
property "file_name", :string
|
|
23
|
-
property "duration", :string
|
|
24
|
-
property "file_size", :integer
|
|
25
|
-
property "restriction", :text
|
|
26
|
-
property "uri", :string
|
|
27
|
-
property "notes", :text
|
|
28
|
-
|
|
29
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require 'active-fedora'
|
|
2
|
-
|
|
3
|
-
class SeminarAudioFile
|
|
4
|
-
|
|
5
|
-
include ActiveFedora::Model
|
|
6
|
-
|
|
7
|
-
# Imitating DataMapper ...
|
|
8
|
-
|
|
9
|
-
relationship "parent", :is_part_of, :seminar
|
|
10
|
-
#has n, :parents, {:predicate => :is_part_of, :likely_types => [:seminar]}
|
|
11
|
-
# OR
|
|
12
|
-
# is_part_of :seminar
|
|
13
|
-
|
|
14
|
-
property "date_recorded", :date
|
|
15
|
-
property "file_name", :string
|
|
16
|
-
property "duration", :string
|
|
17
|
-
property "uri", :string
|
|
18
|
-
property "notes", :text
|
|
19
|
-
|
|
20
|
-
# TODO: Figure out how to declare access restrictions
|
|
21
|
-
#property "restriction", :text
|
|
22
|
-
set_restrictions ["public", "private"]
|
|
23
|
-
|
|
24
|
-
# A file_size property doesn't make sense when you have both compressed and uncompressed in the same object!
|
|
25
|
-
# Probably better to rely on the file size in datastreamVersion "SIZE" attribute from Fedora anyway
|
|
26
|
-
#property "file_size", :integer
|
|
27
|
-
|
|
28
|
-
datastream "compressed", ["audio/mpeg"], :multiple => true
|
|
29
|
-
datastream "uncompressed", ["audio/wav", "audio/aiff"], :multiple => true
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require "active_fedora"
|
|
2
|
-
class OralHistorySampleModel < ActiveFedora::Base
|
|
3
|
-
|
|
4
|
-
#has_relationship "parts", :is_part_of, :inbound => true
|
|
5
|
-
|
|
6
|
-
has_metadata :name => "properties", :type => ActiveFedora::SimpleDatastream do |m|
|
|
7
|
-
m.field "narrator", :string
|
|
8
|
-
m.field "interviewer", :string
|
|
9
|
-
m.field "transcript_editor", :text
|
|
10
|
-
m.field "bio", :string
|
|
11
|
-
m.field "notes", :text
|
|
12
|
-
m.field "hard_copy_availability", :text
|
|
13
|
-
m.field "hard_copy_location", :text
|
|
14
|
-
m.field "other_contributor", :string
|
|
15
|
-
m.field "restrictions", :text
|
|
16
|
-
m.field "series", :string
|
|
17
|
-
m.field "location", :string
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
has_metadata :name => "dublin_core", :type => ActiveFedora::QualifiedDublinCoreDatastream
|
|
21
|
-
|
|
22
|
-
has_metadata :name => "significant_passages", :type => ActiveFedora::SimpleDatastream do |m|
|
|
23
|
-
m.field "significant_passage", :text
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
has_metadata :name => "sensitive_passages", :type => ActiveFedora::SimpleDatastream do |m|
|
|
27
|
-
m.field "sensitive_passage", :text
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
require "samples/marpa-dc_datastream.rb"
|
|
2
|
-
|
|
3
|
-
# This is an example of an ActiveFedora Model
|
|
4
|
-
#
|
|
5
|
-
# Some of the datastream ids were chosen based on the Hydra modeling conventions. You don't have to follow them in your work.
|
|
6
|
-
# ActiveFedora itself has no notion of those conventions, but we do encourage you to use them.
|
|
7
|
-
#
|
|
8
|
-
# The Hydra conventions encourage you to have a datastream with this dsid whose contents are descriptive metadata like MODS or Dublin Core. They especially encourage MODS.
|
|
9
|
-
# The descMetadata dsid is a Hydra convention for a datastream with descriptive metadata contents, like MODS or Dublin Core. They especially encourage MODS.
|
|
10
|
-
# The rightsMetadata dsid is also a convention provided by the Hydra Common Metadata "content model"
|
|
11
|
-
#
|
|
12
|
-
# For more info on the Hydra conventions, see the documentation on "Common Metadata content model" in https://wiki.duraspace.org/display/hydra/Hydra+content+models+and+disseminators
|
|
13
|
-
# Note that on the wiki, "content model" is often used to refer to Fedora CModels and/or abstract/notional models. The Common Metadata content model is an example of this.
|
|
14
|
-
# The wiki includes a page that attempts to shed some light on the question of "What is a content model?" https://wiki.duraspace.org/display/hydra/Don't+call+it+a+'content+model'!
|
|
15
|
-
class SpecialThing < ActiveFedora::Base
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
# DATASTREAMS
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
# This declares a datastream with Datastream ID (dsid) of "descMetadata"
|
|
22
|
-
# The descMetadata datastream is bound to the Hydra::ModsArticleDatastream class that's defined in lib/active_fedora/samples
|
|
23
|
-
# Any time you load a Fedora object using an instance of SampleModel, the instance will assume its descMetadata datastream conforms to the assumptions in Hydra::ModsArticleDatastream class
|
|
24
|
-
has_metadata "descMetadata", type: Hydra::ModsArticleDatastream
|
|
25
|
-
|
|
26
|
-
# This declares a datastream with Datastream ID (dsid) of "rightsMetadata"
|
|
27
|
-
# Like the descMetadata datastream, any time you load a Fedora object using an instance of SampleModel, the instance will assume its descMetadata datastream conforms to the assumptions in Hydra::RightsMetadataDatastream class
|
|
28
|
-
has_metadata "rightsMetadata", type: Hydra::RightsMetadataDatastream
|
|
29
|
-
|
|
30
|
-
# This is not part of the Hydra conventions
|
|
31
|
-
# Adding an extra datastream called "extraMetadataForFun" that is bound to the Marpa::DcDatastream class
|
|
32
|
-
has_metadata "extraMetadataForFun", type: Marpa::DcDatastream
|
|
33
|
-
|
|
34
|
-
#
|
|
35
|
-
# RELATIONSHIPS
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
# This is an example of how you can add a custom relationship to a model
|
|
39
|
-
# This will allow you to call .derivation on instances of the model to get the _outbound_ "hasDerivation" relationship in the RELS-EXT datastream
|
|
40
|
-
belongs_to :derivation, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.hasDerivation, class_name: 'SpecialThing'
|
|
41
|
-
|
|
42
|
-
# This will allow you to call .inspirations on instances of the model to get a list of all of the objects that assert "hasDerivation" relationships pointing at this object
|
|
43
|
-
has_many :inspirations, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.hasDerivation, class_name: 'SpecialThing'
|
|
44
|
-
end
|