Class: Concept

Inherits:
GenericAggregator show all
Includes:
ActiveFedora::DatastreamCollections, ActiveFedora::FinderMethods::RepositoryMethods, Cul::Hydra::Models::Aggregator, Cul::Hydra::Models::Common, Hydra::ModelMethods
Defined in:
app/models/concept.rb

Instance Method Summary collapse

Methods included from Cul::Hydra::Models::Aggregator

#add_member, #has_struct_metadata?, #member_ids, #members, #remove_member, #representative_image, #representative_image=, #solr_members, #thumbnail_info

Methods included from Cul::Hydra::Models::Common

#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

Methods inherited from GenericAggregator

#proxies, #set_size_labels, #type_label_for, #update_index

Instance Method Details

#abstractObject



27
28
29
# File 'app/models/concept.rb', line 27

def abstract
  get_singular_rel(:abstract)
end

#abstract=(val) ⇒ Object



31
32
33
# File 'app/models/concept.rb', line 31

def abstract=(val)
  set_singular_rel(:abstract, val, true)
end

#descriptionObject

a marked up description of this concept suitable for embedding in a web page purl.org/dc/terms/description



45
46
47
48
49
# File 'app/models/concept.rb', line 45

def description
  ds = description_ds
  return nil unless ds
  ds.content.to_s
end

#description=(value) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/models/concept.rb', line 51

def description=(value)
  ds = description_ds
  if value.nil? || value.empty?
    if ds
      # Datastreams don't allow empty content, so we need to delete the datastream
      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_dsObject



35
36
37
38
39
40
41
# File 'app/models/concept.rb', line 35

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_labelObject



23
24
25
# File 'app/models/concept.rb', line 23

def index_type_label
  "CONCEPT"
end

#restrictionObject

a human readable PREMIS restriction (‘Onsite’, etc.) www.loc.gov/premis/rdf/v1#hasRestriction



71
72
73
# File 'app/models/concept.rb', line 71

def restriction
  get_singular_rel(:restriction)
end

#restriction=(val) ⇒ Object



75
76
77
# File 'app/models/concept.rb', line 75

def restriction=(val)
  set_singular_rel(:restriction, val, true)
end

#route_asObject



19
20
21
# File 'app/models/concept.rb', line 19

def route_as
  "concept"
end

#short_titleObject

a short or abbreviated title purl.org/ontology/bibo/shortTitle



101
102
103
# File 'app/models/concept.rb', line 101

def short_title
  get_singular_rel(:short_title)
end

#short_title=(val) ⇒ Object



105
106
107
# File 'app/models/concept.rb', line 105

def short_title=(val)
  set_singular_rel(:short_title, val, true)
end

#slugObject

a human readable URI segment for this concept www.bbc.co.uk/ontologies/coreconcepts/slug



81
82
83
# File 'app/models/concept.rb', line 81

def slug
  get_singular_rel(:slug)
end

#slug=(val) ⇒ Object



85
86
87
# File 'app/models/concept.rb', line 85

def slug=(val)
  set_singular_rel(:slug, val, true)
end

#sourceObject

a URI property indicating the service endpoint associated with this concept purl.org/dc/terms/source



91
92
93
# File 'app/models/concept.rb', line 91

def source
  get_singular_rel(:source)
end

#source=(val) ⇒ Object



95
96
97
# File 'app/models/concept.rb', line 95

def source=(val)
  set_singular_rel(:source, val)
end

#to_solr(solr_doc = Hash.new, opts = {}) ⇒ Object



109
110
111
112
113
# File 'app/models/concept.rb', line 109

def to_solr(solr_doc = Hash.new, opts={})
  solr_doc = super(solr_doc, opts)
  solr_doc[::ActiveFedora::SolrService.solr_name(:description_text, :displayable)] = description
  solr_doc
end