ontology.rb revision 7053f64d201844e5a0529046e790fc6855c3e268
# Ontohub Library Includes
# Ontology Model Includes
# Multiple Class Features
attr_accessible :iri, :name, :description, :logic_id, :category_ids, :documentation, :acronym, :file_extension, :projects
allow_blank: true,
delegate :permission?, to: :repository
strip_attributes :only => [:name, :iri]
scope :search, ->(query) { where "ontologies.iri #{connection.ilike_operator} :term OR name #{connection.ilike_operator} :term", :term => "%" << query << "%" }
scope :list, includes(:logic).order('ontologies.state asc, ontologies.entities_count desc')
def to_s
name? ? name : iri
end
# title for links
def title
name? ? iri : nil
end
def symbols
entities
end
def symbols_count
entities_count
end
def path
"#{basepath}#{file_extension}"
end
def is?(logic_name)
self.logic ? (self.logic.name == logic_name) : false
end
end