my goal have list of words in oxford dictionary relationship between them called is_one_step_away_from. each word in relationship same length , varies 1 letter.
i able batch insert words themselves, how can batch insert these relationships?
class word { public string value { get; set; } } public void seeddatabase() { var words = new queue<word>(); enqueuewords(words); //create words batch graphclient.cypher .create("(w:word {words})") .withparam("words", words) .executewithoutresults(); //add relationships 1 word @ time while (words.count > 0) { var word = words.dequeue(); var relatedwords = wordgroups[word.value].except(enumerable.repeat(word.value, 1)).tolist(); if (relatedwords.count > 0) { foreach (string relatedword in relatedwords) { graphclient.cypher .match("(w1 :word { value : {rootword} }), (w2 :word { value : {relatedword} })") .create("(w1)-[r:is_one_step_away_from]->(w2)") .withparam("rootword", word.value) .withparam("relatedword", relatedword) .executewithoutresults(); } } } }
peter have index or constraint on :word(value) ?
i don't understand how batches:
graphclient.cypher .create("(w:word {words})") .withparam("words", words) .executewithoutresults(); and define property-name (aka value).
do run concurrently?
for relationships i'd recommend group them start-word.
then like:
match (w1:word {value:{rootword}}) unwind {relatedwords} relatedword match (w2:word {value:relatedword}} create (w1)-[r:is_one_step_away_from]->(w2); neo4jclient still have learn use new transactional endpoint.
Comments
Post a Comment