Cross Reference: sentences.rb
xref
: /
ontohub
/
app
/
models
/
ontology
/
sentences.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
sentences.rb revision 00e4f15826d75fbfc079bef3e559b7fa4c62e911
881
N/A
module
Ontology
::
Sentences
881
N/A
extend
ActiveSupport
::
Concern
881
N/A
881
N/A
included
do
881
N/A
has_many
:
sentences
, :
extend
=>
Methods
881
N/A
end
881
N/A
881
N/A
module
Methods
881
N/A
def
update_or_create_from_hash
(
hash
,
timestamp
=
Time.now
)
881
N/A
e =
find_or_initialize_by_name
(
hash
[
'name'
])
881
N/A
881
N/A
e.text
=
hash
[
'text'
].
to_s
881
N/A
e.range
=
hash
[
'range'
]
881
N/A
e.updated
_at
=
timestamp
881
N/A
881
N/A
e.save
!
881
N/A
881
N/A
execute_sql
"DELETE FROM sentences_entities WHERE sentence_id=#{
e.id
}"
881
N/A
execute_sql
"INSERT INTO sentences_entities (sentence_id, entity_id, ontology_version_id)
881
N/A
SELECT #{
e.id
}, id, ontology_id FROM entities WHERE
881
N/A
ontology_id=#{@
association.owner.id
} AND text IN (?)"
,
881
N/A
hash
[
'symbols'
]
881
N/A
881
N/A
e
881
N/A
end
881
N/A
end
881
N/A
end
881
N/A