Cross Reference: symbol_mapping.rb
xref
: /
ontohub
/
app
/
models
/
symbol_mapping.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
symbol_mapping.rb revision 34345be5edeac4ef8a69ac3c86d77d51579f3a60
319
N/A
class
SymbolMapping
<
ActiveRecord
::
Base
319
N/A
belongs_to
:
source
,
class_name
:
"Symbol"
319
N/A
belongs_to
:
target
,
class_name
:
"Symbol"
319
N/A
belongs_to
:
mapping
319
N/A
attr_accessible
:
mapping
, :
source
, :
target
319
N/A
KINDS
= %w
(
subsumes
is
-
subsumed
equivalent
incompatible
has
-
instance
instance
-
of
default
-
relation
)
319
N/A
319
N/A
def
to_s
319
N/A
"#{
self.source
} → #{
self.target
}"
319
N/A
end
319
N/A
319
N/A
def
apply
(
sentence
)
319
N/A
sentence.text.gsub
(
source.name
,
target.name
)
319
N/A
end
319
N/A
319
N/A
def
applicable
?
(
sentence
)
319
N/A
if
sentence.is
_a
?
(
TranslatedSentence
)
319
N/A
mapping
=
sentence.symbol
_mapping
319
N/A
symbol_ids
= [
mapping.source
_id
,
mapping.target
_id
]
319
N/A
else
319
N/A
symbol_ids
=
sentence.symbols.pluck
(:
id
)
319
N/A
end
844
N/A
symbol_ids.include
?
(
self.source
_id
)
319
N/A
end
319
N/A
319
N/A
end
319
N/A