Sha256: 4a44260ebc520209639da1ab64b4a2f210af5d9300ea52e9edee80d865cd5b7b
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
# encoding: UTF-8 class SimilarTermsController < ApplicationController resource_description do name 'Similar concepts' end api :GET, ':lang/similar', <<-DOC Returns labels which are semantically (not orthographically) similar, as determined by concept relations. DOC formats [:html, :ttl, :rdf, :xml, :json] param :terms, String, :required => true, :desc => <<-DOC One or more terms (comma-separated, CSV-style) to be processed. DOC example <<-DOC GET /de/similar.ttl?terms=wald,baum # omitted namespace definitions query:top skos:altLabel "Dünenwald"@de; skos:altLabel "Baumart"@de. DOC def create authorize! :read, Iqvoc::Concept.base_class @terms = InlineDataHelper.parse_inline_values(similar_terms_params) lang = params[:lang] options = { synonyms_only: ['1', 'true'].include?(params[:synonyms_only]) } respond_to do |format| format.html do @results = Services::SimilarTermsService.ranked(lang, options, *@terms) render :show end format.any(:rdf, :ttl, :nt, :xml) do @results = Services::SimilarTermsService.alphabetical(lang, options, *@terms) render :show end format.json { results = Services::SimilarTermsService.alphabetical(lang, options, *@terms) render json: { "url": request.original_url, "total_results": results.length, "results": results.map {|c| c.value } }.to_json } end end def new end private def similar_terms_params params.require(:terms) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
iqvoc_similar_terms-2.11.4 | app/controllers/similar_terms_controller.rb |
iqvoc_similar_terms-2.11.3 | app/controllers/similar_terms_controller.rb |