Cross Reference: ontology.rb
xref
: /
ontohub
/
app
/
models
/
ontology.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
ontology.rb revision c6d4b32b59680b497a857241b2f1911fdcc22680
class
Ontology
<
ActiveRecord
::
Base
include
Commentable
include
Permissionable
include
Metadatable
include
Ontology
::
Entities
include
Ontology
::
Axioms
include
Ontology
::
Import
include
Ontology
::
States
include
Ontology
::
Versions
belongs_to
:
logic
attr_accessible
:
uri
, :
name
, :
description
, :
logic_id
validates_presence_of
:
uri
validates_uniqueness_of
:
uri
, :
if
=> :
uri_changed
?
validates_format_of
:
uri
, :
with
=>
URI
::
regexp
(
ALLOWED_URI_SCHEMAS
)
strip_attributes
:
only
=> [:
name
, :
uri
]
scope
:
search
, ->
(
query
)
{
where
"uri ILIKE :term OR name ILIKE :term"
, :
term
=>
"%"
<< query
<< "%" }
def to_s
name? ? name : uri
end
# title for links
def title
name? ? uri : nil
end
end