Neo4j Connection

Does anybody have experience trying to connect with a Neo4j database on a port other than the default provided for in Neo4j.jl? I can’t make heads or tails of it and Julia keeps yelling at me that I am doing it wrong, which I am.

I stopped using neo4j.jl as I found it buggy and use cypher-shell instead which is quite reliable albeit slow.
You can try it out with:
cypher-shell -a neo4j://localhost:7687 --format plain -u USER -p PASSWORD 'match (n) return n'
where -a specifies the address:port. In julia, you can do

read(`cypher-shell -a neo4j://localhost:7687 --format plain -u USER -p PASSWORD 'match (n) return n'`, String)

and process manually the resulting string

This works great thank you. Not so much worried about speed here as all I am doing in setting up relationships between nodes and to do them one at a time would have been mind numbingly tedious and the slowest connection is still exponentially faster than me doing it manually.

Great :wink: Apparently cyper-shell supports scripts as well. More on here and here. I’m using it as well one command at a time - unfortunately it can become quite slow for even small graphs (i.e. tens/hundreds of links).

I’ve been banging my head here about how to create relationships progammatically through Julia.

lets say:
pollen = “Sooy”
offspring = " Pioneer"
and I want to create a relationship in Neo4j called Pollen between Sooy and Pioneer, one way.

the query is
‘MATCH (a.Names),(b.Names)
WHERE a.Cultivar = “Sooy” AND b.Culitvar = “Pioneer”
CREATE (a)-[r:Pollen]->(b)

which is all well and good but I have over 200 of these relationships to create with the names stored in a CSV file. My idea is to load the CSV file into a DataFrame and then iterate through each offspring and create a relationship to the pollen parent and the seed parent. This would require me to use

WHERE a.Cultivar = "(seed)\" AND "b.Cultivar = \"(offspring)" since I need to use interpolation. Any ideas on how to pull this off?

What I do in my usecases is to construct all neo4j statements and run them in parallel.

In the case you provided, you could do something similar to the (incomplete) example below (you can also use a DataFrame as you mentioned)

function preprocess_line(line)
   # preprocess one line of the csv file and extract 'pollen' and 'cultivat'
   return (pollen, cultivar)  # Tuple{String,String}

# Generate a vector of 'MATCH' statements
statements = ["MATCH ... where a.Cultivar=$pollen AND b.Cultivar=$offspring CREATE ..."
                         for (pollen, cultivar) in preprocess_line(eachline(csvfile))]

# Run statements in parallel
@sync for stmt in statements
  @async run(`cypher-shell --format plain -u $USER -p $PASSWORD $stmt`, wait=true);