ontology_search.rb revision e532e91ba3c45c82dc542f135171ee71610bdc86
require 'json'
#
# Beware! This is not tested well.
#
@limit = 20
end
end
end
unless repository.ontologies.where("name = :prefix", prefix: prefix, repository_id: repository).empty?
end
#TODO Search only symbols of ontologies of the repository
#text_list.add(prefix)
end
repository.ontologies.select(:name).where("name ILIKE :prefix", prefix: "#{prefix}%").group("name").limit(5).each do |ontology|
end
ontologies.each do |ontology|
ontology.entities.select(:text).where("text ILIKE :prefix", prefix: "#{prefix}%").group("text").limit(5).each do |symbol|
end
end
end
end
end
text_list.to_a.sort.map { |x| {text: x} }
end
end
end
Ontology.select(:name).where("name ILIKE :prefix", prefix: "#{prefix}%").group("name").limit(5).each do |ontology|
end
Entity.select(:name).where("name ILIKE :prefix", prefix: "#{prefix}%").group("name").limit(5).each do |symbol|
end
if logic.ontologies.size != 0
end
end
text_list.to_a.sort.map { |x| {text: x} }
end
end
end
index = 0
# Display all repository ontologies for empty keyword list
if keyword_list.size == 0
end
return {
resultsInPage: @limit,
}
end
keyword_list.each do |keyword|
end
end
end
if logic = Logic.find_by_name(keyword)
logic.ontologies.each { |o| keyword_hash[o.id] ||= o }
end
if index == 0
else
hash = Hash.new
keyword_hash.each_key do |key|
hash[key] ||= ontology_hash[key] if ontology_hash[key]
end
ontology_hash = hash
end
index += 1
end
index = 0
end
end
{
resultsInPage: @limit,
}
end
{
page: 0,
resultsInPage: 50,
resultsInSet: 0,
}
end
index = 0
keyword_list.each do |keyword|
end
if index == 0
else
hash = Hash.new
keyword_hash.each_key do |key|
hash[key] ||= ontology_hash[key] if ontology_hash[key]
end
ontology_hash = hash
end
index += 1
end
end
end
end