cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Query all code at once which include periodic (implicitly)

Peter_Lian
Node Clone

The following is my query

##################################

CALL apoc.periodic.iterate('

CALL apoc.load.json("1114-Sysmon-02to01.json") YIELD value return value','

UNWIND value.Event AS col_event

WITH col_event

WHERE col_event.System.EventID = 1

CREATE(process:Process{eventid: coalesce(col_event.System.EventID, "No ID"),

euid:col_event.System.EventRecordID,

pid:col_event.EventData.ProcessGuid})',

{batchSize:10000, iterateList:true, parallel:true})

CALL{

MATCH(e:Process)

MATCH(f:Process)

WHERE e.euid = f.euid AND f.parentID IS NOT NULL

SET e.pid2 = e.pid,

f.pid2 = f.parentID

}

CALL apoc.periodic.iterate("MATCH(e:Process), (f:Process) WHERE e.euid = f.euid AND f.parentID IS NOT NULL AND e.computer IS NOT NULL RETURN e,f",

"CREATE(f)-[r:create_process_to]->(e)",

{batchSize:10000, parallel: true})

##################################

I try query above in once but the following error shows :

Procedure call inside a query does not support naming results implicitly (name explicitly using `YIELD` instead)

Although I can divided above into three pieces to run, but in order to check the performance and efficiency, it must be queried in the same time.

Question : Is there any method to query above code in the same time (don't need to split into pieces)

Thanks.

1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja

apoc.periodic.iterate returns values. Try returning at least one variable to the first method call. Add to the second too, if just the first does not resolve your error. ‘Yield total’ should be sufficient.

https://neo4j.com/labs/apoc/4.1/overview/apoc.periodic/apoc.periodic.iterate/#_output_parameters

View solution in original post

2 REPLIES 2

glilienfield
Ninja
Ninja

apoc.periodic.iterate returns values. Try returning at least one variable to the first method call. Add to the second too, if just the first does not resolve your error. ‘Yield total’ should be sufficient.

https://neo4j.com/labs/apoc/4.1/overview/apoc.periodic/apoc.periodic.iterate/#_output_parameters

It's done. Appreciate about it !

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online