Class: Concept::SKOS::Base

Inherits:
Base
  • Object
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, #concept_relations_by_id, #concept_relations_by_id=, #concept_relations_by_id_and_rank, edit_link_partial_name, 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, #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_pref_label, #exclusive_top_term, #pref_label_in_primary_thesaurus_language, #rooted_top_terms, #unique_alt_labels, #unique_pref_label, #unique_pref_label_language, #valid_rank_for_ranked_relations

Methods included from Versioning

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

Class Method Details

.expired(time = Time.now) ⇒ Object

********** Scopes



35
36
37
# File 'app/models/concept/skos/base.rb', line 35

def self.expired(time = Time.now)
  where(arel_table[:expired_at].lt(time))
end

.not_expired(time = Time.now) ⇒ Object



39
40
41
42
# File 'app/models/concept/skos/base.rb', line 39

def self.not_expired(time = Time.now)
  col = arel_table[:expired_at]
  where((col.eq(nil)).or(col.gteq(time)))
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