Cross Reference: import.rb
xref
: /
ontohub
/
app
/
models
/
ontology
/
import.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
import.rb revision 3ff4a55d2d96372130084b5c9816c0608eb21210
409
N/A
module
Ontology
::
Import
50
N/A
extend
ActiveSupport
::
Concern
50
N/A
50
N/A
def
import_xml
(
io
)
50
N/A
entities_count
=
0
50
N/A
axioms_count
=
0
50
N/A
50
N/A
transaction
do
50
N/A
OntologyParser.parse
io
,
50
N/A
ontology
:
Proc.new
{ |h|
50
N/A
self.logic
=
Logic.find
_or_create_by_name
h[
'logic'
]
50
N/A
}
,
50
N/A
symbol
:
Proc.new
{ |h|
50
N/A
entities.update
_or_create_from_hash
h
50
N/A
entities_count
+=
1
50
N/A
}
,
50
N/A
axiom
:
Proc.new
{ |h|
50
N/A
axioms.update
_or_create_from_hash
h
50
N/A
axioms_count
+=
1
50
N/A
}
50
N/A
50
N/A
self.entities
_count
=
entities_count
1191
N/A
self.axioms
_count
=
axioms_count
50
N/A
50
N/A
save
!
60
N/A
end
202
N/A
end
50
N/A
50
N/A
def
import_xml_from_file
(
path
)
1431
N/A
import_xml
File.open
path
1431
N/A
end
1431
N/A
1352
N/A
def
import_latest_version
72
N/A
import_xml_from_file
versions.last.xml_file.current
_path
1352
N/A
end
1431
N/A
end
50
N/A