Class: Note::SKOS::ChangeNote
- Inherits:
-
Base
- Object
- Base
- Note::SKOS::ChangeNote
- Defined in:
- app/models/note/skos/change_note.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.
Class Method Summary collapse
- .edit_partial_name(obj) ⇒ Object
- .search_result_partial_name ⇒ Object
- .single_query(params = {}) ⇒ Object
Instance Method Summary collapse
Class Method Details
.edit_partial_name(obj) ⇒ Object
20 21 22 |
# File 'app/models/note/skos/change_note.rb', line 20 def self.edit_partial_name(obj) 'partials/note/skos/edit_change_note' end |
.search_result_partial_name ⇒ Object
24 25 26 |
# File 'app/models/note/skos/change_note.rb', line 24 def self.search_result_partial_name 'partials/note/skos/change_note/search_result' end |
.single_query(params = {}) ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/models/note/skos/change_note.rb', line 28 def self.single_query(params = {}) query_str = build_query_string(params) scope = includes(:annotations) scope = merge(Note::Annotated::Base.where(Note::Annotated::Base.arel_table[:value].matches(query_str))) scope.map { |result| SearchResult.new(result) } end |
Instance Method Details
#build_rdf(document, subject) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/note/skos/change_note.rb', line 36 def build_rdf(document, subject) subject.send(self.rdf_namespace).build_predicate(self.rdf_predicate) do |blank_node| blank_node.Rdfs::comment(self.value, lang: self.language || nil) if self.value self.annotations.order(:namespace, :predicate).each do |annotation| if (IqRdf::Namespace.find_namespace_class(annotation.namespace)) blank_node.send(annotation.namespace.camelcase).send(annotation.predicate, annotation.value.nil? ? '' : annotation.value) else raise "Note::SKOS::ChangeNote#build_rdf: couldn't find Namespace '#{annotation.namespace}'." end end end end |