Reputation: 712
It's a simple query, but for some reason it's not working
SELECT (n:myBaseLabel) WHERE NOT n:myPossibleSubLabel LIMIT 20
This is the most simple case, where I really don't care what gets returned. The objective is to run
SELECT (n:myBaseLabel) WHERE NOT n:myPossibleSubLabel AND NOT n:myExclusionLabel SET n:myExclusionLabel LIMIT 25000
in a loop to iteratively apply the label myExclusionLabel
to instances of myBaseLabel
that don't have myPossibleSubLabel
. Both the iterative loop and the existence of this exclusion label are for performance reasons in querying the graph, since it has ~50M nodes. Since I'm looping and excluding, I don't care about which get tagged in a given loop, I just want to reduce the memory load while breaking the execution into chunks so I don't entirely lock up the database for a day updating this.
However, in the simple test case I keep getting an error at the I
of LIMIT
, saying:
Invalid input 'I': expected 'o/O' (line 1, column 58 (offset: 57))
which makes no sense to me.
Upvotes: 2
Views: 237
Reputation: 712
Figured out how. Very unintuitively, you need to limit before the operation after a WITH
.
MATCH (n:myBaseLabel)
WHERE NOT n:myPossibleSubLabel AND NOT n:myExclusionLabel
WITH n
LIMIT {updateChunk}
SET n:myExclusionLabel
RETURN count(n)
Upvotes: 3