Skip to content

Commit

Permalink
More optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcauliffe committed Mar 8, 2019
1 parent 839be3c commit 6389519
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions polyglotdb/io/importer/from_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,16 +708,29 @@ def import_syllable_csv(corpus_context, call_back=None, stop_check=None):
(n)-[:contained_by]->(s),
(s)-[:spoken_by]->(sp),
(s)-[:spoken_in]->(d)
'''
statement = rel_statement.format(path=csv_path,
corpus=corpus_context.cypher_safe_name,
word_name=corpus_context.word_name,
phone_name=corpus_context.phone_name)
corpus_context.execute_cypher(statement)
print('Relationships took: {} seconds'.format(time.time()-begin))

begin = time.time()
prev_rel_statement = '''
USING PERIODIC COMMIT 2000
LOAD CSV WITH HEADERS FROM "{path}" as csvLine
MATCH (s:syllable:{corpus}:speech {{id: csvLine.id}})
with csvLine, s
MATCH (prev:syllable {{id:csvLine.prev_id}})
CREATE (prev)-[:precedes]->(s)
'''
statement = rel_statement.format(path=csv_path,
statement = prev_rel_statement.format(path=csv_path,
corpus=corpus_context.cypher_safe_name,
word_name=corpus_context.word_name,
phone_name=corpus_context.phone_name)
corpus_context.execute_cypher(statement)
print('Relationships took: {} seconds'.format(time.time()-begin))
print('Prev relationships took: {} seconds'.format(time.time()-begin))

begin = time.time()
del_rel_statement = '''
Expand Down

0 comments on commit 6389519

Please sign in to comment.