Class: Concept
Instance Method Summary
collapse
#add_member, #has_struct_metadata?, #member_ids, #members, #remove_member, #representative_image, #representative_image=, #solr_members, #thumbnail_info
#cmodel_pid, #datastreams_in_fedora, #get_representative_generic_resource, #get_singular_rel, #has_desc?, #initialize, #label=, #rdf_type, #rdf_types!, #set_singular_rel, #set_size_labels, #thumbnail_info, #update_datastream_attributes
#proxies, #set_size_labels, #type_label_for, #update_index
Instance Method Details
#abstract ⇒ Object
26
27
28
|
# File 'app/models/concept.rb', line 26
def abstract
get_singular_rel(:abstract)
end
|
#abstract=(val) ⇒ Object
30
31
32
|
# File 'app/models/concept.rb', line 30
def abstract=(val)
set_singular_rel(:abstract, val, true)
end
|
#description ⇒ Object
44
45
46
47
48
|
# File 'app/models/concept.rb', line 44
def description
ds = description_ds
return nil unless ds
ds.content.to_s
end
|
#description=(value) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'app/models/concept.rb', line 50
def description=(value)
ds = description_ds
if value.nil? || value.empty?
if ds
datastreams['descriptionText'].delete
clear_relationship(:description)
end
else
if ds
ds.content = value
else
add_relationship(:description, internal_uri.to_s + "/descriptionText")
datastreams['descriptionText'].content = value
end
end
end
|
#description_ds ⇒ Object
34
35
36
37
38
39
40
|
# File 'app/models/concept.rb', line 34
def description_ds
candidate =
relationships(:description).select { |v| v.to_s.index(self.internal_uri.to_s) == 0 }
candidate = candidate.first
candidate = candidate.to_s.split('/')[2]
datastreams[candidate] unless candidate.blank?
end
|
#index_type_label ⇒ Object
22
23
24
|
# File 'app/models/concept.rb', line 22
def index_type_label
"CONCEPT"
end
|
#restriction ⇒ Object
70
71
72
|
# File 'app/models/concept.rb', line 70
def restriction
get_singular_rel(:restriction)
end
|
#restriction=(val) ⇒ Object
74
75
76
|
# File 'app/models/concept.rb', line 74
def restriction=(val)
set_singular_rel(:restriction, val, true)
end
|
#route_as ⇒ Object
18
19
20
|
# File 'app/models/concept.rb', line 18
def route_as
"concept"
end
|
#short_title ⇒ Object
100
101
102
|
# File 'app/models/concept.rb', line 100
def short_title
get_singular_rel(:short_title)
end
|
#short_title=(val) ⇒ Object
104
105
106
|
# File 'app/models/concept.rb', line 104
def short_title=(val)
set_singular_rel(:short_title, val, true)
end
|
#slug ⇒ Object
80
81
82
|
# File 'app/models/concept.rb', line 80
def slug
get_singular_rel(:slug)
end
|
#slug=(val) ⇒ Object
84
85
86
|
# File 'app/models/concept.rb', line 84
def slug=(val)
set_singular_rel(:slug, val, true)
end
|
#source ⇒ Object
90
91
92
|
# File 'app/models/concept.rb', line 90
def source
get_singular_rel(:source)
end
|
#source=(val) ⇒ Object
94
95
96
|
# File 'app/models/concept.rb', line 94
def source=(val)
set_singular_rel(:source, val)
end
|
#to_solr(solr_doc = Hash.new, opts = {}) ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'app/models/concept.rb', line 108
def to_solr(solr_doc = Hash.new, opts={})
solr_doc = super(solr_doc, opts)
description.tap do |description_value|
if description_value
unless description_ds.is_a? Cul::Hydra::Datastreams::EncodedTextDatastream
description_value = Cul::Hydra::Datastreams::EncodedTextDatastream.utf8able!(description_value).encode(Encoding::UTF_8)
end
description_field_name = ::ActiveFedora::SolrService.solr_name(:description_text, :displayable)
solr_doc[description_field_name] = description_value
end
end
solr_doc
end
|