active-fedora 9.0.6 → 9.0.8
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 +5 -5
- data/History.txt +57 -0
- data/lib/active_fedora.rb +5 -0
- data/lib/active_fedora/associations/collection_association.rb +1 -18
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +12 -10
- data/lib/active_fedora/core.rb +15 -17
- 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/errors.rb +4 -0
- data/lib/active_fedora/fedora_attributes.rb +15 -5
- data/lib/active_fedora/file.rb +2 -0
- data/lib/active_fedora/inheritable_accessors.rb +26 -0
- data/lib/active_fedora/reflection.rb +3 -1
- data/lib/active_fedora/relation/finder_methods.rb +27 -3
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/versions_graph.rb +7 -8
- data/spec/integration/associations_spec.rb +34 -22
- data/spec/integration/belongs_to_association_spec.rb +118 -47
- data/spec/integration/collection_association_spec.rb +46 -0
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +178 -139
- data/spec/integration/versionable_spec.rb +38 -1
- data/spec/samples/samples.rb +0 -1
- data/spec/unit/base_spec.rb +51 -0
- 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 +50 -0
- data/spec/unit/has_many_association_spec.rb +27 -2
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -6
- data/spec/unit/reflection_spec.rb +44 -0
- metadata +9 -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
@@ -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
|