Apoc.periodic.iterate - syntax error or something more fundamental?

Dear all,
I have a script that intends to score the similarity between nodes and then, using apoc.peridoc.iterate, create a relationship between each pair of nodes where the relationship has a property of the Jacquard similarity score.

I am getting a syntax error message for an unexpected apostophe but, because I can't fix it, can't help but think that there is something fundamentally wrong with the script and my newbie grasp of Cypher and interpreting supporting documentation.
Here is the script I am using...
<CALL apoc.periodic.iterate("
Match (p1:Logical_Business_Process)-[:read|:write|:read_write]-(e1:Entity_Type)
WITH p1, collect(id(e1)) AS p1entity_type
MATCH (p2:Logical_Business_Process)-[:read|:write|:read_write]-(e2:Entity_Type) WHERE p1 <> p2
WITH p1, p1entity_type, p2, collect(id(e2)) AS p2entity_type
RETURN p1.Name AS from,
p2.Name AS to,
algo.similarity.jaccard(p1entity_type, p2entity_type) AS similarity
","
CREATE (p1:Logical_Business_Process)-[r:has_similarity_with {Name: p1 + ‘->’ + p2.Name, Jacquard_similarity_score: similarity}]->(p2:Logical_Business_Process) RETURN r.Name, r.Jacquard_similarity_score
",
{batchSize:10000, parallel:true}
)>

The ultimate goal is that I am wanting to be able to create a visual of clusters of nodes (the nodes represent business processes) that have a high Jaccard Similarity score in order that I can scope a suite of projects according to similarity of business processes. Would this be a suitable topic for the "Projects & Collaboration" board? I didn't spot anything similar there.

Kind regards, Douglas

Hi Douglas,

Love the idea! Definitely welcome to post it in your projects and collaboration category, but suggest writing up a bit more about the business value you're looking to accomplish with the clustering and how you'll test, etc.

It looks like you're using straight double quotation marks, but curly/smart quotes for your single quotes. That's likely the cause of the syntax error and something I've experienced a few times myself, especially when copying and pasting from a text editor.

Cheers,
-Ryan

Also would be great if you'd introduce yourself @douglasf001 - Introduce-Yourself - Neo4j Online Community

Thanks for the advice. I have now introduced myself and teed up the topic for collaboration.

1 Like