Module: FRBR::Work
Instance Attribute Summary collapse
Attributes included from Group3
#related_subjects, #subject_of
Attributes included from Group1
#relationships
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Group3
#add_related_subject, #add_subject_of, check_frbr_validity, #remove_related_subject, #remove_subject_of
Methods included from Group1
check_frbr_validity, #related
Instance Attribute Details
Returns the value of attribute creators.
5
6
7
|
# File 'lib/frbr/work.rb', line 5
def creators
@creators
end
|
#realizations ⇒ Object
Also known as:
expressions
Returns the value of attribute realizations.
5
6
7
|
# File 'lib/frbr/work.rb', line 5
def realizations
@realizations
end
|
Returns the value of attribute related_works.
5
6
7
|
# File 'lib/frbr/work.rb', line 5
def related_works
@related_works
end
|
Returns the value of attribute subjects.
5
6
7
|
# File 'lib/frbr/work.rb', line 5
def subjects
@subjects
end
|
#valid_relationships ⇒ Object
Returns the value of attribute valid_relationships.
5
6
7
|
# File 'lib/frbr/work.rb', line 5
def valid_relationships
@valid_relationships
end
|
Class Method Details
.valid_relationships ⇒ Object
63
64
65
|
# File 'lib/frbr/work.rb', line 63
def self.valid_relationships
{:derivative=>:based_on, :described_in=>:describes, :complemented_by=>:complements, :augmented_by=>:augments, :contains=>:contained_in, :preceded_by=>:succeeded_by, :adaptation_of=>:adaptation, :related=>:related}
end
|
Instance Method Details
#add_creator(creator) ⇒ Object
8
9
10
11
12
13
|
# File 'lib/frbr/work.rb', line 8
def add_creator(creator)
raise ArgumentError, "Creator must be a Group 2 entity" unless creator.is_a?(FRBR::Group2)
@creators ||= []
@creators << creator unless @creators.index(creator)
creator.add_creation(self) unless creator.creator_of?(self)
end
|
#add_realization(expression) ⇒ Object
Also known as:
add_expression
25
26
27
28
29
30
|
# File 'lib/frbr/work.rb', line 25
def add_realization(expression)
raise ArgumentError, "Only Expressions can be realizations" unless expression.is_a?(FRBR::Expression)
@realizations ||= []
@realizations << expression unless @realizations.index(expression)
expression.is_realization_of(self)
end
|
53
54
55
56
|
# File 'lib/frbr/work.rb', line 53
def add_related(work)
(action, relationship) = this_method.split("_")
self.add_relationship_to_entity(work, relationship.to_sym, FRBR::Work, true)
end
|
#add_subject(subject) ⇒ Object
41
42
43
44
45
46
|
# File 'lib/frbr/work.rb', line 41
def add_subject(subject)
raise ArgumentError, "Subject must be a Group 3 entity" unless subject.is_a?(FRBR::Group3)
@subjects ||= []
@subjects << subject
subject.add_subject_of(self) unless subject.subject_of && subject.subject_of.index(self)
end
|
#has_creator?(agent) ⇒ Boolean
20
21
22
23
|
# File 'lib/frbr/work.rb', line 20
def has_creator?(agent)
return true if @creators && @creators.index(agent)
return false
end
|
#remove_creator(creator) ⇒ Object
15
16
17
18
|
# File 'lib/frbr/work.rb', line 15
def remove_creator(creator)
@creators.delete(creator)
creator.remove_creation(self) if creator.creator_of?(self)
end
|
#remove_realization(expression) ⇒ Object
Also known as:
remove_expression
34
35
36
37
|
# File 'lib/frbr/work.rb', line 34
def remove_realization(expression)
@realizations.delete(expression) if realizations
expression.clear_realization_of
end
|
58
59
60
61
|
# File 'lib/frbr/work.rb', line 58
def remove_related(work)
(action, relationship) = this_method.split("_")
self.remove_relationship_from_entity(work, relationship.to_sym, FRBR::Work, true)
end
|
#remove_subject(subject) ⇒ Object
48
49
50
51
|
# File 'lib/frbr/work.rb', line 48
def remove_subject(subject)
@subjects.delete(subject) if @subjects
subject.remove_subject_of(self) if subject.subject_of && subject.subject_of.index(self)
end
|