Cross Reference: sentence.rb
xref
: /
ontohub
/
app
/
models
/
sentence.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
sentence.rb revision c5d86c43dd3b1fcd5d11eca04d5e44c28375d06c
2
ronwalf
class
Sentence
<
ActiveRecord
::
Base
2
ronwalf
include
Metadatable
2
ronwalf
include
Readability
2
ronwalf
2
ronwalf
belongs_to
:
ontology
2
ronwalf
has_and_belongs_to_many
:
symbols
,
class_name
:
'OntologyMember::Symbol'
2
ronwalf
has_many
:
translated_sentences
,
dependent
: :
destroy
2
ronwalf
2
ronwalf
scope
:
original
,
where
(
imported
:
false
)
2
ronwalf
2
ronwalf
attr_accessible
:
locid
2
ronwalf
2
ronwalf
alias_attribute
:
to_s
, :
name
2
ronwalf
2
ronwalf
delegate
:
repository
,
to
: :
ontology
2
ronwalf
2
ronwalf
def
self.find
_with_locid
(
locid
,
_iri
=
nil
)
2
ronwalf
where
(
locid
:
locid
)
.
first
2
ronwalf
end
2
ronwalf
2
ronwalf
def
hierarchical_class_names
2
ronwalf
match
=
self.text.match
(%r
{
2
ronwalf
\s*
2
ronwalf
Class
:
2
ronwalf
\s*
2
ronwalf
(?:
2
ronwalf
<
(?<
first_class
>.+)
>|
2
ronwalf
(?<
first_class
>.+)
)
\s*
SubClassOf
:
\s*
(?:
<
(?<
second_class
>.+)
>|
(?<
second_class
>.+)
)
\s*}x)
if
match
[
match
[:
first_class
].
strip
,
match
[:
second_class
].
strip
]
else
[]
end
end
end