ontology.rb revision 83c4ccd4fd8640e2ee8639b5d93ddf2dda048bd1
# Ontohub Library Includes
# Ontology Model Includes
# Multiple Class Features
attr_accessible :iri, :name, :description, :logic_id, :category_ids, :documentation, :acronym, :file_extension, :projects, :present
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 iri_for_child(child_name)
child_name.include?("://") ? child_name : "#{iri}?#{child_name}"
end
def is?(logic_name)
self.logic ? (self.logic.name == logic_name) : false
end
end