Class: Concept::SKOS::Base

Inherits:
Base show all
Defined in:
app/models/concept/skos/base.rb

Overview

Copyright 2011-2013 innoQ Deutschland GmbH

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Attribute Summary

Attributes inherited from Base

#reverse_match_service

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#additional_info, #assigned_collection_origins, #assigned_collection_origins=, #associated_objects_in_editing_mode, broader_tops, #class_path, #concept_relations_by_id, #concept_relations_by_id=, #concept_relations_by_id_and_rank, dashboard_path, edit_link_partial_name, expired, #expired?, for_dashboard, inline_partial_name, #jobs, #labelings_by_text, #labelings_by_text=, #labels_for_labeling_class_and_language, #matches_for_class, new_link_partial_name, not_expired, #notations_for_class, #notes_for_class, parentless, #pref_label, #related_concepts_for_relation_class, #to_param, #to_s, tops, with_associations, with_pref_labels

Methods included from FirstLevelObjectValidations

#distinct_versions, #origin_has_to_be_escaped

Methods included from Validations

#exclusive_broader_and_narrower_concepts, #exclusive_pref_and_alt_labels_per_concept, #exclusive_top_term, #no_self_reference_concept_relation, #pref_label_in_primary_thesaurus_language, #rooted_top_terms, #unique_alt_labels, #unique_pref_label_language, #unique_pref_labels, #valid_rank_for_ranked_relations

Methods included from Versioning

#branch, #disable_validations_for_publishing, #editor_selectable?, #enable_validations_for_publishing, #in_review?, #never_published?, #publish, #publish!, #publishable?, #published?, #state, #to_review, #unpublish, #unpublished?, #validatable_for_publishing?, #with_validations_for_publishing

Class Method Details

.recent(limit = 5) ⇒ Object



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

def self.recent(limit = 5)
  self
  .published
  .not_expired
  .joins(:notes => :annotations)
  .where(note_annotations: { predicate: 'created' })
  .order('note_annotations.value DESC')
  .limit(limit)
end

Instance Method Details

#build_rdf_subject(&block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/concept/skos/base.rb', line 21

def build_rdf_subject(&block)
  ns = IqRdf::Namespace.find_namespace_class(self.rdf_namespace)
  raise "Namespace '#{self.rdf_namespace}' is not defined in IqRdf document." unless ns
  subject = IqRdf.build_uri(self.origin, ns.build_uri(self.rdf_class), &block)

  # ensure skos:Concept type is present
  unless self.rdf_namespace == 'skos' && self.rdf_class == 'Concept'
    subject.Rdf.build_predicate('type', IqRdf::Skos.build_uri('Concept'))
  end

  return subject
end