Class: LinkedRails::Ontology::Base

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, Model
Defined in:
app/models/linked_rails/ontology/base.rb

Direct Known Subclasses

Class, Property

Constant Summary

Constants included from Model::Collections

Model::Collections::COLLECTION_CUSTOMIZABLE_OPTIONS, Model::Collections::COLLECTION_OPTIONS, Model::Collections::COLLECTION_STATIC_OPTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Model

#build_child

Methods included from Model::Singularable

#root_relative_iri, #root_relative_singular_iri, #singular_iri, #singular_iri?, #singular_iri_opts, #singular_iri_template, #singular_resource?

Methods included from Model::Serialization

#preview_includes, #show_includes

Methods included from Model::Menuable

#menu, #menu_list, #menus

Methods included from Model::IRI

#anonymous_iri, #anonymous_iri?, #iri_elements, #iri_opts, #rdf_type, #reload, #root_relative_iri, #route_fragment

Methods included from Model::Enhancements

#enhanced_with?

Methods included from Model::Dirty

#previously_changed_relations

Methods included from Model::Collections

#collection_for, #collection_iri, #collection_options_for, #collection_root_relative_iri, #parent_collections

Methods included from Model::Actionable

#action, #action_list, #action_triples, #actions, #collection_actions, #favorite_actions

Instance Attribute Details

#iriObject

Returns the value of attribute iri.



8
9
10
# File 'app/models/linked_rails/ontology/base.rb', line 8

def iri
  @iri
end

Instance Method Details

#dataObject



10
11
12
13
14
15
16
17
18
19
# File 'app/models/linked_rails/ontology/base.rb', line 10

def data
  data = []
  iri.try(:each_statement) do |statement|
    next unless include_data_statement?(statement)

    statement.graph_name = ::RDF::Serializers.config.default_graph
    data << statement
  end
  data
end

#descriptionObject



21
22
23
24
25
# File 'app/models/linked_rails/ontology/base.rb', line 21

def description
  @description ||= LinkedRails.translations(
    -> { LinkedRails.translate(self.class.translation_key, :description, iri) }
  )
end

#imageObject



27
28
29
# File 'app/models/linked_rails/ontology/base.rb', line 27

def image
  @image ||= RDF::URI("http://fontawesome.io/icon/#{icon}") if icon
end

#labelObject



31
32
33
34
35
# File 'app/models/linked_rails/ontology/base.rb', line 31

def label
  @label ||= LinkedRails.translations(
    -> { LinkedRails.translate(self.class.translation_key, :label, iri) }
  )
end