ontology_search.rb revision 2f1746ed2a6130807019891eb44ffcd14af5515a
require 'json'
#
# Beware! This is not tested well.
#
end
@limit = 20
end
end
end
end
types = OntologyType.select([:name, :id]).order(:name).all.map {|type| {"name" => type.name.sub(/Ontology/, "ontologies"), "value" => type.id.to_s, "count" => 10 } }
repositories = Repository.select([:name, :id]).order(:name).all.map {|repository| {"name" => "in " + repository.name, "value" => repository.id.to_s, "count" => 9 } }
projects = Project.select([:name, :id]).order(:name).all.map {|project| {"name" => "from " + project.name, "value" => project.id.to_s, "count" => 8 } }
formalities = FormalityLevel.select([:name, :id]).order(:name).all.map {|formality| {"name" => "in " + formality.name, "value" => formality.id.to_s, "count" => 7 } }
licenses = LicenseModel.select([:name, :id]).order(:name).all.map {|license| {"name" => "under " + license.name, "value" => license.id.to_s, "count" => 6 } }
tasks = Task.select([:name, :id]).order(:name).all.map {|task| {"name" => "for " + task.name[0..-5].from_titlecase_to_spacedlowercase, "value" => task.id.to_s, "count" => 5 } }
filters_map = {
'OntologyType' => [
],
'Repository' => [
],
'Project' => [
],
'FormalityLevel' => [
],
'LicenseModel' => [
],
'Task' => [
]
}
end
#unless repository.ontologies.where("name = :prefix", prefix: prefix, repository_id: repository).empty?
# text_list.add(prefix)
#end
repository.ontologies.select(:name).where("name ILIKE :prefix", prefix: "#{prefix}%").limit(25).group("name").limit(5).each do |ontology|
end
end
end
end
end
end
text_list.to_a.sort.map { |x| {text: x} }
end
text_list.to_a.sort.map { |x| {text: x} }
end
end
keyword_list.each do |keyword|
end
end
end
def select_item(keyword_list, type_name, type)
keyword_list.each do |keyword|
return nil
else
end
end
end
end
end
Response.new(page, @limit, search.total, bean_list_factory.bean_list)
end
end